Clippy fixes

This commit is contained in:
Jeremy Soller
2022-11-11 13:19:14 -07:00
parent 515a03b870
commit 8e0f54cb31
27 changed files with 76 additions and 87 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) {
// Since Arc is essentially just wraps a pointer, in this case a regular pointer (as
// opposed to dyn or slice fat pointers), and NonNull optimization exists, map_or will
// hopefully be optimized down to checking prev and next pointers, as next cannot be null.
Some(ref next_space) => if prev.addr_space.as_ref().map_or(true, |prev_space| !Arc::ptr_eq(&prev_space, &next_space)) {
Some(ref next_space) => if prev.addr_space.as_ref().map_or(true, |prev_space| !Arc::ptr_eq(prev_space, next_space)) {
// Suppose we have two sibling threads A and B. A runs on CPU 0 and B on CPU 1. A
// recently called yield and is now here about to switch back. Meanwhile, B is
// currently creating a new mapping in their shared address space, for example a
+1 -1
View File
@@ -285,7 +285,7 @@ impl<T, const ALIGN: usize> AlignedBox<T, ALIGN> {
Ok(unsafe {
let ptr = crate::ALLOCATOR.alloc_zeroed(Self::LAYOUT);
if ptr.is_null() {
return Err(Enomem)?;
return Err(Enomem);
}
Self {
inner: Unique::new_unchecked(ptr.cast()),
+1 -1
View File
@@ -97,7 +97,7 @@ impl AddrSpace {
// TODO: Remove reborrow? In that case, physmapped memory will need to either be
// remapped when cloning, or be backed by a file descriptor (like
// `memory:physical`).
new_grant = Grant::reborrow(&grant, Page::containing_address(grant.start_address()), this_mapper, new_mapper, ())?;
new_grant = Grant::reborrow(grant, Page::containing_address(grant.start_address()), this_mapper, new_mapper, ())?;
}
new_guard.grants.insert(new_grant);