Skip to content

Commit

Permalink
zephyr: clippy: Simple suggestion updates
Browse files Browse the repository at this point in the history
A few updates suggested by clippy to make the code more idiomatic.

Signed-off-by: David Brown <[email protected]>
  • Loading branch information
d3zd3z committed Jan 17, 2025
1 parent 0f5d37c commit e005432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions zephyr/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ where
///
/// If it is called an additional time, it will return None.
pub fn init_once(&self, args: <Self as Wrapped>::I) -> Option<<Self as Wrapped>::T> {
if let Err(_) = self.init.compare_exchange(
KOBJ_UNINITIALIZED,
KOBJ_INITING,
Ordering::AcqRel,
Ordering::Acquire,
) {
if self
.init
.compare_exchange(
KOBJ_UNINITIALIZED,
KOBJ_INITING,
Ordering::AcqRel,
Ordering::Acquire,
)
.is_err()
{
return None;
}
let result = self.get_wrapped(args);
Expand Down
2 changes: 1 addition & 1 deletion zephyr/src/sys/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ mod closure {

pub unsafe extern "C" fn child(child: *mut c_void, _p2: *mut c_void, _p3: *mut c_void) {
let thread_data: Box<ThreadData> = unsafe { Box::from_raw(child as *mut ThreadData) };
let closure = (*thread_data).closure;
let closure = thread_data.closure;
closure();
}
}

0 comments on commit e005432

Please sign in to comment.