mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
Rollup merge of #32761 - tshepang:assert, r=steveklabnik
avoid "==" in assert! when one of the values is a bool Is suspect this is something of an idiom
This commit is contained in:
commit
3531a1a0da
@ -220,7 +220,7 @@ impl<T: ?Sized> *const T {
|
||||
/// ```
|
||||
/// let s: &str = "Follow the rabbit";
|
||||
/// let ptr: *const u8 = s.as_ptr();
|
||||
/// assert!(ptr.is_null() == false);
|
||||
/// assert!(!ptr.is_null());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
@ -306,7 +306,7 @@ impl<T: ?Sized> *mut T {
|
||||
/// ```
|
||||
/// let mut s = [1, 2, 3];
|
||||
/// let ptr: *mut u32 = s.as_mut_ptr();
|
||||
/// assert!(ptr.is_null() == false);
|
||||
/// assert!(!ptr.is_null());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
|
@ -1708,7 +1708,7 @@ mod tests {
|
||||
let tmpdir = tmpdir();
|
||||
let dir = &tmpdir.join("fileinfo_false_on_dir");
|
||||
check!(fs::create_dir(dir));
|
||||
assert!(dir.is_file() == false);
|
||||
assert!(!dir.is_file());
|
||||
check!(fs::remove_dir(dir));
|
||||
}
|
||||
|
||||
|
@ -1509,7 +1509,7 @@ mod tests {
|
||||
|
||||
assert_eq!(filtered.len(), 1);
|
||||
assert_eq!(filtered[0].desc.name.to_string(), "1");
|
||||
assert!(filtered[0].desc.ignore == false);
|
||||
assert!(!filtered[0].desc.ignore);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -26,12 +26,12 @@ impl Foo for LocalOverride {
|
||||
}
|
||||
|
||||
fn test_foo() {
|
||||
assert!(0i8.foo() == false);
|
||||
assert!(0i32.foo() == false);
|
||||
assert!(0i64.foo() == true);
|
||||
assert!(!0i8.foo());
|
||||
assert!(!0i32.foo());
|
||||
assert!(0i64.foo());
|
||||
|
||||
assert!(LocalDefault.foo() == false);
|
||||
assert!(LocalOverride.foo() == true);
|
||||
assert!(!LocalDefault.foo());
|
||||
assert!(LocalOverride.foo());
|
||||
}
|
||||
|
||||
fn test_bar() {
|
||||
|
@ -35,9 +35,9 @@ impl Foo for i64 {
|
||||
}
|
||||
|
||||
fn test_foo() {
|
||||
assert!(0i8.foo() == false);
|
||||
assert!(0i32.foo() == false);
|
||||
assert!(0i64.foo() == true);
|
||||
assert!(!0i8.foo());
|
||||
assert!(!0i32.foo());
|
||||
assert!(0i64.foo());
|
||||
}
|
||||
|
||||
// Next, test mixture of explicit `default` and provided methods:
|
||||
|
Loading…
Reference in New Issue
Block a user