From 3815ed63ed0e1bfa2026e9a54b64a69e16f123ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 23 Jan 2025 18:40:41 +0000 Subject: [PATCH] Remove some unnecessary parens in `assert!` conditions While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter. --- library/alloc/tests/str.rs | 22 +++++++------- library/coretests/tests/bool.rs | 8 ++--- library/coretests/tests/ptr.rs | 6 ++-- library/std/tests/istr.rs | 4 +-- library/std/tests/seq-compare.rs | 22 +++++++------- src/tools/miri/tests/pass/binops.rs | 30 +++++++++---------- tests/ui/binding/expr-match-generic.rs | 2 +- tests/ui/binding/expr-match.rs | 13 ++++---- tests/ui/binop/binops.rs | 30 +++++++++---------- tests/ui/binop/structured-compare.rs | 14 ++++----- tests/ui/cfg/conditional-compile.rs | 2 +- tests/ui/expr/block.rs | 2 +- tests/ui/expr/if/expr-if.rs | 18 +++++------ tests/ui/for-loop-while/break.rs | 8 ++--- tests/ui/for-loop-while/while-cont.rs | 2 +- .../while-loop-constraints-2.rs | 2 +- tests/ui/generics/generic-tag-match.rs | 2 +- tests/ui/iterators/iter-range.rs | 2 +- .../macros/syntax-extension-source-utils.rs | 4 +-- tests/ui/numbers-arithmetic/arith-unsigned.rs | 24 +++++++-------- tests/ui/numbers-arithmetic/float-nan.rs | 2 +- tests/ui/numbers-arithmetic/float2.rs | 10 +++---- tests/ui/numbers-arithmetic/floatlits.rs | 8 ++--- .../class-impl-very-parameterized-trait.rs | 2 +- .../class-implement-trait-cross-crate.rs | 4 +-- .../structs-enums/class-implement-traits.rs | 2 +- tests/ui/structs-enums/classes-cross-crate.rs | 4 +-- tests/ui/structs-enums/classes.rs | 4 +-- tests/ui/structs-enums/tag.rs | 2 +- tests/ui/tail-cps.rs | 2 +- tests/ui/weird-exprs.rs | 6 ++-- 31 files changed, 130 insertions(+), 133 deletions(-) diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs index 6f930ab08535c..5720d3ffd97b6 100644 --- a/library/alloc/tests/str.rs +++ b/library/alloc/tests/str.rs @@ -2297,21 +2297,21 @@ fn utf8_chars() { assert_eq!(schs.len(), 4); assert_eq!(schs.iter().cloned().collect::(), s); - assert!((from_utf8(s.as_bytes()).is_ok())); + assert!(from_utf8(s.as_bytes()).is_ok()); // invalid prefix - assert!((!from_utf8(&[0x80]).is_ok())); + assert!(!from_utf8(&[0x80]).is_ok()); // invalid 2 byte prefix - assert!((!from_utf8(&[0xc0]).is_ok())); - assert!((!from_utf8(&[0xc0, 0x10]).is_ok())); + assert!(!from_utf8(&[0xc0]).is_ok()); + assert!(!from_utf8(&[0xc0, 0x10]).is_ok()); // invalid 3 byte prefix - assert!((!from_utf8(&[0xe0]).is_ok())); - assert!((!from_utf8(&[0xe0, 0x10]).is_ok())); - assert!((!from_utf8(&[0xe0, 0xff, 0x10]).is_ok())); + assert!(!from_utf8(&[0xe0]).is_ok()); + assert!(!from_utf8(&[0xe0, 0x10]).is_ok()); + assert!(!from_utf8(&[0xe0, 0xff, 0x10]).is_ok()); // invalid 4 byte prefix - assert!((!from_utf8(&[0xf0]).is_ok())); - assert!((!from_utf8(&[0xf0, 0x10]).is_ok())); - assert!((!from_utf8(&[0xf0, 0xff, 0x10]).is_ok())); - assert!((!from_utf8(&[0xf0, 0xff, 0xff, 0x10]).is_ok())); + assert!(!from_utf8(&[0xf0]).is_ok()); + assert!(!from_utf8(&[0xf0, 0x10]).is_ok()); + assert!(!from_utf8(&[0xf0, 0xff, 0x10]).is_ok()); + assert!(!from_utf8(&[0xf0, 0xff, 0xff, 0x10]).is_ok()); } #[test] diff --git a/library/coretests/tests/bool.rs b/library/coretests/tests/bool.rs index 47f6459915b3e..bcd6dc2abac6c 100644 --- a/library/coretests/tests/bool.rs +++ b/library/coretests/tests/bool.rs @@ -71,14 +71,14 @@ fn test_bool() { #[test] pub fn test_bool_not() { if !false { - assert!((true)); + assert!(true); } else { - assert!((false)); + assert!(false); } if !true { - assert!((false)); + assert!(false); } else { - assert!((true)); + assert!(true); } } diff --git a/library/coretests/tests/ptr.rs b/library/coretests/tests/ptr.rs index 7cefb615d0371..345bec345d128 100644 --- a/library/coretests/tests/ptr.rs +++ b/library/coretests/tests/ptr.rs @@ -42,11 +42,11 @@ fn test() { let mut v1 = vec![0u16, 0u16, 0u16]; copy(v0.as_ptr().offset(1), v1.as_mut_ptr().offset(1), 1); - assert!((v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16)); + assert!(v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16); copy(v0.as_ptr().offset(2), v1.as_mut_ptr(), 1); - assert!((v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16)); + assert!(v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16); copy(v0.as_ptr(), v1.as_mut_ptr().offset(2), 1); - assert!((v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16)); + assert!(v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16); } } diff --git a/library/std/tests/istr.rs b/library/std/tests/istr.rs index 9a127ae803e77..e481872977abf 100644 --- a/library/std/tests/istr.rs +++ b/library/std/tests/istr.rs @@ -5,7 +5,7 @@ fn test_stack_assign() { let t: String = "a".to_string(); assert_eq!(s, t); let u: String = "b".to_string(); - assert!((s != u)); + assert!(s != u); } #[test] @@ -19,7 +19,7 @@ fn test_heap_assign() { let t: String = "a big ol' string".to_string(); assert_eq!(s, t); let u: String = "a bad ol' string".to_string(); - assert!((s != u)); + assert!(s != u); } #[test] diff --git a/library/std/tests/seq-compare.rs b/library/std/tests/seq-compare.rs index 221f1c7cabde5..ec39c5b603ccc 100644 --- a/library/std/tests/seq-compare.rs +++ b/library/std/tests/seq-compare.rs @@ -1,15 +1,15 @@ #[test] fn seq_compare() { - assert!(("hello".to_string() < "hellr".to_string())); - assert!(("hello ".to_string() > "hello".to_string())); - assert!(("hello".to_string() != "there".to_string())); - assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); - assert!((vec![1, 2, 3] < vec![1, 2, 3, 4])); - assert!((vec![1, 2, 4, 4] > vec![1, 2, 3, 4])); - assert!((vec![1, 2, 3, 4] < vec![1, 2, 4, 4])); - assert!((vec![1, 2, 3] <= vec![1, 2, 3])); - assert!((vec![1, 2, 3] <= vec![1, 2, 3, 3])); - assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); + assert!("hello".to_string() < "hellr".to_string()); + assert!("hello ".to_string() > "hello".to_string()); + assert!("hello".to_string() != "there".to_string()); + assert!(vec![1, 2, 3, 4] > vec![1, 2, 3]); + assert!(vec![1, 2, 3] < vec![1, 2, 3, 4]); + assert!(vec![1, 2, 4, 4] > vec![1, 2, 3, 4]); + assert!(vec![1, 2, 3, 4] < vec![1, 2, 4, 4]); + assert!(vec![1, 2, 3] <= vec![1, 2, 3]); + assert!(vec![1, 2, 3] <= vec![1, 2, 3, 3]); + assert!(vec![1, 2, 3, 4] > vec![1, 2, 3]); assert_eq!(vec![1, 2, 3], vec![1, 2, 3]); - assert!((vec![1, 2, 3] != vec![1, 1, 3])); + assert!(vec![1, 2, 3] != vec![1, 1, 3]); } diff --git a/src/tools/miri/tests/pass/binops.rs b/src/tools/miri/tests/pass/binops.rs index 0988d7ccc4c6e..0aff7acb29d44 100644 --- a/src/tools/miri/tests/pass/binops.rs +++ b/src/tools/miri/tests/pass/binops.rs @@ -2,23 +2,23 @@ fn test_nil() { assert_eq!((), ()); - assert!((!(() != ()))); - assert!((!(() < ()))); - assert!((() <= ())); - assert!((!(() > ()))); - assert!((() >= ())); + assert!(!(() != ())); + assert!(!(() < ())); + assert!(() <= ()); + assert!(!(() > ())); + assert!(() >= ()); } fn test_bool() { - assert!((!(true < false))); - assert!((!(true <= false))); - assert!((true > false)); - assert!((true >= false)); + assert!(!(true < false)); + assert!(!(true <= false)); + assert!(true > false); + assert!(true >= false); - assert!((false < true)); - assert!((false <= true)); - assert!((!(false > true))); - assert!((!(false >= true))); + assert!(false < true); + assert!(false <= true); + assert!(!(false > true)); + assert!(!(false >= true)); // Bools support bitwise binops assert_eq!(false & false, false); @@ -65,9 +65,9 @@ fn test_class() { assert_eq!(q, r); r.y = 17; - assert!((r.y != q.y)); + assert!(r.y != q.y); assert_eq!(r.y, 17); - assert!((q != r)); + assert!(q != r); } pub fn main() { diff --git a/tests/ui/binding/expr-match-generic.rs b/tests/ui/binding/expr-match-generic.rs index 975eec42fd054..dcc069b9fb329 100644 --- a/tests/ui/binding/expr-match-generic.rs +++ b/tests/ui/binding/expr-match-generic.rs @@ -5,7 +5,7 @@ type compare = extern "Rust" fn(T, T) -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => { expected.clone() }, _ => panic!("wat") }; - assert!((eq(expected, actual))); + assert!(eq(expected, actual)); } fn test_bool() { diff --git a/tests/ui/binding/expr-match.rs b/tests/ui/binding/expr-match.rs index 049beaaf51bf6..ce502ae149033 100644 --- a/tests/ui/binding/expr-match.rs +++ b/tests/ui/binding/expr-match.rs @@ -1,20 +1,17 @@ //@ run-pass - - - // Tests for using match as an expression fn test_basic() { let mut rs: bool = match true { true => { true } false => { false } }; - assert!((rs)); + assert!(rs); rs = match false { true => { false } false => { true } }; - assert!((rs)); + assert!(rs); } fn test_inferrence() { let rs = match true { true => { true } false => { false } }; - assert!((rs)); + assert!(rs); } fn test_alt_as_alt_head() { @@ -25,7 +22,7 @@ fn test_alt_as_alt_head() { true => { false } false => { true } }; - assert!((rs)); + assert!(rs); } fn test_alt_as_block_result() { @@ -34,7 +31,7 @@ fn test_alt_as_block_result() { true => { false } false => { match true { true => { true } false => { false } } } }; - assert!((rs)); + assert!(rs); } pub fn main() { diff --git a/tests/ui/binop/binops.rs b/tests/ui/binop/binops.rs index 0adbb49b14a37..7142190a45b9a 100644 --- a/tests/ui/binop/binops.rs +++ b/tests/ui/binop/binops.rs @@ -5,23 +5,23 @@ fn test_nil() { assert_eq!((), ()); - assert!((!(() != ()))); - assert!((!(() < ()))); - assert!((() <= ())); - assert!((!(() > ()))); - assert!((() >= ())); + assert!(!(() != ())); + assert!(!(() < ())); + assert!(() <= ()); + assert!(!(() > ())); + assert!(() >= ()); } fn test_bool() { - assert!((!(true < false))); - assert!((!(true <= false))); - assert!((true > false)); - assert!((true >= false)); + assert!(!(true < false)); + assert!(!(true <= false)); + assert!(true > false); + assert!(true >= false); - assert!((false < true)); - assert!((false <= true)); - assert!((!(false > true))); - assert!((!(false >= true))); + assert!(false < true); + assert!(false <= true); + assert!(!(false > true)); + assert!(!(false >= true)); // Bools support bitwise binops assert_eq!(false & false, false); @@ -76,9 +76,9 @@ fn test_class() { } assert_eq!(q, r); r.y = 17; - assert!((r.y != q.y)); + assert!(r.y != q.y); assert_eq!(r.y, 17); - assert!((q != r)); + assert!(q != r); } pub fn main() { diff --git a/tests/ui/binop/structured-compare.rs b/tests/ui/binop/structured-compare.rs index 164760cd7a040..7d1eff453028a 100644 --- a/tests/ui/binop/structured-compare.rs +++ b/tests/ui/binop/structured-compare.rs @@ -17,14 +17,14 @@ pub fn main() { let a = (1, 2, 3); let b = (1, 2, 3); assert_eq!(a, b); - assert!((a != (1, 2, 4))); - assert!((a < (1, 2, 4))); - assert!((a <= (1, 2, 4))); - assert!(((1, 2, 4) > a)); - assert!(((1, 2, 4) >= a)); + assert!(a != (1, 2, 4)); + assert!(a < (1, 2, 4)); + assert!(a <= (1, 2, 4)); + assert!((1, 2, 4) > a); + assert!((1, 2, 4) >= a); let x = foo::large; let y = foo::small; - assert!((x != y)); + assert!(x != y); assert_eq!(x, foo::large); - assert!((x != foo::small)); + assert!(x != foo::small); } diff --git a/tests/ui/cfg/conditional-compile.rs b/tests/ui/cfg/conditional-compile.rs index a4f334dd696ab..dff280054d659 100644 --- a/tests/ui/cfg/conditional-compile.rs +++ b/tests/ui/cfg/conditional-compile.rs @@ -85,7 +85,7 @@ pub fn main() { pub fn main() { // Exercise some of the configured items in ways that wouldn't be possible // if they had the FALSE definition - assert!((b)); + assert!(b); let _x: t = true; let _y: tg = tg::bar; diff --git a/tests/ui/expr/block.rs b/tests/ui/expr/block.rs index bf626c9ead372..70f5c274c214d 100644 --- a/tests/ui/expr/block.rs +++ b/tests/ui/expr/block.rs @@ -4,7 +4,7 @@ // Tests for standalone blocks as expressions -fn test_basic() { let rs: bool = { true }; assert!((rs)); } +fn test_basic() { let rs: bool = { true }; assert!(rs); } struct RS { v1: isize, v2: isize } diff --git a/tests/ui/expr/if/expr-if.rs b/tests/ui/expr/if/expr-if.rs index ae869c4b77a38..68c2fc2213015 100644 --- a/tests/ui/expr/if/expr-if.rs +++ b/tests/ui/expr/if/expr-if.rs @@ -1,43 +1,43 @@ //@ run-pass // Tests for if as expressions -fn test_if() { let rs: bool = if true { true } else { false }; assert!((rs)); } +fn test_if() { let rs: bool = if true { true } else { false }; assert!(rs); } fn test_else() { let rs: bool = if false { false } else { true }; - assert!((rs)); + assert!(rs); } fn test_elseif1() { let rs: bool = if true { true } else if true { false } else { false }; - assert!((rs)); + assert!(rs); } fn test_elseif2() { let rs: bool = if false { false } else if true { true } else { false }; - assert!((rs)); + assert!(rs); } fn test_elseif3() { let rs: bool = if false { false } else if false { false } else { true }; - assert!((rs)); + assert!(rs); } fn test_inferrence() { let rs = if true { true } else { false }; - assert!((rs)); + assert!(rs); } fn test_if_as_if_condition() { let rs1 = if if false { false } else { true } { true } else { false }; - assert!((rs1)); + assert!(rs1); let rs2 = if if true { false } else { true } { false } else { true }; - assert!((rs2)); + assert!(rs2); } fn test_if_as_block_result() { let rs = if true { if false { false } else { true } } else { false }; - assert!((rs)); + assert!(rs); } pub fn main() { diff --git a/tests/ui/for-loop-while/break.rs b/tests/ui/for-loop-while/break.rs index 77774792262cd..442e07e148c57 100644 --- a/tests/ui/for-loop-while/break.rs +++ b/tests/ui/for-loop-while/break.rs @@ -8,18 +8,18 @@ pub fn main() { assert_eq!(i, 20); let xs = [1, 2, 3, 4, 5, 6]; for x in &xs { - if *x == 3 { break; } assert!((*x <= 3)); + if *x == 3 { break; } assert!(*x <= 3); } i = 0; - while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); } + while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!(i % 2 != 0); } i = 0; loop { - i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); + i += 1; if i % 2 == 0 { continue; } assert!(i % 2 != 0); if i >= 10 { break; } } let ys = vec![1, 2, 3, 4, 5, 6]; for x in &ys { if *x % 2 == 0 { continue; } - assert!((*x % 2 != 0)); + assert!(*x % 2 != 0); } } diff --git a/tests/ui/for-loop-while/while-cont.rs b/tests/ui/for-loop-while/while-cont.rs index 1640b7e1803bd..73a08c26f9af6 100644 --- a/tests/ui/for-loop-while/while-cont.rs +++ b/tests/ui/for-loop-while/while-cont.rs @@ -3,7 +3,7 @@ pub fn main() { let mut i = 1; while i > 0 { - assert!((i > 0)); + assert!(i > 0); println!("{}", i); i -= 1; continue; diff --git a/tests/ui/for-loop-while/while-loop-constraints-2.rs b/tests/ui/for-loop-while/while-loop-constraints-2.rs index 654f6769902bd..1d2d9c2ecfe60 100644 --- a/tests/ui/for-loop-while/while-loop-constraints-2.rs +++ b/tests/ui/for-loop-while/while-loop-constraints-2.rs @@ -11,5 +11,5 @@ pub fn main() { while false { x = y; y = z; } println!("{}", y); } - assert!((y == 42 && z == 50)); + assert!(y == 42 && z == 50); } diff --git a/tests/ui/generics/generic-tag-match.rs b/tests/ui/generics/generic-tag-match.rs index dd0291e9d8736..378b51df287b3 100644 --- a/tests/ui/generics/generic-tag-match.rs +++ b/tests/ui/generics/generic-tag-match.rs @@ -7,7 +7,7 @@ enum foo { arm(T), } fn altfoo(f: foo) { let mut hit = false; match f { foo::arm::(_x) => { println!("in arm"); hit = true; } } - assert!((hit)); + assert!(hit); } pub fn main() { altfoo::(foo::arm::(10)); } diff --git a/tests/ui/iterators/iter-range.rs b/tests/ui/iterators/iter-range.rs index 9594729c06cf0..ec99331753989 100644 --- a/tests/ui/iterators/iter-range.rs +++ b/tests/ui/iterators/iter-range.rs @@ -2,7 +2,7 @@ fn range_(a: isize, b: isize, mut it: F) where F: FnMut(isize) { - assert!((a < b)); + assert!(a < b); let mut i: isize = a; while i < b { it(i); i += 1; } } diff --git a/tests/ui/macros/syntax-extension-source-utils.rs b/tests/ui/macros/syntax-extension-source-utils.rs index a16ebdc750424..2f88e508058c1 100644 --- a/tests/ui/macros/syntax-extension-source-utils.rs +++ b/tests/ui/macros/syntax-extension-source-utils.rs @@ -16,7 +16,7 @@ pub fn main() { assert_eq!(line!(), 16); assert_eq!(column!(), 16); assert_eq!(indirect_line!(), 18); - assert!((file!().ends_with("syntax-extension-source-utils.rs"))); + assert!(file!().ends_with("syntax-extension-source-utils.rs")); assert_eq!(stringify!((2*3) + 5).to_string(), "(2*3) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ fragment").to_string() @@ -30,7 +30,7 @@ pub fn main() { include_bytes!("syntax-extension-source-utils-files/includeme.fragment") [1] == (42 as u8)); // '*' // The Windows tests are wrapped in an extra module for some reason - assert!((m1::m2::where_am_i().ends_with("m1::m2"))); + assert!(m1::m2::where_am_i().ends_with("m1::m2")); assert_eq!((35, "(2*3) + 5"), (line!(), stringify!((2*3) + 5))); } diff --git a/tests/ui/numbers-arithmetic/arith-unsigned.rs b/tests/ui/numbers-arithmetic/arith-unsigned.rs index 5a285ceca32db..4a1bae438ca2e 100644 --- a/tests/ui/numbers-arithmetic/arith-unsigned.rs +++ b/tests/ui/numbers-arithmetic/arith-unsigned.rs @@ -3,22 +3,22 @@ // Unsigned integer operations pub fn main() { - assert!((0u8 < 255u8)); - assert!((0u8 <= 255u8)); - assert!((255u8 > 0u8)); - assert!((255u8 >= 0u8)); + assert!(0u8 < 255u8); + assert!(0u8 <= 255u8); + assert!(255u8 > 0u8); + assert!(255u8 >= 0u8); assert_eq!(250u8 / 10u8, 25u8); assert_eq!(255u8 % 10u8, 5u8); - assert!((0u16 < 60000u16)); - assert!((0u16 <= 60000u16)); - assert!((60000u16 > 0u16)); - assert!((60000u16 >= 0u16)); + assert!(0u16 < 60000u16); + assert!(0u16 <= 60000u16); + assert!(60000u16 > 0u16); + assert!(60000u16 >= 0u16); assert_eq!(60000u16 / 10u16, 6000u16); assert_eq!(60005u16 % 10u16, 5u16); - assert!((0u32 < 4000000000u32)); - assert!((0u32 <= 4000000000u32)); - assert!((4000000000u32 > 0u32)); - assert!((4000000000u32 >= 0u32)); + assert!(0u32 < 4000000000u32); + assert!(0u32 <= 4000000000u32); + assert!(4000000000u32 > 0u32); + assert!(4000000000u32 >= 0u32); assert_eq!(4000000000u32 / 10u32, 400000000u32); assert_eq!(4000000005u32 % 10u32, 5u32); // 64-bit numbers have some flakiness yet. Not tested diff --git a/tests/ui/numbers-arithmetic/float-nan.rs b/tests/ui/numbers-arithmetic/float-nan.rs index 7d1af0155da53..ee3718f6f939b 100644 --- a/tests/ui/numbers-arithmetic/float-nan.rs +++ b/tests/ui/numbers-arithmetic/float-nan.rs @@ -2,7 +2,7 @@ pub fn main() { let nan: f64 = f64::NAN; - assert!((nan).is_nan()); + assert!(nan.is_nan()); let inf: f64 = f64::INFINITY; let neg_inf: f64 = -f64::INFINITY; diff --git a/tests/ui/numbers-arithmetic/float2.rs b/tests/ui/numbers-arithmetic/float2.rs index 1b7add01cc631..515220fee9ffe 100644 --- a/tests/ui/numbers-arithmetic/float2.rs +++ b/tests/ui/numbers-arithmetic/float2.rs @@ -15,12 +15,12 @@ pub fn main() { let j = 3.1e+9f64; let k = 3.2e-10f64; assert_eq!(a, b); - assert!((c < b)); + assert!(c < b); assert_eq!(c, d); - assert!((e < g)); - assert!((f < h)); + assert!(e < g); + assert!(f < h); assert_eq!(g, 1000000.0f32); assert_eq!(h, i); - assert!((j > k)); - assert!((k < a)); + assert!(j > k); + assert!(k < a); } diff --git a/tests/ui/numbers-arithmetic/floatlits.rs b/tests/ui/numbers-arithmetic/floatlits.rs index 21f19b69c49e7..2dab224201193 100644 --- a/tests/ui/numbers-arithmetic/floatlits.rs +++ b/tests/ui/numbers-arithmetic/floatlits.rs @@ -4,9 +4,9 @@ pub fn main() { let f = 4.999999999999f64; - assert!((f > 4.90f64)); - assert!((f < 5.0f64)); + assert!(f > 4.90f64); + assert!(f < 5.0f64); let g = 4.90000000001e-10f64; - assert!((g > 5e-11f64)); - assert!((g < 5e-9f64)); + assert!(g > 5e-11f64); + assert!(g < 5e-9f64); } diff --git a/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs b/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs index 0b37192fc3b34..6caec1e2034ef 100644 --- a/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs +++ b/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs @@ -102,6 +102,6 @@ pub fn main() { let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); for _ in 0_usize..6 { spotty.speak(); } assert_eq!(spotty.len(), 8); - assert!((spotty.contains_key(&2))); + assert!(spotty.contains_key(&2)); assert_eq!(spotty.get(&3), &cat_type::tuxedo); } diff --git a/tests/ui/structs-enums/class-implement-trait-cross-crate.rs b/tests/ui/structs-enums/class-implement-trait-cross-crate.rs index 7a5969451cb52..781ac6ad10d2c 100644 --- a/tests/ui/structs-enums/class-implement-trait-cross-crate.rs +++ b/tests/ui/structs-enums/class-implement-trait-cross-crate.rs @@ -53,7 +53,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/class-implement-traits.rs b/tests/ui/structs-enums/class-implement-traits.rs index 04a7b706edbce..3a514ff9d7581 100644 --- a/tests/ui/structs-enums/class-implement-traits.rs +++ b/tests/ui/structs-enums/class-implement-traits.rs @@ -57,7 +57,7 @@ fn make_speak(mut c: C) { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { make_speak(nyan.clone()); } diff --git a/tests/ui/structs-enums/classes-cross-crate.rs b/tests/ui/structs-enums/classes-cross-crate.rs index 0160d3fd85c08..6fb5f2e3cc9d7 100644 --- a/tests/ui/structs-enums/classes-cross-crate.rs +++ b/tests/ui/structs-enums/classes-cross-crate.rs @@ -7,7 +7,7 @@ use cci_class_4::kitties::cat; pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/classes.rs b/tests/ui/structs-enums/classes.rs index d1c1922f4b547..05976f6a759af 100644 --- a/tests/ui/structs-enums/classes.rs +++ b/tests/ui/structs-enums/classes.rs @@ -45,7 +45,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/tag.rs b/tests/ui/structs-enums/tag.rs index 16e6b2341cf61..542b517e66db7 100644 --- a/tests/ui/structs-enums/tag.rs +++ b/tests/ui/structs-enums/tag.rs @@ -25,6 +25,6 @@ impl PartialEq for colour { fn ne(&self, other: &colour) -> bool { !(*self).eq(other) } } -fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); } +fn f() { let x = colour::red(1, 2); let y = colour::green; assert!(x != y); } pub fn main() { f(); } diff --git a/tests/ui/tail-cps.rs b/tests/ui/tail-cps.rs index 6305e9ecdbcf1..fe99dadf7951c 100644 --- a/tests/ui/tail-cps.rs +++ b/tests/ui/tail-cps.rs @@ -1,6 +1,6 @@ //@ run-pass -fn checktrue(rs: bool) -> bool { assert!((rs)); return true; } +fn checktrue(rs: bool) -> bool { assert!(rs); return true; } pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs index 08b5517aae22f..55a8d580a8b7b 100644 --- a/tests/ui/weird-exprs.rs +++ b/tests/ui/weird-exprs.rs @@ -34,7 +34,7 @@ fn what() { let i = &Cell::new(false); let dont = {||the(i)}; dont(); - assert!((i.get())); + assert!(i.get()); } fn zombiejesus() { @@ -69,8 +69,8 @@ fn notsure() { fn canttouchthis() -> usize { fn p() -> bool { true } - let _a = (assert!((true)) == (assert!(p()))); - let _c = (assert!((p())) == ()); + let _a = (assert!(true) == (assert!(p()))); + let _c = (assert!(p()) == ()); let _b: bool = (println!("{}", 0) == (return 0)); }