avoid "==" in assert! when one of the values is a bool
This commit is contained in:
parent
7ded11a58c
commit
922e666820
5 changed files with 12 additions and 12 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue