bolts: fix netbsd/openbsd clippy (#1459)

This commit is contained in:
David CARLIER 2023-08-24 20:41:44 +01:00 committed by GitHub
parent 209d38a768
commit 4a96354276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -790,8 +790,7 @@ mod netbsd {
#[allow(trivial_numeric_casts)] #[allow(trivial_numeric_casts)]
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> { pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
Ok((0..(usize::from(available_parallelism()?))) Ok((0..(usize::from(available_parallelism()?)))
.into_iter() .map(CoreId)
.map(|n| CoreId(n))
.collect::<Vec<_>>()) .collect::<Vec<_>>())
} }
@ -845,8 +844,7 @@ mod openbsd {
#[allow(trivial_numeric_casts)] #[allow(trivial_numeric_casts)]
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> { pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
Ok((0..(usize::from(available_parallelism()?))) Ok((0..(usize::from(available_parallelism()?)))
.into_iter() .map(CoreId)
.map(|n| CoreId(n))
.collect::<Vec<_>>()) .collect::<Vec<_>>())
} }
} }

View File

@ -642,7 +642,9 @@ fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Er
libc::VM_PROC, libc::VM_PROC,
libc::VM_PROC_MAP, libc::VM_PROC_MAP,
-1, -1,
std::mem::size_of::<libc::kinfo_vmentry>() as i32, std::mem::size_of::<libc::kinfo_vmentry>()
.try_into()
.expect("Invalid libc::kinfo_vmentry size"),
]; ];
let mib = arr.as_ptr(); let mib = arr.as_ptr();
let miblen = arr.len() as u32; let miblen = arr.len() as u32;
@ -737,7 +739,7 @@ fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Er
} }
// OpenBSD's vm mappings have no knowledge of their paths on disk // OpenBSD's vm mappings have no knowledge of their paths on disk
let i = format!("{}-{}\n", entry.kve_start, entry.kve_end); let i = format!("{}-{}\n", entry.kve_start, entry.kve_end);
writer.write(&i.into_bytes())?; writer.write_all(&i.into_bytes())?;
entry.kve_start = entry.kve_start + 1; entry.kve_start = entry.kve_start + 1;
} }
} }