Skip to content

Commit 58b13b7

Browse files
committed
clippy learned some new tricks
1 parent c2adc2e commit 58b13b7

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/tools/miri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
clippy::type_complexity,
2929
clippy::single_element_loop,
3030
clippy::needless_return,
31+
clippy::bool_to_int_with_if,
3132
// We are not implementing queries here so it's fine
3233
rustc::potential_query_instability
3334
)]

src/tools/miri/src/shims/unix/android/dlsym.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
4242
);
4343
}
4444

45-
let &[ref _sig, ref _func] = check_arg_count(args)?;
45+
let [_sig, _func] = check_arg_count(args)?;
4646
this.write_null(dest)?;
4747
}
4848
}

src/tools/miri/src/shims/unix/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,23 +1073,23 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10731073
mask |= this.eval_libc("STATX_ATIME")?.to_u32()?;
10741074
InterpResult::Ok(tup)
10751075
})
1076-
.unwrap_or(Ok((0, 0)))?;
1076+
.unwrap_or_else(|| Ok((0, 0)))?;
10771077

10781078
let (created_sec, created_nsec) = metadata
10791079
.created
10801080
.map(|tup| {
10811081
mask |= this.eval_libc("STATX_BTIME")?.to_u32()?;
10821082
InterpResult::Ok(tup)
10831083
})
1084-
.unwrap_or(Ok((0, 0)))?;
1084+
.unwrap_or_else(|| Ok((0, 0)))?;
10851085

10861086
let (modified_sec, modified_nsec) = metadata
10871087
.modified
10881088
.map(|tup| {
10891089
mask |= this.eval_libc("STATX_MTIME")?.to_u32()?;
10901090
InterpResult::Ok(tup)
10911091
})
1092-
.unwrap_or(Ok((0, 0)))?;
1092+
.unwrap_or_else(|| Ok((0, 0)))?;
10931093

10941094
// Now we write everything to `statxbuf`. We write a zero for the unavailable fields.
10951095
this.write_int_fields_named(

src/tools/miri/src/stacked_borrows/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl SbTag {
4545
}
4646

4747
// The default to be used when SB is disabled
48+
#[allow(clippy::should_implement_trait)]
4849
pub fn default() -> Self {
4950
Self::new(1).unwrap()
5051
}

0 commit comments

Comments
 (0)