From e0054324e63aad09e9aa3c26b3174653d5ac0c9a Mon Sep 17 00:00:00 2001
From: David Brown <david.brown@linaro.org>
Date: Thu, 16 Jan 2025 17:05:23 -0700
Subject: [PATCH] zephyr: clippy: Simple suggestion updates

A few updates suggested by clippy to make the code more idiomatic.

Signed-off-by: David Brown <david.brown@linaro.org>
---
 zephyr/src/object.rs     | 16 ++++++++++------
 zephyr/src/sys/thread.rs |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/zephyr/src/object.rs b/zephyr/src/object.rs
index 74fe4ee..6f40ea0 100644
--- a/zephyr/src/object.rs
+++ b/zephyr/src/object.rs
@@ -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);
diff --git a/zephyr/src/sys/thread.rs b/zephyr/src/sys/thread.rs
index 90f73b4..f2a8eea 100644
--- a/zephyr/src/sys/thread.rs
+++ b/zephyr/src/sys/thread.rs
@@ -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();
     }
 }