diff --git a/tests/ui/absurd-extreme-comparisons.stderr b/tests/ui/absurd-extreme-comparisons.stderr index 6c32b309aa5..895794da71a 100644 --- a/tests/ui/absurd-extreme-comparisons.stderr +++ b/tests/ui/absurd-extreme-comparisons.stderr @@ -1,144 +1,144 @@ error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:20:5 + --> $DIR/absurd-extreme-comparisons.rs:17:5 | -20 | u <= 0; +17 | u <= 0; | ^^^^^^ | = note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings` = help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:21:5 + --> $DIR/absurd-extreme-comparisons.rs:18:5 | -21 | u <= Z; +18 | u <= Z; | ^^^^^^ | = help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:22:5 + --> $DIR/absurd-extreme-comparisons.rs:19:5 | -22 | u < Z; +19 | u < Z; | ^^^^^ | = help: because Z is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:23:5 + --> $DIR/absurd-extreme-comparisons.rs:20:5 | -23 | Z >= u; +20 | Z >= u; | ^^^^^^ | = help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:24:5 + --> $DIR/absurd-extreme-comparisons.rs:21:5 | -24 | Z > u; +21 | Z > u; | ^^^^^ | = help: because Z is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:25:5 + --> $DIR/absurd-extreme-comparisons.rs:22:5 | -25 | u > std::u32::MAX; +22 | u > std::u32::MAX; | ^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:26:5 + --> $DIR/absurd-extreme-comparisons.rs:23:5 | -26 | u >= std::u32::MAX; +23 | u >= std::u32::MAX; | ^^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:27:5 + --> $DIR/absurd-extreme-comparisons.rs:24:5 | -27 | std::u32::MAX < u; +24 | std::u32::MAX < u; | ^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:28:5 + --> $DIR/absurd-extreme-comparisons.rs:25:5 | -28 | std::u32::MAX <= u; +25 | std::u32::MAX <= u; | ^^^^^^^^^^^^^^^^^^ | = help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:29:5 + --> $DIR/absurd-extreme-comparisons.rs:26:5 | -29 | 1-1 > u; +26 | 1-1 > u; | ^^^^^^^ | = help: because 1-1 is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:30:5 + --> $DIR/absurd-extreme-comparisons.rs:27:5 | -30 | u >= !0; +27 | u >= !0; | ^^^^^^^ | = help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:31:5 + --> $DIR/absurd-extreme-comparisons.rs:28:5 | -31 | u <= 12 - 2*6; +28 | u <= 12 - 2*6; | ^^^^^^^^^^^^^ | = help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:33:5 + --> $DIR/absurd-extreme-comparisons.rs:30:5 | -33 | i < -127 - 1; +30 | i < -127 - 1; | ^^^^^^^^^^^^ | = help: because -127 - 1 is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:34:5 + --> $DIR/absurd-extreme-comparisons.rs:31:5 | -34 | std::i8::MAX >= i; +31 | std::i8::MAX >= i; | ^^^^^^^^^^^^^^^^^ | = help: because std::i8::MAX is the maximum value for this type, this comparison is always true error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:35:5 + --> $DIR/absurd-extreme-comparisons.rs:32:5 | -35 | 3-7 < std::i32::MIN; +32 | 3-7 < std::i32::MIN; | ^^^^^^^^^^^^^^^^^^^ | = help: because std::i32::MIN is the minimum value for this type, this comparison is always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:37:5 + --> $DIR/absurd-extreme-comparisons.rs:34:5 | -37 | b >= true; +34 | b >= true; | ^^^^^^^^^ | = help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false - --> $DIR/absurd-extreme-comparisons.rs:38:5 + --> $DIR/absurd-extreme-comparisons.rs:35:5 | -38 | false > b; +35 | false > b; | ^^^^^^^^^ | = help: because false is the minimum value for this type, this comparison is always false error: <-comparison of unit values detected. This will always be false - --> $DIR/absurd-extreme-comparisons.rs:41:5 + --> $DIR/absurd-extreme-comparisons.rs:38:5 | -41 | () < {}; +38 | () < {}; | ^^^^^^^ | = note: #[deny(clippy::unit_cmp)] on by default diff --git a/tests/ui/arithmetic.stderr b/tests/ui/arithmetic.stderr index 5e6021403e9..f3a1db16b48 100644 --- a/tests/ui/arithmetic.stderr +++ b/tests/ui/arithmetic.stderr @@ -1,72 +1,72 @@ error: integer arithmetic detected - --> $DIR/arithmetic.rs:18:5 + --> $DIR/arithmetic.rs:17:5 | -18 | 1 + i; +17 | 1 + i; | ^^^^^ | = note: `-D clippy::integer-arithmetic` implied by `-D warnings` error: integer arithmetic detected - --> $DIR/arithmetic.rs:19:5 + --> $DIR/arithmetic.rs:18:5 | -19 | i * 2; +18 | i * 2; | ^^^^^ error: integer arithmetic detected - --> $DIR/arithmetic.rs:20:5 + --> $DIR/arithmetic.rs:19:5 | -20 | / 1 % -21 | | i / 2; // no error, this is part of the expression in the preceding line +19 | / 1 % +20 | | i / 2; // no error, this is part of the expression in the preceding line | |_________^ +error: integer arithmetic detected + --> $DIR/arithmetic.rs:21:5 + | +21 | i - 2 + 2 - i; + | ^^^^^^^^^^^^^ + error: integer arithmetic detected --> $DIR/arithmetic.rs:22:5 | -22 | i - 2 + 2 - i; - | ^^^^^^^^^^^^^ - -error: integer arithmetic detected - --> $DIR/arithmetic.rs:23:5 - | -23 | -i; +22 | -i; | ^^ error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:33:5 + --> $DIR/arithmetic.rs:32:5 | -33 | f * 2.0; +32 | f * 2.0; | ^^^^^^^ | = note: `-D clippy::float-arithmetic` implied by `-D warnings` +error: floating-point arithmetic detected + --> $DIR/arithmetic.rs:34:5 + | +34 | 1.0 + f; + | ^^^^^^^ + error: floating-point arithmetic detected --> $DIR/arithmetic.rs:35:5 | -35 | 1.0 + f; +35 | f * 2.0; | ^^^^^^^ error: floating-point arithmetic detected --> $DIR/arithmetic.rs:36:5 | -36 | f * 2.0; +36 | f / 2.0; | ^^^^^^^ error: floating-point arithmetic detected --> $DIR/arithmetic.rs:37:5 | -37 | f / 2.0; - | ^^^^^^^ +37 | f - 2.0 * 4.2; + | ^^^^^^^^^^^^^ error: floating-point arithmetic detected --> $DIR/arithmetic.rs:38:5 | -38 | f - 2.0 * 4.2; - | ^^^^^^^^^^^^^ - -error: floating-point arithmetic detected - --> $DIR/arithmetic.rs:39:5 - | -39 | -f; +38 | -f; | ^^ error: aborting due to 11 previous errors diff --git a/tests/ui/collapsible_if.stderr b/tests/ui/collapsible_if.stderr index 3f06dca5495..697dec336fa 100644 --- a/tests/ui/collapsible_if.stderr +++ b/tests/ui/collapsible_if.stderr @@ -1,259 +1,259 @@ error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:18:5 + --> $DIR/collapsible_if.rs:16:5 | -18 | / if x == "hello" { -19 | | if y == "world" { -20 | | println!("Hello world!"); -21 | | } -22 | | } +16 | / if x == "hello" { +17 | | if y == "world" { +18 | | println!("Hello world!"); +19 | | } +20 | | } | |_____^ | = note: `-D clippy::collapsible-if` implied by `-D warnings` help: try | -18 | if x == "hello" && y == "world" { -19 | println!("Hello world!"); -20 | } +16 | if x == "hello" && y == "world" { +17 | println!("Hello world!"); +18 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:24:5 + --> $DIR/collapsible_if.rs:22:5 | -24 | / if x == "hello" || x == "world" { -25 | | if y == "world" || y == "hello" { -26 | | println!("Hello world!"); -27 | | } -28 | | } +22 | / if x == "hello" || x == "world" { +23 | | if y == "world" || y == "hello" { +24 | | println!("Hello world!"); +25 | | } +26 | | } | |_____^ help: try | -24 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { -25 | println!("Hello world!"); -26 | } +22 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { +23 | println!("Hello world!"); +24 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:30:5 + --> $DIR/collapsible_if.rs:28:5 | -30 | / if x == "hello" && x == "world" { -31 | | if y == "world" || y == "hello" { -32 | | println!("Hello world!"); -33 | | } -34 | | } +28 | / if x == "hello" && x == "world" { +29 | | if y == "world" || y == "hello" { +30 | | println!("Hello world!"); +31 | | } +32 | | } | |_____^ help: try | -30 | if x == "hello" && x == "world" && (y == "world" || y == "hello") { -31 | println!("Hello world!"); -32 | } +28 | if x == "hello" && x == "world" && (y == "world" || y == "hello") { +29 | println!("Hello world!"); +30 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:36:5 + --> $DIR/collapsible_if.rs:34:5 | -36 | / if x == "hello" || x == "world" { -37 | | if y == "world" && y == "hello" { -38 | | println!("Hello world!"); -39 | | } -40 | | } +34 | / if x == "hello" || x == "world" { +35 | | if y == "world" && y == "hello" { +36 | | println!("Hello world!"); +37 | | } +38 | | } | |_____^ help: try | -36 | if (x == "hello" || x == "world") && y == "world" && y == "hello" { -37 | println!("Hello world!"); -38 | } +34 | if (x == "hello" || x == "world") && y == "world" && y == "hello" { +35 | println!("Hello world!"); +36 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:42:5 + --> $DIR/collapsible_if.rs:40:5 | -42 | / if x == "hello" && x == "world" { -43 | | if y == "world" && y == "hello" { -44 | | println!("Hello world!"); -45 | | } -46 | | } +40 | / if x == "hello" && x == "world" { +41 | | if y == "world" && y == "hello" { +42 | | println!("Hello world!"); +43 | | } +44 | | } | |_____^ help: try | -42 | if x == "hello" && x == "world" && y == "world" && y == "hello" { -43 | println!("Hello world!"); -44 | } +40 | if x == "hello" && x == "world" && y == "world" && y == "hello" { +41 | println!("Hello world!"); +42 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:48:5 + --> $DIR/collapsible_if.rs:46:5 | -48 | / if 42 == 1337 { -49 | | if 'a' != 'A' { -50 | | println!("world!") -51 | | } -52 | | } +46 | / if 42 == 1337 { +47 | | if 'a' != 'A' { +48 | | println!("world!") +49 | | } +50 | | } | |_____^ help: try | -48 | if 42 == 1337 && 'a' != 'A' { -49 | println!("world!") -50 | } +46 | if 42 == 1337 && 'a' != 'A' { +47 | println!("world!") +48 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:57:12 + --> $DIR/collapsible_if.rs:55:12 | -57 | } else { +55 | } else { | ____________^ -58 | | if y == "world" { -59 | | println!("world!") -60 | | } -61 | | } +56 | | if y == "world" { +57 | | println!("world!") +58 | | } +59 | | } | |_____^ help: try | -57 | } else if y == "world" { -58 | println!("world!") -59 | } +55 | } else if y == "world" { +56 | println!("world!") +57 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:65:12 + --> $DIR/collapsible_if.rs:63:12 | -65 | } else { +63 | } else { | ____________^ -66 | | if let Some(42) = Some(42) { -67 | | println!("world!") -68 | | } -69 | | } +64 | | if let Some(42) = Some(42) { +65 | | println!("world!") +66 | | } +67 | | } | |_____^ help: try | -65 | } else if let Some(42) = Some(42) { -66 | println!("world!") -67 | } +63 | } else if let Some(42) = Some(42) { +64 | println!("world!") +65 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:73:12 + --> $DIR/collapsible_if.rs:71:12 | -73 | } else { +71 | } else { | ____________^ -74 | | if y == "world" { -75 | | println!("world") -76 | | } +72 | | if y == "world" { +73 | | println!("world") +74 | | } ... | -79 | | } -80 | | } +77 | | } +78 | | } | |_____^ help: try | -73 | } else if y == "world" { -74 | println!("world") -75 | } -76 | else { -77 | println!("!") -78 | } +71 | } else if y == "world" { +72 | println!("world") +73 | } +74 | else { +75 | println!("!") +76 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:84:12 + --> $DIR/collapsible_if.rs:82:12 | -84 | } else { +82 | } else { | ____________^ -85 | | if let Some(42) = Some(42) { -86 | | println!("world") -87 | | } +83 | | if let Some(42) = Some(42) { +84 | | println!("world") +85 | | } ... | -90 | | } -91 | | } +88 | | } +89 | | } | |_____^ help: try | -84 | } else if let Some(42) = Some(42) { -85 | println!("world") -86 | } -87 | else { -88 | println!("!") -89 | } +82 | } else if let Some(42) = Some(42) { +83 | println!("world") +84 | } +85 | else { +86 | println!("!") +87 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:95:12 + --> $DIR/collapsible_if.rs:93:12 | -95 | } else { +93 | } else { | ____________^ -96 | | if let Some(42) = Some(42) { -97 | | println!("world") -98 | | } +94 | | if let Some(42) = Some(42) { +95 | | println!("world") +96 | | } ... | -101 | | } -102 | | } +99 | | } +100 | | } | |_____^ help: try | -95 | } else if let Some(42) = Some(42) { -96 | println!("world") -97 | } -98 | else { -99 | println!("!") -100 | } +93 | } else if let Some(42) = Some(42) { +94 | println!("world") +95 | } +96 | else { +97 | println!("!") +98 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:106:12 + --> $DIR/collapsible_if.rs:104:12 | -106 | } else { +104 | } else { | ____________^ -107 | | if x == "hello" { -108 | | println!("world") -109 | | } +105 | | if x == "hello" { +106 | | println!("world") +107 | | } ... | -112 | | } -113 | | } +110 | | } +111 | | } | |_____^ help: try | -106 | } else if x == "hello" { -107 | println!("world") -108 | } -109 | else { -110 | println!("!") -111 | } +104 | } else if x == "hello" { +105 | println!("world") +106 | } +107 | else { +108 | println!("!") +109 | } | error: this `else { if .. }` block can be collapsed - --> $DIR/collapsible_if.rs:117:12 + --> $DIR/collapsible_if.rs:115:12 | -117 | } else { +115 | } else { | ____________^ -118 | | if let Some(42) = Some(42) { -119 | | println!("world") -120 | | } +116 | | if let Some(42) = Some(42) { +117 | | println!("world") +118 | | } ... | -123 | | } -124 | | } +121 | | } +122 | | } | |_____^ help: try | -117 | } else if let Some(42) = Some(42) { -118 | println!("world") -119 | } -120 | else { -121 | println!("!") -122 | } +115 | } else if let Some(42) = Some(42) { +116 | println!("world") +117 | } +118 | else { +119 | println!("!") +120 | } | error: this if statement can be collapsed - --> $DIR/collapsible_if.rs:176:5 + --> $DIR/collapsible_if.rs:174:5 | -176 | / if x == "hello" { -177 | | if y == "world" { // Collapsible -178 | | println!("Hello world!"); -179 | | } -180 | | } +174 | / if x == "hello" { +175 | | if y == "world" { // Collapsible +176 | | println!("Hello world!"); +177 | | } +178 | | } | |_____^ help: try | -176 | if x == "hello" && y == "world" { // Collapsible -177 | println!("Hello world!"); -178 | } +174 | if x == "hello" && y == "world" { // Collapsible +175 | println!("Hello world!"); +176 | } | error: aborting due to 14 previous errors diff --git a/tests/ui/cyclomatic_complexity.stderr b/tests/ui/cyclomatic_complexity.stderr index ddc2f5b159f..390df2f5a5b 100644 --- a/tests/ui/cyclomatic_complexity.stderr +++ b/tests/ui/cyclomatic_complexity.stderr @@ -1,256 +1,256 @@ error: the function has a cyclomatic complexity of 28 - --> $DIR/cyclomatic_complexity.rs:17:1 + --> $DIR/cyclomatic_complexity.rs:16:1 | -17 | / fn main() { -18 | | if true { -19 | | println!("a"); -20 | | } +16 | / fn main() { +17 | | if true { +18 | | println!("a"); +19 | | } ... | -98 | | } -99 | | } +97 | | } +98 | | } | |_^ | = note: `-D clippy::cyclomatic-complexity` implied by `-D warnings` = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 7 - --> $DIR/cyclomatic_complexity.rs:102:1 + --> $DIR/cyclomatic_complexity.rs:101:1 | -102 | / fn kaboom() { -103 | | let n = 0; -104 | | 'a: for i in 0..20 { -105 | | 'b: for j in i..20 { +101 | / fn kaboom() { +102 | | let n = 0; +103 | | 'a: for i in 0..20 { +104 | | 'b: for j in i..20 { ... | -120 | | } -121 | | } +119 | | } +120 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:148:1 + --> $DIR/cyclomatic_complexity.rs:147:1 | -148 | / fn lots_of_short_circuits() -> bool { -149 | | true && false && true && false && true && false && true -150 | | } +147 | / fn lots_of_short_circuits() -> bool { +148 | | true && false && true && false && true && false && true +149 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:153:1 + --> $DIR/cyclomatic_complexity.rs:152:1 | -153 | / fn lots_of_short_circuits2() -> bool { -154 | | true || false || true || false || true || false || true -155 | | } +152 | / fn lots_of_short_circuits2() -> bool { +153 | | true || false || true || false || true || false || true +154 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:158:1 + --> $DIR/cyclomatic_complexity.rs:157:1 | -158 | / fn baa() { -159 | | let x = || match 99 { -160 | | 0 => 0, -161 | | 1 => 1, +157 | / fn baa() { +158 | | let x = || match 99 { +159 | | 0 => 0, +160 | | 1 => 1, ... | -172 | | } -173 | | } +171 | | } +172 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:159:13 + --> $DIR/cyclomatic_complexity.rs:158:13 | -159 | let x = || match 99 { +158 | let x = || match 99 { | _____________^ -160 | | 0 => 0, -161 | | 1 => 1, -162 | | 2 => 2, +159 | | 0 => 0, +160 | | 1 => 1, +161 | | 2 => 2, ... | -166 | | _ => 42, -167 | | }; +165 | | _ => 42, +166 | | }; | |_____^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:176:1 + --> $DIR/cyclomatic_complexity.rs:175:1 | -176 | / fn bar() { -177 | | match 99 { -178 | | 0 => println!("hi"), -179 | | _ => println!("bye"), -180 | | } -181 | | } +175 | / fn bar() { +176 | | match 99 { +177 | | 0 => println!("hi"), +178 | | _ => println!("bye"), +179 | | } +180 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:195:1 + --> $DIR/cyclomatic_complexity.rs:194:1 | -195 | / fn barr() { -196 | | match 99 { -197 | | 0 => println!("hi"), -198 | | 1 => println!("bla"), +194 | / fn barr() { +195 | | match 99 { +196 | | 0 => println!("hi"), +197 | | 1 => println!("bla"), ... | -201 | | } -202 | | } +200 | | } +201 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity.rs:205:1 + --> $DIR/cyclomatic_complexity.rs:204:1 | -205 | / fn barr2() { -206 | | match 99 { -207 | | 0 => println!("hi"), -208 | | 1 => println!("bla"), +204 | / fn barr2() { +205 | | match 99 { +206 | | 0 => println!("hi"), +207 | | 1 => println!("bla"), ... | -217 | | } -218 | | } +216 | | } +217 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:221:1 + --> $DIR/cyclomatic_complexity.rs:220:1 | -221 | / fn barrr() { -222 | | match 99 { -223 | | 0 => println!("hi"), -224 | | 1 => panic!("bla"), +220 | / fn barrr() { +221 | | match 99 { +222 | | 0 => println!("hi"), +223 | | 1 => panic!("bla"), ... | -227 | | } -228 | | } +226 | | } +227 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity.rs:231:1 + --> $DIR/cyclomatic_complexity.rs:230:1 | -231 | / fn barrr2() { -232 | | match 99 { -233 | | 0 => println!("hi"), -234 | | 1 => panic!("bla"), +230 | / fn barrr2() { +231 | | match 99 { +232 | | 0 => println!("hi"), +233 | | 1 => panic!("bla"), ... | -243 | | } -244 | | } +242 | | } +243 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:247:1 + --> $DIR/cyclomatic_complexity.rs:246:1 | -247 | / fn barrrr() { -248 | | match 99 { -249 | | 0 => println!("hi"), -250 | | 1 => println!("bla"), +246 | / fn barrrr() { +247 | | match 99 { +248 | | 0 => println!("hi"), +249 | | 1 => println!("bla"), ... | -253 | | } -254 | | } +252 | | } +253 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 3 - --> $DIR/cyclomatic_complexity.rs:257:1 + --> $DIR/cyclomatic_complexity.rs:256:1 | -257 | / fn barrrr2() { -258 | | match 99 { -259 | | 0 => println!("hi"), -260 | | 1 => println!("bla"), +256 | / fn barrrr2() { +257 | | match 99 { +258 | | 0 => println!("hi"), +259 | | 1 => println!("bla"), ... | -269 | | } -270 | | } +268 | | } +269 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 2 - --> $DIR/cyclomatic_complexity.rs:273:1 + --> $DIR/cyclomatic_complexity.rs:272:1 | -273 | / fn cake() { -274 | | if 4 == 5 { -275 | | println!("yea"); -276 | | } else { +272 | / fn cake() { +273 | | if 4 == 5 { +274 | | println!("yea"); +275 | | } else { ... | -279 | | println!("whee"); -280 | | } +278 | | println!("whee"); +279 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 4 - --> $DIR/cyclomatic_complexity.rs:284:1 + --> $DIR/cyclomatic_complexity.rs:283:1 | -284 | / pub fn read_file(input_path: &str) -> String { -285 | | use std::fs::File; -286 | | use std::io::{Read, Write}; -287 | | use std::path::Path; +283 | / pub fn read_file(input_path: &str) -> String { +284 | | use std::fs::File; +285 | | use std::io::{Read, Write}; +286 | | use std::path::Path; ... | -309 | | } -310 | | } +308 | | } +309 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:315:1 + --> $DIR/cyclomatic_complexity.rs:314:1 | -315 | / fn void(void: Void) { -316 | | if true { -317 | | match void { -318 | | } -319 | | } -320 | | } +314 | / fn void(void: Void) { +315 | | if true { +316 | | match void { +317 | | } +318 | | } +319 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:329:1 + --> $DIR/cyclomatic_complexity.rs:328:1 | -329 | / fn try() -> Result { -330 | | match 5 { -331 | | 5 => Ok(5), -332 | | _ => return Err("bla"), -333 | | } -334 | | } +328 | / fn try() -> Result { +329 | | match 5 { +330 | | 5 => Ok(5), +331 | | _ => return Err("bla"), +332 | | } +333 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:337:1 + --> $DIR/cyclomatic_complexity.rs:336:1 | -337 | / fn try_again() -> Result { -338 | | let _ = try!(Ok(42)); -339 | | let _ = try!(Ok(43)); -340 | | let _ = try!(Ok(44)); +336 | / fn try_again() -> Result { +337 | | let _ = try!(Ok(42)); +338 | | let _ = try!(Ok(43)); +339 | | let _ = try!(Ok(44)); ... | -349 | | } -350 | | } +348 | | } +349 | | } | |_^ | = help: you could split it up into multiple smaller functions error: the function has a cyclomatic complexity of 1 - --> $DIR/cyclomatic_complexity.rs:353:1 + --> $DIR/cyclomatic_complexity.rs:352:1 | -353 | / fn early() -> Result { +352 | / fn early() -> Result { +353 | | return Ok(5); 354 | | return Ok(5); 355 | | return Ok(5); -356 | | return Ok(5); ... | -362 | | return Ok(5); -363 | | } +361 | | return Ok(5); +362 | | } | |_^ | = help: you could split it up into multiple smaller functions diff --git a/tests/ui/doc.stderr b/tests/ui/doc.stderr index 69fa4e32cd3..85c0fd898c7 100644 --- a/tests/ui/doc.stderr +++ b/tests/ui/doc.stderr @@ -1,183 +1,183 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation - --> $DIR/doc.rs:13:29 + --> $DIR/doc.rs:10:29 | -13 | //! This file tests for the DOC_MARKDOWN lint +10 | //! This file tests for the DOC_MARKDOWN lint | ^^^^^^^^^^^^ | = note: `-D clippy::doc-markdown` implied by `-D warnings` error: you should put `foo_bar` between ticks in the documentation - --> $DIR/doc.rs:20:9 + --> $DIR/doc.rs:15:9 | -20 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) +15 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^ error: you should put `foo::bar` between ticks in the documentation - --> $DIR/doc.rs:20:51 + --> $DIR/doc.rs:15:51 | -20 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) +15 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there) | ^^^^^^^^ error: you should put `Foo::some_fun` between ticks in the documentation - --> $DIR/doc.rs:21:84 + --> $DIR/doc.rs:16:84 | -21 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun +16 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun | ^^^^^^^^^^^^^ error: you should put `a::global:path` between ticks in the documentation - --> $DIR/doc.rs:23:15 + --> $DIR/doc.rs:18:15 | -23 | /// Here be ::a::global:path. +18 | /// Here be ::a::global:path. | ^^^^^^^^^^^^^^ error: you should put `NotInCodeBlock` between ticks in the documentation - --> $DIR/doc.rs:24:22 + --> $DIR/doc.rs:19:22 | -24 | /// That's not code ~NotInCodeBlock~. +19 | /// That's not code ~NotInCodeBlock~. | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:25:5 + --> $DIR/doc.rs:20:5 | -25 | /// be_sure_we_got_to_the_end_of_it +20 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:39:5 + --> $DIR/doc.rs:34:5 | -39 | /// be_sure_we_got_to_the_end_of_it +34 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:46:5 + --> $DIR/doc.rs:41:5 | -46 | /// be_sure_we_got_to_the_end_of_it +41 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:60:5 + --> $DIR/doc.rs:55:5 | -60 | /// be_sure_we_got_to_the_end_of_it +55 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `link_with_underscores` between ticks in the documentation - --> $DIR/doc.rs:64:22 + --> $DIR/doc.rs:59:22 | -64 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. +59 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823. | ^^^^^^^^^^^^^^^^^^^^^ error: you should put `inline_link2` between ticks in the documentation - --> $DIR/doc.rs:67:21 + --> $DIR/doc.rs:62:21 | -67 | /// It can also be [inline_link2]. +62 | /// It can also be [inline_link2]. | ^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:77:5 + --> $DIR/doc.rs:72:5 | -77 | /// be_sure_we_got_to_the_end_of_it +72 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:85:8 + --> $DIR/doc.rs:80:8 | -85 | /// ## CamelCaseThing +80 | /// ## CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:88:7 + --> $DIR/doc.rs:83:7 | -88 | /// # CamelCaseThing +83 | /// # CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `CamelCaseThing` between ticks in the documentation - --> $DIR/doc.rs:90:22 + --> $DIR/doc.rs:85:22 | -90 | /// Not a title #897 CamelCaseThing +85 | /// Not a title #897 CamelCaseThing | ^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:91:5 + --> $DIR/doc.rs:86:5 | -91 | /// be_sure_we_got_to_the_end_of_it +86 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:98:5 + --> $DIR/doc.rs:93:5 | -98 | /// be_sure_we_got_to_the_end_of_it +93 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:111:5 + --> $DIR/doc.rs:106:5 | -111 | /// be_sure_we_got_to_the_end_of_it +106 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:122:42 + --> $DIR/doc.rs:117:42 | -122 | /** E.g. serialization of an empty list: FooBar +117 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:127:5 + --> $DIR/doc.rs:122:5 | -127 | And BarQuz too. +122 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:128:1 + --> $DIR/doc.rs:123:1 | -128 | be_sure_we_got_to_the_end_of_it +123 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `FooBar` between ticks in the documentation - --> $DIR/doc.rs:133:42 + --> $DIR/doc.rs:128:42 | -133 | /** E.g. serialization of an empty list: FooBar +128 | /** E.g. serialization of an empty list: FooBar | ^^^^^^ error: you should put `BarQuz` between ticks in the documentation - --> $DIR/doc.rs:138:5 + --> $DIR/doc.rs:133:5 | -138 | And BarQuz too. +133 | And BarQuz too. | ^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:139:1 + --> $DIR/doc.rs:134:1 | -139 | be_sure_we_got_to_the_end_of_it +134 | be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation - --> $DIR/doc.rs:150:5 + --> $DIR/doc.rs:145:5 | -150 | /// be_sure_we_got_to_the_end_of_it +145 | /// be_sure_we_got_to_the_end_of_it | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:177:13 + --> $DIR/doc.rs:172:13 | -177 | /// Not ok: http://www.unicode.org +172 | /// Not ok: http://www.unicode.org | ^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:178:13 + --> $DIR/doc.rs:173:13 | -178 | /// Not ok: https://www.unicode.org +173 | /// Not ok: https://www.unicode.org | ^^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:179:13 + --> $DIR/doc.rs:174:13 | -179 | /// Not ok: http://www.unicode.org/ +174 | /// Not ok: http://www.unicode.org/ | ^^^^^^^^^^^^^^^^^^^^^^ error: you should put bare URLs between `<`/`>` or make a proper Markdown link - --> $DIR/doc.rs:180:13 + --> $DIR/doc.rs:175:13 | -180 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels +175 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 30 previous errors diff --git a/tests/ui/double_parens.stderr b/tests/ui/double_parens.stderr index 727b2c4ef42..d736d72c143 100644 --- a/tests/ui/double_parens.stderr +++ b/tests/ui/double_parens.stderr @@ -1,39 +1,39 @@ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:26:5 + --> $DIR/double_parens.rs:21:5 | -26 | ((0)) +21 | ((0)) | ^^^^^ | = note: `-D clippy::double-parens` implied by `-D warnings` error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:30:14 + --> $DIR/double_parens.rs:25:14 | -30 | dummy_fn((0)); +25 | dummy_fn((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:34:20 + --> $DIR/double_parens.rs:29:20 | -34 | x.dummy_method((0)); +29 | x.dummy_method((0)); | ^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:38:5 + --> $DIR/double_parens.rs:33:5 | -38 | ((1, 2)) +33 | ((1, 2)) | ^^^^^^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:42:5 + --> $DIR/double_parens.rs:37:5 | -42 | (()) +37 | (()) | ^^^^ error: Consider removing unnecessary double parentheses - --> $DIR/double_parens.rs:64:16 + --> $DIR/double_parens.rs:59:16 | -64 | assert_eq!(((1, 2)), (1, 2), "Error"); +59 | assert_eq!(((1, 2)), (1, 2), "Error"); | ^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/empty_line_after_outer_attribute.stderr b/tests/ui/empty_line_after_outer_attribute.stderr index e742c0b6615..ec3ee6d018c 100644 --- a/tests/ui/empty_line_after_outer_attribute.stderr +++ b/tests/ui/empty_line_after_outer_attribute.stderr @@ -1,53 +1,53 @@ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:15:1 + --> $DIR/empty_line_after_outer_attribute.rs:13:1 | -15 | / #[crate_type = "lib"] -16 | | -17 | | /// some comment -18 | | fn with_one_newline_and_comment() { assert!(true) } +13 | / #[crate_type = "lib"] +14 | | +15 | | /// some comment +16 | | fn with_one_newline_and_comment() { assert!(true) } | |_ | = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:27:1 + --> $DIR/empty_line_after_outer_attribute.rs:25:1 | -27 | / #[crate_type = "lib"] -28 | | -29 | | fn with_one_newline() { assert!(true) } +25 | / #[crate_type = "lib"] +26 | | +27 | | fn with_one_newline() { assert!(true) } | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:32:1 + --> $DIR/empty_line_after_outer_attribute.rs:30:1 | -32 | / #[crate_type = "lib"] -33 | | -34 | | -35 | | fn with_two_newlines() { assert!(true) } +30 | / #[crate_type = "lib"] +31 | | +32 | | +33 | | fn with_two_newlines() { assert!(true) } | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:39:1 + --> $DIR/empty_line_after_outer_attribute.rs:37:1 | -39 | / #[crate_type = "lib"] -40 | | -41 | | enum Baz { +37 | / #[crate_type = "lib"] +38 | | +39 | | enum Baz { | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:47:1 + --> $DIR/empty_line_after_outer_attribute.rs:45:1 | -47 | / #[crate_type = "lib"] -48 | | -49 | | struct Foo { +45 | / #[crate_type = "lib"] +46 | | +47 | | struct Foo { | |_ error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? - --> $DIR/empty_line_after_outer_attribute.rs:55:1 + --> $DIR/empty_line_after_outer_attribute.rs:53:1 | -55 | / #[crate_type = "lib"] -56 | | -57 | | mod foo { +53 | / #[crate_type = "lib"] +54 | | +55 | | mod foo { | |_ error: aborting due to 6 previous errors diff --git a/tests/ui/eq_op.stderr b/tests/ui/eq_op.stderr index 21487884d35..abd351b65a4 100644 --- a/tests/ui/eq_op.stderr +++ b/tests/ui/eq_op.stderr @@ -1,203 +1,203 @@ error: this boolean expression can be simplified - --> $DIR/eq_op.rs:47:5 + --> $DIR/eq_op.rs:44:5 | -47 | true && true; +44 | true && true; | ^^^^^^^^^^^^ help: try: `true` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> $DIR/eq_op.rs:49:5 + --> $DIR/eq_op.rs:46:5 | -49 | true || true; +46 | true || true; | ^^^^^^^^^^^^ help: try: `true` +error: this boolean expression can be simplified + --> $DIR/eq_op.rs:52:5 + | +52 | a == b && b == a; + | ^^^^^^^^^^^^^^^^ help: try: `a == b` + +error: this boolean expression can be simplified + --> $DIR/eq_op.rs:53:5 + | +53 | a != b && b != a; + | ^^^^^^^^^^^^^^^^ help: try: `a != b` + +error: this boolean expression can be simplified + --> $DIR/eq_op.rs:54:5 + | +54 | a < b && b > a; + | ^^^^^^^^^^^^^^ help: try: `a < b` + error: this boolean expression can be simplified --> $DIR/eq_op.rs:55:5 | -55 | a == b && b == a; - | ^^^^^^^^^^^^^^^^ help: try: `a == b` - -error: this boolean expression can be simplified - --> $DIR/eq_op.rs:56:5 - | -56 | a != b && b != a; - | ^^^^^^^^^^^^^^^^ help: try: `a != b` - -error: this boolean expression can be simplified - --> $DIR/eq_op.rs:57:5 - | -57 | a < b && b > a; - | ^^^^^^^^^^^^^^ help: try: `a < b` - -error: this boolean expression can be simplified - --> $DIR/eq_op.rs:58:5 - | -58 | a <= b && b >= a; +55 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ help: try: `a <= b` error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:20:5 + --> $DIR/eq_op.rs:17:5 | -20 | 1 == 1; +17 | 1 == 1; | ^^^^^^ | = note: `-D clippy::eq-op` implied by `-D warnings` error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:21:5 + --> $DIR/eq_op.rs:18:5 | -21 | "no" == "no"; +18 | "no" == "no"; | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:23:5 + --> $DIR/eq_op.rs:20:5 | -23 | false != false; +20 | false != false; | ^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> $DIR/eq_op.rs:24:5 + --> $DIR/eq_op.rs:21:5 | -24 | 1.5 < 1.5; +21 | 1.5 < 1.5; | ^^^^^^^^^ error: equal expressions as operands to `>=` - --> $DIR/eq_op.rs:25:5 + --> $DIR/eq_op.rs:22:5 | -25 | 1u64 >= 1u64; +22 | 1u64 >= 1u64; | ^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:28:5 + --> $DIR/eq_op.rs:25:5 | -28 | (1 as u64) & (1 as u64); +25 | (1 as u64) & (1 as u64); | ^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `^` - --> $DIR/eq_op.rs:29:5 + --> $DIR/eq_op.rs:26:5 | -29 | 1 ^ ((((((1)))))); +26 | 1 ^ ((((((1)))))); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `<` - --> $DIR/eq_op.rs:32:5 + --> $DIR/eq_op.rs:29:5 | -32 | (-(2) < -(2)); +29 | (-(2) < -(2)); | ^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:33:5 + --> $DIR/eq_op.rs:30:5 | -33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:33:6 + --> $DIR/eq_op.rs:30:6 | -33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `&` - --> $DIR/eq_op.rs:33:27 + --> $DIR/eq_op.rs:30:27 | -33 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); +30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); | ^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:34:5 + --> $DIR/eq_op.rs:31:5 | -34 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; +31 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:37:5 + --> $DIR/eq_op.rs:34:5 | -37 | ([1] != [1]); +34 | ([1] != [1]); | ^^^^^^^^^^^^ error: equal expressions as operands to `!=` - --> $DIR/eq_op.rs:38:5 + --> $DIR/eq_op.rs:35:5 | -38 | ((1, 2) != (1, 2)); +35 | ((1, 2) != (1, 2)); | ^^^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:42:5 + --> $DIR/eq_op.rs:39:5 | -42 | 1 + 1 == 2; +39 | 1 + 1 == 2; | ^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:43:5 + --> $DIR/eq_op.rs:40:5 | -43 | 1 - 1 == 0; +40 | 1 - 1 == 0; | ^^^^^^^^^^ error: equal expressions as operands to `-` - --> $DIR/eq_op.rs:43:5 + --> $DIR/eq_op.rs:40:5 | -43 | 1 - 1 == 0; +40 | 1 - 1 == 0; | ^^^^^ error: equal expressions as operands to `-` - --> $DIR/eq_op.rs:45:5 + --> $DIR/eq_op.rs:42:5 | -45 | 1 - 1; +42 | 1 - 1; | ^^^^^ error: equal expressions as operands to `/` - --> $DIR/eq_op.rs:46:5 + --> $DIR/eq_op.rs:43:5 | -46 | 1 / 1; +43 | 1 / 1; | ^^^^^ error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:47:5 + --> $DIR/eq_op.rs:44:5 | -47 | true && true; +44 | true && true; | ^^^^^^^^^^^^ error: equal expressions as operands to `||` - --> $DIR/eq_op.rs:49:5 + --> $DIR/eq_op.rs:46:5 | -49 | true || true; +46 | true || true; | ^^^^^^^^^^^^ +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:52:5 + | +52 | a == b && b == a; + | ^^^^^^^^^^^^^^^^ + +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:53:5 + | +53 | a != b && b != a; + | ^^^^^^^^^^^^^^^^ + +error: equal expressions as operands to `&&` + --> $DIR/eq_op.rs:54:5 + | +54 | a < b && b > a; + | ^^^^^^^^^^^^^^ + error: equal expressions as operands to `&&` --> $DIR/eq_op.rs:55:5 | -55 | a == b && b == a; - | ^^^^^^^^^^^^^^^^ - -error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:56:5 - | -56 | a != b && b != a; - | ^^^^^^^^^^^^^^^^ - -error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:57:5 - | -57 | a < b && b > a; - | ^^^^^^^^^^^^^^ - -error: equal expressions as operands to `&&` - --> $DIR/eq_op.rs:58:5 - | -58 | a <= b && b >= a; +55 | a <= b && b >= a; | ^^^^^^^^^^^^^^^^ error: equal expressions as operands to `==` - --> $DIR/eq_op.rs:61:5 + --> $DIR/eq_op.rs:58:5 | -61 | a == a; +58 | a == a; | ^^^^^^ error: taken reference of right operand - --> $DIR/eq_op.rs:99:13 + --> $DIR/eq_op.rs:96:13 | -99 | let z = x & &y; +96 | let z = x & &y; | ^^^^-- | | | help: use the right value directly: `y` @@ -205,9 +205,9 @@ error: taken reference of right operand = note: `-D clippy::op-ref` implied by `-D warnings` error: equal expressions as operands to `/` - --> $DIR/eq_op.rs:107:20 + --> $DIR/eq_op.rs:104:20 | -107 | const D: u32 = A / A; +104 | const D: u32 = A / A; | ^^^^^ error: aborting due to 34 previous errors diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr index c4ecd1dcc00..62933f31e18 100644 --- a/tests/ui/format.stderr +++ b/tests/ui/format.stderr @@ -1,71 +1,71 @@ error: useless use of `format!` - --> $DIR/format.rs:22:5 + --> $DIR/format.rs:21:5 | -22 | format!("foo"); +21 | format!("foo"); | ^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: `-D clippy::useless-format` implied by `-D warnings` error: useless use of `format!` - --> $DIR/format.rs:24:5 + --> $DIR/format.rs:23:5 | -24 | format!("{}", "foo"); +23 | format!("{}", "foo"); | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) +error: useless use of `format!` + --> $DIR/format.rs:27:5 + | +27 | format!("{:+}", "foo"); // warn when the format makes no difference + | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + error: useless use of `format!` --> $DIR/format.rs:28:5 | -28 | format!("{:+}", "foo"); // warn when the format makes no difference +28 | format!("{:<}", "foo"); // warn when the format makes no difference | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` - --> $DIR/format.rs:29:5 + --> $DIR/format.rs:33:5 | -29 | format!("{:<}", "foo"); // warn when the format makes no difference - | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string()` - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: useless use of `format!` - --> $DIR/format.rs:34:5 - | -34 | format!("{}", arg); +33 | format!("{}", arg); | ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) +error: useless use of `format!` + --> $DIR/format.rs:37:5 + | +37 | format!("{:+}", arg); // warn when the format makes no difference + | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + error: useless use of `format!` --> $DIR/format.rs:38:5 | -38 | format!("{:+}", arg); // warn when the format makes no difference +38 | format!("{:<}", arg); // warn when the format makes no difference | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` - --> $DIR/format.rs:39:5 + --> $DIR/format.rs:65:5 | -39 | format!("{:<}", arg); // warn when the format makes no difference - | ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string()` - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: useless use of `format!` - --> $DIR/format.rs:66:5 - | -66 | format!("{}", 42.to_string()); +65 | format!("{}", 42.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `to_string()` is enough: `42.to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: useless use of `format!` - --> $DIR/format.rs:68:5 + --> $DIR/format.rs:67:5 | -68 | format!("{}", x.display().to_string()); +67 | format!("{}", x.display().to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `to_string()` is enough: `x.display().to_string()` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index 985070f3754..950c49003b6 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -1,402 +1,402 @@ error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name - --> $DIR/methods.rs:31:5 + --> $DIR/methods.rs:38:5 | -31 | pub fn add(self, other: T) -> T { self } +38 | pub fn add(self, other: T) -> T { self } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::should-implement-trait` implied by `-D warnings` error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name - --> $DIR/methods.rs:42:17 + --> $DIR/methods.rs:49:17 | -42 | fn into_u16(&self) -> u16 { 0 } +49 | fn into_u16(&self) -> u16 { 0 } | ^^^^^ | = note: `-D clippy::wrong-self-convention` implied by `-D warnings` error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name - --> $DIR/methods.rs:44:21 + --> $DIR/methods.rs:51:21 | -44 | fn to_something(self) -> u32 { 0 } +51 | fn to_something(self) -> u32 { 0 } | ^^^^ error: methods called `new` usually take no self; consider choosing a less ambiguous name - --> $DIR/methods.rs:46:12 + --> $DIR/methods.rs:53:12 | -46 | fn new(self) -> Self { unimplemented!(); } +53 | fn new(self) -> Self { unimplemented!(); } | ^^^^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:114:13 + --> $DIR/methods.rs:121:13 | -114 | let _ = opt.map(|x| x + 1) +121 | let _ = opt.map(|x| x + 1) | _____________^ -115 | | -116 | | .unwrap_or(0); // should lint even though this call is on a separate line +122 | | +123 | | .unwrap_or(0); // should lint even though this call is on a separate line | |____________________________^ | = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)` error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:118:13 + --> $DIR/methods.rs:125:13 | -118 | let _ = opt.map(|x| { +125 | let _ = opt.map(|x| { | _____________^ -119 | | x + 1 -120 | | } -121 | | ).unwrap_or(0); +126 | | x + 1 +127 | | } +128 | | ).unwrap_or(0); | |____________________________^ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead - --> $DIR/methods.rs:122:13 + --> $DIR/methods.rs:129:13 | -122 | let _ = opt.map(|x| x + 1) +129 | let _ = opt.map(|x| x + 1) | _____________^ -123 | | .unwrap_or({ -124 | | 0 -125 | | }); +130 | | .unwrap_or({ +131 | | 0 +132 | | }); | |__________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:127:13 + --> $DIR/methods.rs:134:13 | -127 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); +134 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:129:13 + --> $DIR/methods.rs:136:13 | -129 | let _ = opt.map(|x| { +136 | let _ = opt.map(|x| { | _____________^ -130 | | Some(x + 1) -131 | | } -132 | | ).unwrap_or(None); +137 | | Some(x + 1) +138 | | } +139 | | ).unwrap_or(None); | |_____________________^ error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:133:13 + --> $DIR/methods.rs:140:13 | -133 | let _ = opt +140 | let _ = opt | _____________^ -134 | | .map(|x| Some(x + 1)) -135 | | .unwrap_or(None); +141 | | .map(|x| Some(x + 1)) +142 | | .unwrap_or(None); | |________________________^ | = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:141:13 + --> $DIR/methods.rs:148:13 | -141 | let _ = opt.map(|x| x + 1) +148 | let _ = opt.map(|x| x + 1) | _____________^ -142 | | -143 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line +149 | | +150 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line | |____________________________________^ | = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:145:13 + --> $DIR/methods.rs:152:13 | -145 | let _ = opt.map(|x| { +152 | let _ = opt.map(|x| { | _____________^ -146 | | x + 1 -147 | | } -148 | | ).unwrap_or_else(|| 0); +153 | | x + 1 +154 | | } +155 | | ).unwrap_or_else(|| 0); | |____________________________________^ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead - --> $DIR/methods.rs:149:13 + --> $DIR/methods.rs:156:13 | -149 | let _ = opt.map(|x| x + 1) +156 | let _ = opt.map(|x| x + 1) | _____________^ -150 | | .unwrap_or_else(|| -151 | | 0 -152 | | ); +157 | | .unwrap_or_else(|| +158 | | 0 +159 | | ); | |_________________^ error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:158:13 + --> $DIR/methods.rs:165:13 | -158 | let _ = opt.map_or(None, |x| Some(x + 1)); +165 | let _ = opt.map_or(None, |x| Some(x + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))` | = note: `-D clippy::option-map-or-none` implied by `-D warnings` error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead - --> $DIR/methods.rs:160:13 + --> $DIR/methods.rs:167:13 | -160 | let _ = opt.map_or(None, |x| { +167 | let _ = opt.map_or(None, |x| { | _____________^ -161 | | Some(x + 1) -162 | | } -163 | | ); +168 | | Some(x + 1) +169 | | } +170 | | ); | |_________________^ help: try using and_then instead | -160 | let _ = opt.and_then(|x| { -161 | Some(x + 1) -162 | }); +167 | let _ = opt.and_then(|x| { +168 | Some(x + 1) +169 | }); | error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:173:13 + --> $DIR/methods.rs:180:13 | -173 | let _ = res.map(|x| x + 1) +180 | let _ = res.map(|x| x + 1) | _____________^ -174 | | -175 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line +181 | | +182 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line | |_____________________________________^ | = note: `-D clippy::result-map-unwrap-or-else` implied by `-D warnings` = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)` error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:177:13 + --> $DIR/methods.rs:184:13 | -177 | let _ = res.map(|x| { +184 | let _ = res.map(|x| { | _____________^ -178 | | x + 1 -179 | | } -180 | | ).unwrap_or_else(|e| 0); +185 | | x + 1 +186 | | } +187 | | ).unwrap_or_else(|e| 0); | |_____________________________________^ error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead - --> $DIR/methods.rs:181:13 + --> $DIR/methods.rs:188:13 | -181 | let _ = res.map(|x| x + 1) +188 | let _ = res.map(|x| x + 1) | _____________^ -182 | | .unwrap_or_else(|e| -183 | | 0 -184 | | ); +189 | | .unwrap_or_else(|e| +190 | | 0 +191 | | ); | |_________________^ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:244:13 + --> $DIR/methods.rs:251:13 | -244 | let _ = v.iter().filter(|&x| *x < 0).next(); +251 | let _ = v.iter().filter(|&x| *x < 0).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::filter-next` implied by `-D warnings` = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)` error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead. - --> $DIR/methods.rs:247:13 + --> $DIR/methods.rs:254:13 | -247 | let _ = v.iter().filter(|&x| { +254 | let _ = v.iter().filter(|&x| { | _____________^ -248 | | *x < 0 -249 | | } -250 | | ).next(); +255 | | *x < 0 +256 | | } +257 | | ).next(); | |___________________________^ error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:262:13 + --> $DIR/methods.rs:269:13 | -262 | let _ = v.iter().find(|&x| *x < 0).is_some(); +269 | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::search-is-some` implied by `-D warnings` = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)` error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:265:13 + --> $DIR/methods.rs:272:13 | -265 | let _ = v.iter().find(|&x| { +272 | let _ = v.iter().find(|&x| { | _____________^ -266 | | *x < 0 -267 | | } -268 | | ).is_some(); +273 | | *x < 0 +274 | | } +275 | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:271:13 + --> $DIR/methods.rs:278:13 | -271 | let _ = v.iter().position(|&x| x < 0).is_some(); +278 | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:274:13 + --> $DIR/methods.rs:281:13 | -274 | let _ = v.iter().position(|&x| { +281 | let _ = v.iter().position(|&x| { | _____________^ -275 | | x < 0 -276 | | } -277 | | ).is_some(); +282 | | x < 0 +283 | | } +284 | | ).is_some(); | |______________________________^ error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:280:13 + --> $DIR/methods.rs:287:13 | -280 | let _ = v.iter().rposition(|&x| x < 0).is_some(); +287 | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`. - --> $DIR/methods.rs:283:13 + --> $DIR/methods.rs:290:13 | -283 | let _ = v.iter().rposition(|&x| { +290 | let _ = v.iter().rposition(|&x| { | _____________^ -284 | | x < 0 -285 | | } -286 | | ).is_some(); +291 | | x < 0 +292 | | } +293 | | ).is_some(); | |______________________________^ error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:318:22 + --> $DIR/methods.rs:325:22 | -318 | with_constructor.unwrap_or(make()); +325 | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)` | = note: `-D clippy::or-fun-call` implied by `-D warnings` error: use of `unwrap_or` followed by a call to `new` - --> $DIR/methods.rs:321:5 + --> $DIR/methods.rs:328:5 | -321 | with_new.unwrap_or(Vec::new()); +328 | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:324:21 + --> $DIR/methods.rs:331:21 | -324 | with_const_args.unwrap_or(Vec::with_capacity(12)); +331 | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:327:14 + --> $DIR/methods.rs:334:14 | -327 | with_err.unwrap_or(make()); +334 | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:330:19 + --> $DIR/methods.rs:337:19 | -330 | with_err_args.unwrap_or(Vec::with_capacity(12)); +337 | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:333:5 + --> $DIR/methods.rs:340:5 | -333 | with_default_trait.unwrap_or(Default::default()); +340 | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()` error: use of `unwrap_or` followed by a call to `default` - --> $DIR/methods.rs:336:5 + --> $DIR/methods.rs:343:5 | -336 | with_default_type.unwrap_or(u64::default()); +343 | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:339:14 + --> $DIR/methods.rs:346:14 | -339 | with_vec.unwrap_or(vec![]); +346 | with_vec.unwrap_or(vec![]); | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:344:21 + --> $DIR/methods.rs:351:21 | -344 | without_default.unwrap_or(Foo::new()); +351 | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:347:19 + --> $DIR/methods.rs:354:19 | -347 | map.entry(42).or_insert(String::new()); +354 | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `or_insert` followed by a function call - --> $DIR/methods.rs:350:21 + --> $DIR/methods.rs:357:21 | -350 | btree.entry(42).or_insert(String::new()); +357 | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)` error: use of `unwrap_or` followed by a function call - --> $DIR/methods.rs:353:21 + --> $DIR/methods.rs:360:21 | -353 | let _ = stringy.unwrap_or("".to_owned()); +360 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())` error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:364:23 + --> $DIR/methods.rs:371:23 | -364 | let bad_vec = some_vec.iter().nth(3); +371 | let bad_vec = some_vec.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-nth` implied by `-D warnings` error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:365:26 + --> $DIR/methods.rs:372:26 | -365 | let bad_slice = &some_vec[..].iter().nth(3); +372 | let bad_slice = &some_vec[..].iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:366:31 + --> $DIR/methods.rs:373:31 | -366 | let bad_boxed_slice = boxed_slice.iter().nth(3); +373 | let bad_boxed_slice = boxed_slice.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable - --> $DIR/methods.rs:367:29 + --> $DIR/methods.rs:374:29 | -367 | let bad_vec_deque = some_vec_deque.iter().nth(3); +374 | let bad_vec_deque = some_vec_deque.iter().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:372:23 + --> $DIR/methods.rs:379:23 | -372 | let bad_vec = some_vec.iter_mut().nth(3); +379 | let bad_vec = some_vec.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:375:26 + --> $DIR/methods.rs:382:26 | -375 | let bad_slice = &some_vec[..].iter_mut().nth(3); +382 | let bad_slice = &some_vec[..].iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable - --> $DIR/methods.rs:378:29 + --> $DIR/methods.rs:385:29 | -378 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); +385 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:390:13 + --> $DIR/methods.rs:397:13 | -390 | let _ = some_vec.iter().skip(42).next(); +397 | let _ = some_vec.iter().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::iter-skip-next` implied by `-D warnings` error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:391:13 + --> $DIR/methods.rs:398:13 | -391 | let _ = some_vec.iter().cycle().skip(42).next(); +398 | let _ = some_vec.iter().cycle().skip(42).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:392:13 + --> $DIR/methods.rs:399:13 | -392 | let _ = (1..10).skip(10).next(); +399 | let _ = (1..10).skip(10).next(); | ^^^^^^^^^^^^^^^^^^^^^^^ error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)` - --> $DIR/methods.rs:393:14 + --> $DIR/methods.rs:400:14 | -393 | let _ = &some_vec[..].iter().skip(3).next(); +400 | let _ = &some_vec[..].iter().skip(3).next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message - --> $DIR/methods.rs:402:13 + --> $DIR/methods.rs:409:13 | -402 | let _ = opt.unwrap(); +409 | let _ = opt.unwrap(); | ^^^^^^^^^^^^ | = note: `-D clippy::option-unwrap-used` implied by `-D warnings` diff --git a/tests/ui/replace_consts.stderr b/tests/ui/replace_consts.stderr index 02100b4194d..5b8451e046c 100644 --- a/tests/ui/replace_consts.stderr +++ b/tests/ui/replace_consts.stderr @@ -1,217 +1,217 @@ error: using `ATOMIC_BOOL_INIT` - --> $DIR/replace_consts.rs:24:17 + --> $DIR/replace_consts.rs:23:17 | -24 | { let foo = ATOMIC_BOOL_INIT; }; +23 | { let foo = ATOMIC_BOOL_INIT; }; | ^^^^^^^^^^^^^^^^ help: try this: `AtomicBool::new(false)` | note: lint level defined here - --> $DIR/replace_consts.rs:15:9 + --> $DIR/replace_consts.rs:13:9 | -15 | #![deny(clippy::replace_consts)] +13 | #![deny(clippy::replace_consts)] | ^^^^^^^^^^^^^^^^^^^^^^ error: using `ATOMIC_ISIZE_INIT` - --> $DIR/replace_consts.rs:25:17 + --> $DIR/replace_consts.rs:24:17 | -25 | { let foo = ATOMIC_ISIZE_INIT; }; +24 | { let foo = ATOMIC_ISIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicIsize::new(0)` error: using `ATOMIC_I8_INIT` - --> $DIR/replace_consts.rs:26:17 + --> $DIR/replace_consts.rs:25:17 | -26 | { let foo = ATOMIC_I8_INIT; }; +25 | { let foo = ATOMIC_I8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicI8::new(0)` error: using `ATOMIC_I16_INIT` - --> $DIR/replace_consts.rs:27:17 + --> $DIR/replace_consts.rs:26:17 | -27 | { let foo = ATOMIC_I16_INIT; }; +26 | { let foo = ATOMIC_I16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI16::new(0)` error: using `ATOMIC_I32_INIT` - --> $DIR/replace_consts.rs:28:17 + --> $DIR/replace_consts.rs:27:17 | -28 | { let foo = ATOMIC_I32_INIT; }; +27 | { let foo = ATOMIC_I32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI32::new(0)` error: using `ATOMIC_I64_INIT` - --> $DIR/replace_consts.rs:29:17 + --> $DIR/replace_consts.rs:28:17 | -29 | { let foo = ATOMIC_I64_INIT; }; +28 | { let foo = ATOMIC_I64_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicI64::new(0)` error: using `ATOMIC_USIZE_INIT` - --> $DIR/replace_consts.rs:30:17 + --> $DIR/replace_consts.rs:29:17 | -30 | { let foo = ATOMIC_USIZE_INIT; }; +29 | { let foo = ATOMIC_USIZE_INIT; }; | ^^^^^^^^^^^^^^^^^ help: try this: `AtomicUsize::new(0)` error: using `ATOMIC_U8_INIT` - --> $DIR/replace_consts.rs:31:17 + --> $DIR/replace_consts.rs:30:17 | -31 | { let foo = ATOMIC_U8_INIT; }; +30 | { let foo = ATOMIC_U8_INIT; }; | ^^^^^^^^^^^^^^ help: try this: `AtomicU8::new(0)` error: using `ATOMIC_U16_INIT` - --> $DIR/replace_consts.rs:32:17 + --> $DIR/replace_consts.rs:31:17 | -32 | { let foo = ATOMIC_U16_INIT; }; +31 | { let foo = ATOMIC_U16_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU16::new(0)` error: using `ATOMIC_U32_INIT` - --> $DIR/replace_consts.rs:33:17 + --> $DIR/replace_consts.rs:32:17 | -33 | { let foo = ATOMIC_U32_INIT; }; +32 | { let foo = ATOMIC_U32_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU32::new(0)` error: using `ATOMIC_U64_INIT` - --> $DIR/replace_consts.rs:34:17 + --> $DIR/replace_consts.rs:33:17 | -34 | { let foo = ATOMIC_U64_INIT; }; +33 | { let foo = ATOMIC_U64_INIT; }; | ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)` +error: using `MIN` + --> $DIR/replace_consts.rs:35:17 + | +35 | { let foo = std::isize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` + error: using `MIN` --> $DIR/replace_consts.rs:36:17 | -36 | { let foo = std::isize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()` +36 | { let foo = std::i8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `i8::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:37:17 | -37 | { let foo = std::i8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `i8::min_value()` +37 | { let foo = std::i16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:38:17 | -38 | { let foo = std::i16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i16::min_value()` +38 | { let foo = std::i32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:39:17 | -39 | { let foo = std::i32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i32::min_value()` +39 | { let foo = std::i64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:40:17 | -40 | { let foo = std::i64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `i64::min_value()` +40 | { let foo = std::i128::MIN; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:41:17 | -41 | { let foo = std::i128::MIN; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` +41 | { let foo = std::usize::MIN; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:42:17 | -42 | { let foo = std::usize::MIN; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` +42 | { let foo = std::u8::MIN; }; + | ^^^^^^^^^^^^ help: try this: `u8::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:43:17 | -43 | { let foo = std::u8::MIN; }; - | ^^^^^^^^^^^^ help: try this: `u8::min_value()` +43 | { let foo = std::u16::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:44:17 | -44 | { let foo = std::u16::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u16::min_value()` +44 | { let foo = std::u32::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:45:17 | -45 | { let foo = std::u32::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u32::min_value()` +45 | { let foo = std::u64::MIN; }; + | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` error: using `MIN` --> $DIR/replace_consts.rs:46:17 | -46 | { let foo = std::u64::MIN; }; - | ^^^^^^^^^^^^^ help: try this: `u64::min_value()` - -error: using `MIN` - --> $DIR/replace_consts.rs:47:17 - | -47 | { let foo = std::u128::MIN; }; +46 | { let foo = std::u128::MIN; }; | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` +error: using `MAX` + --> $DIR/replace_consts.rs:48:17 + | +48 | { let foo = std::isize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` + error: using `MAX` --> $DIR/replace_consts.rs:49:17 | -49 | { let foo = std::isize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` +49 | { let foo = std::i8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `i8::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:50:17 | -50 | { let foo = std::i8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `i8::max_value()` +50 | { let foo = std::i16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:51:17 | -51 | { let foo = std::i16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i16::max_value()` +51 | { let foo = std::i32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:52:17 | -52 | { let foo = std::i32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i32::max_value()` +52 | { let foo = std::i64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:53:17 | -53 | { let foo = std::i64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `i64::max_value()` +53 | { let foo = std::i128::MAX; }; + | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:54:17 | -54 | { let foo = std::i128::MAX; }; - | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` +54 | { let foo = std::usize::MAX; }; + | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:55:17 | -55 | { let foo = std::usize::MAX; }; - | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` +55 | { let foo = std::u8::MAX; }; + | ^^^^^^^^^^^^ help: try this: `u8::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:56:17 | -56 | { let foo = std::u8::MAX; }; - | ^^^^^^^^^^^^ help: try this: `u8::max_value()` +56 | { let foo = std::u16::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:57:17 | -57 | { let foo = std::u16::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u16::max_value()` +57 | { let foo = std::u32::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:58:17 | -58 | { let foo = std::u32::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u32::max_value()` +58 | { let foo = std::u64::MAX; }; + | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` error: using `MAX` --> $DIR/replace_consts.rs:59:17 | -59 | { let foo = std::u64::MAX; }; - | ^^^^^^^^^^^^^ help: try this: `u64::max_value()` - -error: using `MAX` - --> $DIR/replace_consts.rs:60:17 - | -60 | { let foo = std::u128::MAX; }; +59 | { let foo = std::u128::MAX; }; | ^^^^^^^^^^^^^^ help: try this: `u128::max_value()` error: aborting due to 35 previous errors diff --git a/tests/ui/unused_unit.stderr b/tests/ui/unused_unit.stderr index 92d0095c0b5..aac092b9f7f 100644 --- a/tests/ui/unused_unit.stderr +++ b/tests/ui/unused_unit.stderr @@ -1,51 +1,51 @@ error: unneeded unit return type - --> $DIR/unused_unit.rs:27:59 + --> $DIR/unused_unit.rs:25:59 | -27 | pub fn get_unit (), G>(&self, f: F, _g: G) -> +25 | pub fn get_unit (), G>(&self, f: F, _g: G) -> | ___________________________________________________________^ -28 | | () +26 | | () | |__________^ help: remove the `-> ()` | note: lint level defined here - --> $DIR/unused_unit.rs:20:9 + --> $DIR/unused_unit.rs:19:9 | -20 | #![deny(clippy::unused_unit)] +19 | #![deny(clippy::unused_unit)] | ^^^^^^^^^^^^^^^^^^^ error: unneeded unit return type - --> $DIR/unused_unit.rs:36:19 + --> $DIR/unused_unit.rs:35:19 | -36 | fn into(self) -> () { +35 | fn into(self) -> () { | ^^^^^ help: remove the `-> ()` error: unneeded unit expression - --> $DIR/unused_unit.rs:37:9 + --> $DIR/unused_unit.rs:36:9 | -37 | () +36 | () | ^^ help: remove the final `()` error: unneeded unit return type - --> $DIR/unused_unit.rs:41:18 + --> $DIR/unused_unit.rs:40:18 | -41 | fn return_unit() -> () { () } +40 | fn return_unit() -> () { () } | ^^^^^ help: remove the `-> ()` error: unneeded unit expression - --> $DIR/unused_unit.rs:41:26 + --> $DIR/unused_unit.rs:40:26 | -41 | fn return_unit() -> () { () } +40 | fn return_unit() -> () { () } | ^^ help: remove the final `()` error: unneeded `()` - --> $DIR/unused_unit.rs:48:14 + --> $DIR/unused_unit.rs:47:14 | -48 | break(); +47 | break(); | ^^ help: remove the `()` error: unneeded `()` - --> $DIR/unused_unit.rs:50:11 + --> $DIR/unused_unit.rs:49:11 | -50 | return(); +49 | return(); | ^^ help: remove the `()` error: aborting due to 7 previous errors