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:
Steve Klabnik 2016-04-06 12:12:09 -07:00
commit 3531a1a0da
5 changed files with 12 additions and 12 deletions

View File

@ -220,7 +220,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
/// let s: &str = "Follow the rabbit"; /// let s: &str = "Follow the rabbit";
/// let ptr: *const u8 = s.as_ptr(); /// let ptr: *const u8 = s.as_ptr();
/// assert!(ptr.is_null() == false); /// assert!(!ptr.is_null());
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
@ -306,7 +306,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
/// let mut s = [1, 2, 3]; /// let mut s = [1, 2, 3];
/// let ptr: *mut u32 = s.as_mut_ptr(); /// let ptr: *mut u32 = s.as_mut_ptr();
/// assert!(ptr.is_null() == false); /// assert!(!ptr.is_null());
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]

View File

@ -1708,7 +1708,7 @@ mod tests {
let tmpdir = tmpdir(); let tmpdir = tmpdir();
let dir = &tmpdir.join("fileinfo_false_on_dir"); let dir = &tmpdir.join("fileinfo_false_on_dir");
check!(fs::create_dir(dir)); check!(fs::create_dir(dir));
assert!(dir.is_file() == false); assert!(!dir.is_file());
check!(fs::remove_dir(dir)); check!(fs::remove_dir(dir));
} }

View File

@ -1509,7 +1509,7 @@ mod tests {
assert_eq!(filtered.len(), 1); assert_eq!(filtered.len(), 1);
assert_eq!(filtered[0].desc.name.to_string(), "1"); assert_eq!(filtered[0].desc.name.to_string(), "1");
assert!(filtered[0].desc.ignore == false); assert!(!filtered[0].desc.ignore);
} }
#[test] #[test]

View File

@ -26,12 +26,12 @@ impl Foo for LocalOverride {
} }
fn test_foo() { fn test_foo() {
assert!(0i8.foo() == false); assert!(!0i8.foo());
assert!(0i32.foo() == false); assert!(!0i32.foo());
assert!(0i64.foo() == true); assert!(0i64.foo());
assert!(LocalDefault.foo() == false); assert!(!LocalDefault.foo());
assert!(LocalOverride.foo() == true); assert!(LocalOverride.foo());
} }
fn test_bar() { fn test_bar() {

View File

@ -35,9 +35,9 @@ impl Foo for i64 {
} }
fn test_foo() { fn test_foo() {
assert!(0i8.foo() == false); assert!(!0i8.foo());
assert!(0i32.foo() == false); assert!(!0i32.foo());
assert!(0i64.foo() == true); assert!(0i64.foo());
} }
// Next, test mixture of explicit `default` and provided methods: // Next, test mixture of explicit `default` and provided methods: