Skip to content

Commit f8dabd6

Browse files
remove unecessary assert, and improve others
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent 028f141 commit f8dabd6

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

library/std/src/sys/unix/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl Iterator for ReadDir {
636636
impl Drop for Dir {
637637
fn drop(&mut self) {
638638
let r = unsafe { libc::closedir(self.0) };
639-
assert_eq!(r, 0, "unexpected error during closedir: {:?}", r);
639+
assert!(r == 0 || r == libc::EINTR, "unexpected error during closedir: {:?}", r);
640640
}
641641
}
642642

library/std/src/sys/unix/locks/pthread_condvar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl Condvar {
186186
let r = libc::pthread_cond_timedwait(self.inner.get(), pthread_mutex::raw(mutex), &timeout);
187187
assert!(
188188
r == libc::ETIMEDOUT || r == 0,
189-
"unexpected error during pthread_conf_timedwait: {:?}",
189+
"unexpected error during pthread_cond_timedwait: {:?}",
190190
r
191191
);
192192

library/std/src/sys/unix/locks/pthread_rwlock.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ impl RwLock {
110110
}
111111
panic!("rwlock write lock would result in deadlock");
112112
} else {
113-
// According to POSIX, for a properly initialized rwlock this can only
114-
// return EDEADLK or 0. We rely on that.
115113
assert_eq!(r, 0, "unexpected error during pthread_rwlock_wrlock: {:?}", r);
116114
}
117115
*self.write_locked.get() = true;

library/std/src/sys/unix/thread.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ impl Thread {
112112
}
113113

114114
pub fn yield_now() {
115-
let ret = unsafe { libc::sched_yield() };
116-
assert_eq!(ret, 0, "unexpected error during sched_yield: {:?}", ret);
115+
let _ = unsafe { libc::sched_yield() };
117116
}
118117

119118
#[cfg(any(target_os = "linux", target_os = "android"))]

0 commit comments

Comments
 (0)