Skip to content

Commit a88f483

Browse files
committed
Fix lints for Rust 1.84
1 parent 353d20a commit a88f483

File tree

49 files changed

+83
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+83
-79
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,18 @@ rust-2024-compatibility = { level = "warn", priority = -1 }
591591
edition_2024_expr_fragment_specifier = "allow"
592592
impl_trait_overcaptures = "allow"
593593
deprecated-safe-2024 = "allow"
594+
tail-expr-drop-order = "allow"
595+
if-let-rescope = "allow"
594596

595597
unused_qualifications = "warn"
596598

597599
# Code that needs unsafe should opt-in via a module-scoped allow.
598600
unsafe_code = "deny"
599601
unsafe_op_in_unsafe_fn = "forbid"
600602

603+
# TODO: Needed for xshell compatibility, fixed in v0.2.7
604+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(trick_rust_analyzer_into_highlighting_interpolated_bits)'] }
605+
601606
[workspace.lints.clippy]
602607
dbg_macro = "warn"
603608
debug_assert_with_mut_call = "warn"

openhcl/openhcl_boot/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ fn validate_vp_hw_ids(partition_info: &PartitionInfo) {
825825
if let Some((i, &vp_index)) = vp_indexes
826826
.iter()
827827
.enumerate()
828-
.find(|(i, &vp_index)| *i as u32 != vp_index)
828+
.find(|&(i, vp_index)| i as u32 != *vp_index)
829829
{
830830
panic!(
831831
"CPU hardware ID {:#x} does not correspond to VP index {}",

openhcl/sidecar_client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ impl<'a> SidecarVp<'a> {
572572
match &mut *vp {
573573
VpState::Stopped => unreachable!(),
574574
VpState::Running(waker) => {
575-
if !waker.as_ref().map_or(false, |w| cx.waker().will_wake(w)) {
575+
if !waker.as_ref().is_some_and(|w| cx.waker().will_wake(w)) {
576576
*waker = Some(cx.waker().clone());
577577
}
578578
Poll::Pending

openhcl/underhill_confidentiality/src/getters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ static CONFIDENTIAL: OnceLock<bool> = OnceLock::new();
77
static CONFIDENTIAL_DEBUG: OnceLock<bool> = OnceLock::new();
88

99
fn get_bool_env_var(name: &str) -> bool {
10-
std::env::var_os(name).map_or(false, |v| !v.is_empty() && v != "0")
10+
std::env::var_os(name).is_some_and(|v| !v.is_empty() && v != "0")
1111
}
1212

1313
/// Gets whether the current VM is a confidential VM.

openhcl/underhill_core/src/get_tracing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl GetTracingBackend {
185185

186186
/// Enables tracing output to the tracing task and to stderr.
187187
pub fn init_tracing(spawn: impl Spawn, tracer: RemoteTracer) -> anyhow::Result<()> {
188-
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").map_or(false, |v| !v.is_empty()) {
188+
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").is_some_and(|v| !v.is_empty()) {
189189
tracelimit::disable_rate_limiting(true);
190190
}
191191

openhcl/underhill_crash/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Options {
6262
);
6363

6464
let verbose_var = std::env::var("UNDERHILL_CRASH_VERBOSE").unwrap_or_default();
65-
let verbose = verbose_var == "1" || verbose_var.to_ascii_lowercase() == "true";
65+
let verbose = verbose_var == "1" || verbose_var.eq_ignore_ascii_case("true");
6666

6767
Self {
6868
pid,

openhcl/underhill_dump/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn main() -> ! {
3737
pub fn do_main() -> anyhow::Result<()> {
3838
let mut args = std::env::args().skip(1).peekable();
3939

40-
let level = if args.peek().map_or(false, |x| x == "-v") {
40+
let level = if args.peek().is_some_and(|x| x == "-v") {
4141
args.next();
4242
Level::DEBUG
4343
} else {

openhcl/virt_mshv_vtl/src/processor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<'p, T: Backing> Processor for UhProcessor<'p, T> {
669669
// Ensure the waker is set.
670670
if !last_waker
671671
.as_ref()
672-
.map_or(false, |waker| cx.waker().will_wake(waker))
672+
.is_some_and(|waker| cx.waker().will_wake(waker))
673673
{
674674
last_waker = Some(cx.waker().clone());
675675
self.inner.waker.write().clone_from(&last_waker);

openvmm/openvmm_entry/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,9 +1329,9 @@ fn cleanup_socket(path: &Path) {
13291329
#[cfg(windows)]
13301330
let is_socket = pal::windows::fs::is_unix_socket(path).unwrap_or(false);
13311331
#[cfg(not(windows))]
1332-
let is_socket = path.metadata().map_or(false, |meta| {
1333-
std::os::unix::fs::FileTypeExt::is_socket(&meta.file_type())
1334-
});
1332+
let is_socket = path
1333+
.metadata()
1334+
.is_ok_and(|meta| std::os::unix::fs::FileTypeExt::is_socket(&meta.file_type()));
13351335

13361336
if is_socket {
13371337
let _ = std::fs::remove_file(path);

openvmm/openvmm_entry/src/tracing_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn enable_tracing() -> anyhow::Result<()> {
3737
.add_directive(base.parse().unwrap())
3838
};
3939

40-
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").map_or(false, |v| !v.is_empty()) {
40+
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").is_ok_and(|v| !v.is_empty()) {
4141
tracelimit::disable_rate_limiting(true);
4242
}
4343

0 commit comments

Comments
 (0)