clippy learned some new tricks

This commit is contained in:
Ralf Jung 2022-10-07 17:53:18 +02:00
parent c2adc2e234
commit 58b13b7b88
4 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,7 @@
clippy::type_complexity,
clippy::single_element_loop,
clippy::needless_return,
clippy::bool_to_int_with_if,
// We are not implementing queries here so it's fine
rustc::potential_query_instability
)]

View File

@ -42,7 +42,7 @@ fn call_dlsym(
);
}
let &[ref _sig, ref _func] = check_arg_count(args)?;
let [_sig, _func] = check_arg_count(args)?;
this.write_null(dest)?;
}
}

View File

@ -1073,7 +1073,7 @@ fn linux_statx(
mask |= this.eval_libc("STATX_ATIME")?.to_u32()?;
InterpResult::Ok(tup)
})
.unwrap_or(Ok((0, 0)))?;
.unwrap_or_else(|| Ok((0, 0)))?;
let (created_sec, created_nsec) = metadata
.created
@ -1081,7 +1081,7 @@ fn linux_statx(
mask |= this.eval_libc("STATX_BTIME")?.to_u32()?;
InterpResult::Ok(tup)
})
.unwrap_or(Ok((0, 0)))?;
.unwrap_or_else(|| Ok((0, 0)))?;
let (modified_sec, modified_nsec) = metadata
.modified
@ -1089,7 +1089,7 @@ fn linux_statx(
mask |= this.eval_libc("STATX_MTIME")?.to_u32()?;
InterpResult::Ok(tup)
})
.unwrap_or(Ok((0, 0)))?;
.unwrap_or_else(|| Ok((0, 0)))?;
// Now we write everything to `statxbuf`. We write a zero for the unavailable fields.
this.write_int_fields_named(

View File

@ -45,6 +45,7 @@ pub fn new(i: u64) -> Option<Self> {
}
// The default to be used when SB is disabled
#[allow(clippy::should_implement_trait)]
pub fn default() -> Self {
Self::new(1).unwrap()
}