]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/vxworks/condvar.rs
Format libstd/sys with rustfmt
[rust.git] / src / libstd / sys / vxworks / condvar.rs
index 783c3eb7c766f3b49537df462992c724fd24f18a..f2a1d6815290d220879ac2f9023f842828bfbf5a 100644 (file)
@@ -2,15 +2,15 @@
 use crate::sys::mutex::{self, Mutex};
 use crate::time::Duration;
 
-pub struct Condvar { inner: UnsafeCell<libc::pthread_cond_t> }
+pub struct Condvar {
+    inner: UnsafeCell<libc::pthread_cond_t>,
+}
 
 unsafe impl Send for Condvar {}
 unsafe impl Sync for Condvar {}
 
-const TIMESPEC_MAX: libc::timespec = libc::timespec {
-    tv_sec: <libc::time_t>::max_value(),
-    tv_nsec: 1_000_000_000 - 1,
-};
+const TIMESPEC_MAX: libc::timespec =
+    libc::timespec { tv_sec: <libc::time_t>::max_value(), tv_nsec: 1_000_000_000 - 1 };
 
 fn saturating_cast_to_time_t(value: u64) -> libc::time_t {
     if value > <libc::time_t>::max_value() as u64 {
@@ -77,17 +77,14 @@ pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
             .and_then(|s| s.checked_add(now.tv_sec));
         let nsec = nsec % 1_000_000_000;
 
-        let timeout = sec.map(|s| {
-            libc::timespec { tv_sec: s, tv_nsec: nsec as _}
-        }).unwrap_or(TIMESPEC_MAX);
+        let timeout =
+            sec.map(|s| libc::timespec { tv_sec: s, tv_nsec: nsec as _ }).unwrap_or(TIMESPEC_MAX);
 
-        let r = libc::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex),
-                                            &timeout);
+        let r = libc::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex), &timeout);
         assert!(r == libc::ETIMEDOUT || r == 0);
         r == 0
     }
 
-
     #[inline]
     pub unsafe fn destroy(&self) {
         let r = libc::pthread_cond_destroy(self.inner.get());