Skip to content

Commit 8653c0f

Browse files
committed
zephyr: clippy: Simple suggestion updates
A few updates suggested by clippy to make the code more idiomatic. Signed-off-by: David Brown <[email protected]>
1 parent cc36fb5 commit 8653c0f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

zephyr/src/object.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,16 @@ where
188188
///
189189
/// If it is called an additional time, it will return None.
190190
pub fn init_once(&self, args: <Self as Wrapped>::I) -> Option<<Self as Wrapped>::T> {
191-
if let Err(_) = self.init.compare_exchange(
192-
KOBJ_UNINITIALIZED,
193-
KOBJ_INITING,
194-
Ordering::AcqRel,
195-
Ordering::Acquire,
196-
) {
191+
if self
192+
.init
193+
.compare_exchange(
194+
KOBJ_UNINITIALIZED,
195+
KOBJ_INITING,
196+
Ordering::AcqRel,
197+
Ordering::Acquire,
198+
)
199+
.is_err()
200+
{
197201
return None;
198202
}
199203
let result = self.get_wrapped(args);

zephyr/src/sys/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ mod closure {
507507

508508
pub unsafe extern "C" fn child(child: *mut c_void, _p2: *mut c_void, _p3: *mut c_void) {
509509
let thread_data: Box<ThreadData> = unsafe { Box::from_raw(child as *mut ThreadData) };
510-
let closure = (*thread_data).closure;
510+
let closure = thread_data.closure;
511511
closure();
512512
}
513513
}

0 commit comments

Comments
 (0)