clean unsafe op in unsafe fn · model-checking/verify-rust-std@b597017 (original) (raw)

`@@ -76,24 +76,24 @@ impl Condvar {

`

76

76

``

77

77

`#[inline]

`

78

78

`pub unsafe fn wait(&self, mutex: &Mutex) {

`

79

``

`-

let mutex = mutex::raw(mutex);

`

``

79

`+

let mutex = unsafe { mutex::raw(mutex) };

`

80

80

`self.verify(mutex);

`

81

``

`-

let r = libc::pthread_cond_wait(raw(self), mutex);

`

``

81

`+

let r = unsafe { libc::pthread_cond_wait(raw(self), mutex) };

`

82

82

`debug_assert_eq!(r, 0);

`

83

83

`}

`

84

84

``

85

85

`pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {

`

86

86

`use crate::sys::time::Timespec;

`

87

87

``

88

``

`-

let mutex = mutex::raw(mutex);

`

``

88

`+

let mutex = unsafe { mutex::raw(mutex) };

`

89

89

`self.verify(mutex);

`

90

90

``

91

91

`let timeout = Timespec::now(libc::CLOCK_MONOTONIC)

`

92

92

`.checked_add_duration(&dur)

`

93

93

`.and_then(|t| t.to_timespec())

`

94

94

`.unwrap_or(TIMESPEC_MAX);

`

95

95

``

96

``

`-

let r = pthread_cond_timedwait(raw(self), mutex, &timeout);

`

``

96

`+

let r = unsafe { pthread_cond_timedwait(raw(self), mutex, &timeout) };

`

97

97

`assert!(r == libc::ETIMEDOUT || r == 0);

`

98

98

` r == 0

`

99

99

`}

`