Skip to content

Commit

Permalink
Address clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Sep 18, 2024
1 parent 23e9048 commit c5a0945
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions crates/examples/root-task/serial-device/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct FreePagePlaceHolder(#[allow(dead_code)] [u8; GRANULE_SIZE]);
static mut FREE_PAGE_PLACEHOLDER: FreePagePlaceHolder = FreePagePlaceHolder([0; GRANULE_SIZE]);

fn init_free_page_addr(bootinfo: &sel4::BootInfo) -> usize {
let addr = unsafe { ptr::addr_of!(FREE_PAGE_PLACEHOLDER) as usize };
let addr = ptr::addr_of!(FREE_PAGE_PLACEHOLDER) as usize;
get_user_image_frame_slot(bootinfo, addr)
.cap()
.frame_unmap()
Expand All @@ -204,7 +204,7 @@ fn get_user_image_frame_slot(
extern "C" {
static __executable_start: usize;
}
let user_image_addr = unsafe { ptr::addr_of!(__executable_start) as usize };
let user_image_addr = ptr::addr_of!(__executable_start) as usize;
bootinfo
.user_image_frames()
.index(addr / GRANULE_SIZE - user_image_addr / GRANULE_SIZE)
Expand Down
9 changes: 4 additions & 5 deletions crates/examples/root-task/spawn-task/child/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fn inner_entry() -> ! {
}

match catch_unwind(main) {
#[allow(unreachable_patterns)]
Ok(never) => never,
Err(_) => abort!("main() panicked"),
}
Expand All @@ -60,9 +61,7 @@ fn get_ipc_buffer() -> *mut sel4::IpcBuffer {
extern "C" {
static _end: usize;
}
unsafe {
(ptr::addr_of!(_end) as usize)
.next_multiple_of(sel4::cap_type::Granule::FRAME_OBJECT_TYPE.bytes())
as *mut sel4::IpcBuffer
}
(ptr::addr_of!(_end) as usize)
.next_multiple_of(sel4::cap_type::Granule::FRAME_OBJECT_TYPE.bytes())
as *mut sel4::IpcBuffer
}
4 changes: 2 additions & 2 deletions crates/examples/root-task/spawn-task/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct FreePagePlaceHolder(#[allow(dead_code)] [u8; GRANULE_SIZE]);
static mut FREE_PAGE_PLACEHOLDER: FreePagePlaceHolder = FreePagePlaceHolder([0; GRANULE_SIZE]);

fn init_free_page_addr(bootinfo: &sel4::BootInfo) -> usize {
let addr = unsafe { ptr::addr_of!(FREE_PAGE_PLACEHOLDER) as usize };
let addr = ptr::addr_of!(FREE_PAGE_PLACEHOLDER) as usize;
get_user_image_frame_slot(bootinfo, addr)
.cap()
.frame_unmap()
Expand All @@ -115,7 +115,7 @@ fn get_user_image_frame_slot(
extern "C" {
static __executable_start: usize;
}
let user_image_addr = unsafe { ptr::addr_of!(__executable_start) as usize };
let user_image_addr = ptr::addr_of!(__executable_start) as usize;
bootinfo
.user_image_frames()
.index(addr / GRANULE_SIZE - user_image_addr / GRANULE_SIZE)
Expand Down
2 changes: 1 addition & 1 deletion crates/examples/root-task/spawn-thread/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn get_user_image_frame_slot(
extern "C" {
static __executable_start: usize;
}
let user_image_addr = unsafe { ptr::addr_of!(__executable_start) as usize };
let user_image_addr = ptr::addr_of!(__executable_start) as usize;
bootinfo
.user_image_frames()
.index(addr / GRANULE_SIZE - user_image_addr / GRANULE_SIZE)
Expand Down
1 change: 1 addition & 0 deletions crates/sel4-async/block-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ impl<T: AsRef<[u8]>> ByteIO<ReadOnly> for SliceByteIO<T> {
Operation::Read { buf, .. } => {
buf.copy_from_slice(&self.inner().as_ref()[offset..][..buf.len()]);
}
#[allow(unreachable_patterns)]
Operation::Write { witness, .. } => witness.absurd(),
}
Ok(())
Expand Down
1 change: 1 addition & 0 deletions crates/sel4-sync/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub trait MutexSyncOps {
unsafe impl<O: MutexSyncOps> lock_api::RawMutex for GenericRawMutex<O> {
type GuardMarker = lock_api::GuardNoSend; // TODO

#[allow(clippy::declare_interior_mutable_const)]
const INIT: Self = unimplemented!();

fn lock(&self) {
Expand Down
9 changes: 3 additions & 6 deletions crates/sel4/build-env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ fn get_asserting_valid_unicode(var: &str) -> Option<String> {
}
})
.ok()
.map(|val| {
.inspect(|_| {
println!("cargo:rerun-if-env-changed={var}");
val
})
}

Expand All @@ -40,9 +39,8 @@ pub fn try_get_with_sel4_prefix_relative_fallback(
get_asserting_valid_unicode(var)
.map(PathBuf::from)
.or_else(|| get_sel4_prefix().map(|fallback| fallback.join(relative_path_from_fallback)))
.map(|path| {
.inspect(|path| {
println!("cargo:rerun-if-changed={}", path.display());
path
})
}

Expand All @@ -56,9 +54,8 @@ pub fn get_libsel4_include_dirs() -> impl Iterator<Item = PathBuf> {
.or_else(|| get_sel4_prefix().map(|sel4_prefix| vec![sel4_prefix.join("libsel4/include")]))
.unwrap_or_else(|| panic!("{SEL4_INCLUDE_DIRS_ENV} or {SEL4_PREFIX_ENV} must be set"))
.into_iter()
.map(|path| {
.inspect(|path| {
println!("cargo:rerun-if-changed={}", path.display());
path
})
}

Expand Down

0 comments on commit c5a0945

Please sign in to comment.