Skip to content

Commit 26aceab

Browse files
committed
Rollup merge of rust-lang#32761 - tshepang:assert, r=steveklabnik
avoid "==" in assert! when one of the values is a bool Is suspect this is something of an idiom
2 parents aca5a34 + 922e666 commit 26aceab

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<T: ?Sized> *const T {
220220
/// ```
221221
/// let s: &str = "Follow the rabbit";
222222
/// let ptr: *const u8 = s.as_ptr();
223-
/// assert!(ptr.is_null() == false);
223+
/// assert!(!ptr.is_null());
224224
/// ```
225225
#[stable(feature = "rust1", since = "1.0.0")]
226226
#[inline]
@@ -306,7 +306,7 @@ impl<T: ?Sized> *mut T {
306306
/// ```
307307
/// let mut s = [1, 2, 3];
308308
/// let ptr: *mut u32 = s.as_mut_ptr();
309-
/// assert!(ptr.is_null() == false);
309+
/// assert!(!ptr.is_null());
310310
/// ```
311311
#[stable(feature = "rust1", since = "1.0.0")]
312312
#[inline]

src/libstd/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ mod tests {
17081708
let tmpdir = tmpdir();
17091709
let dir = &tmpdir.join("fileinfo_false_on_dir");
17101710
check!(fs::create_dir(dir));
1711-
assert!(dir.is_file() == false);
1711+
assert!(!dir.is_file());
17121712
check!(fs::remove_dir(dir));
17131713
}
17141714

src/libtest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ mod tests {
15091509

15101510
assert_eq!(filtered.len(), 1);
15111511
assert_eq!(filtered[0].desc.name.to_string(), "1");
1512-
assert!(filtered[0].desc.ignore == false);
1512+
assert!(!filtered[0].desc.ignore);
15131513
}
15141514

15151515
#[test]

src/test/run-pass/specialization/specialization-cross-crate-defaults.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ impl Foo for LocalOverride {
2626
}
2727

2828
fn test_foo() {
29-
assert!(0i8.foo() == false);
30-
assert!(0i32.foo() == false);
31-
assert!(0i64.foo() == true);
29+
assert!(!0i8.foo());
30+
assert!(!0i32.foo());
31+
assert!(0i64.foo());
3232

33-
assert!(LocalDefault.foo() == false);
34-
assert!(LocalOverride.foo() == true);
33+
assert!(!LocalDefault.foo());
34+
assert!(LocalOverride.foo());
3535
}
3636

3737
fn test_bar() {

src/test/run-pass/specialization/specialization-default-methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ impl Foo for i64 {
3535
}
3636

3737
fn test_foo() {
38-
assert!(0i8.foo() == false);
39-
assert!(0i32.foo() == false);
40-
assert!(0i64.foo() == true);
38+
assert!(!0i8.foo());
39+
assert!(!0i32.foo());
40+
assert!(0i64.foo());
4141
}
4242

4343
// Next, test mixture of explicit `default` and provided methods:

0 commit comments

Comments
 (0)