Skip to content

Commit

Permalink
style: fix clippy errors from 2024-11-28
Browse files Browse the repository at this point in the history
  • Loading branch information
n0toose committed Nov 28, 2024
1 parent b1252a7 commit d2c79d1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn detect_freq_from_cpuid(

let has_invariant_tsc = cpuid
.get_advanced_power_mgmt_info()
.map_or(false, |apm_info| apm_info.has_invariant_tsc());
.is_some_and(|apm_info| apm_info.has_invariant_tsc());
if !has_invariant_tsc {
warn!("TSC frequency varies with speed-stepping")
}
Expand Down Expand Up @@ -268,12 +268,11 @@ mod tests {
fn test_detect_freq_from_cpuid() {
let cpuid = raw_cpuid::CpuId::new();
let has_tsc = cpuid
.get_feature_info()
.map_or(false, |finfo| finfo.has_tsc());
.get_feature_info().is_some_and(|finfo| finfo.has_tsc());

let has_invariant_tsc = cpuid
.get_advanced_power_mgmt_info()
.map_or(false, |apm_info| apm_info.has_invariant_tsc());
.is_some_and(|apm_info| apm_info.has_invariant_tsc());

let tsc_frequency_hz = cpuid.get_tsc_info().map(|tinfo| {
if tinfo.tsc_frequency().is_some() {
Expand Down
2 changes: 1 addition & 1 deletion src/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub fn copy_argv(path: &OsStr, argv: &[String], syscmdval: &CmdvalParams, mem: &

// Copy the application arguments into the vm memory
for (counter, argument) in argv.iter().enumerate() {
let len = argument.as_bytes().len();
let len = argument.len();
let arg_dest = unsafe {
mem.slice_at_mut(arg_addrs[counter], len + 1)
.expect("Systemcall parameters for Cmdval are invalid")
Expand Down
2 changes: 1 addition & 1 deletion src/virtqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct AvailIter<'a> {
queue_size: u16,
}

impl<'a> Iterator for AvailIter<'a> {
impl Iterator for AvailIter<'_> {
type Item = u16;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion uhyve-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub enum Hypercall<'a> {
/// Write a buffer to the terminal.
SerialWriteBuffer(&'a SerialWriteBufferParams),
}
impl<'a> Hypercall<'a> {
impl Hypercall<'_> {
// TODO: Remove this in the next major version
/// Get a hypercall's port address.
pub fn port(&self) -> u16 {
Expand Down

0 comments on commit d2c79d1

Please sign in to comment.