Merge pull request #1692 from Manishearth/tests
Update tests to new format of multiline errors
This commit is contained in:
commit
613bde6e40
@ -19,10 +19,9 @@ error: integer arithmetic detected
|
||||
error: integer arithmetic detected
|
||||
--> $DIR/arithmetic.rs:10:5
|
||||
|
|
||||
10 | 1 %
|
||||
| _____^ starting here...
|
||||
10 | / 1 %
|
||||
11 | | i / 2; // no error, this is part of the expression in the preceding line
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
||||
error: integer arithmetic detected
|
||||
--> $DIR/arithmetic.rs:12:5
|
||||
|
@ -2,11 +2,11 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste
|
||||
--> $DIR/block_in_if_condition.rs:30:8
|
||||
|
|
||||
30 | if {
|
||||
| ________^ starting here...
|
||||
| ________^
|
||||
31 | | let x = 3;
|
||||
32 | | x == 3
|
||||
33 | | } {
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/block_in_if_condition.rs:5:9
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:8:5
|
||||
|
|
||||
8 | if x == "hello" {
|
||||
| _____^ starting here...
|
||||
8 | / if x == "hello" {
|
||||
9 | |
|
||||
10 | |
|
||||
11 | |
|
||||
... |
|
||||
14 | | }
|
||||
15 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/collapsible_if.rs:4:8
|
||||
@ -24,15 +23,14 @@ help: try
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:17:5
|
||||
|
|
||||
17 | if x == "hello" || x == "world" {
|
||||
| _____^ starting here...
|
||||
17 | / if x == "hello" || x == "world" {
|
||||
18 | |
|
||||
19 | |
|
||||
20 | |
|
||||
... |
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
|
||||
@ -42,15 +40,14 @@ help: try
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:26:5
|
||||
|
|
||||
26 | if x == "hello" && x == "world" {
|
||||
| _____^ starting here...
|
||||
26 | / if x == "hello" && x == "world" {
|
||||
27 | |
|
||||
28 | |
|
||||
29 | |
|
||||
... |
|
||||
32 | | }
|
||||
33 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| if x == "hello" && x == "world" && (y == "world" || y == "hello") {
|
||||
@ -60,15 +57,14 @@ help: try
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:35:5
|
||||
|
|
||||
35 | if x == "hello" || x == "world" {
|
||||
| _____^ starting here...
|
||||
35 | / if x == "hello" || x == "world" {
|
||||
36 | |
|
||||
37 | |
|
||||
38 | |
|
||||
... |
|
||||
41 | | }
|
||||
42 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| if (x == "hello" || x == "world") && y == "world" && y == "hello" {
|
||||
@ -78,15 +74,14 @@ help: try
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:44:5
|
||||
|
|
||||
44 | if x == "hello" && x == "world" {
|
||||
| _____^ starting here...
|
||||
44 | / if x == "hello" && x == "world" {
|
||||
45 | |
|
||||
46 | |
|
||||
47 | |
|
||||
... |
|
||||
50 | | }
|
||||
51 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| if x == "hello" && x == "world" && y == "world" && y == "hello" {
|
||||
@ -96,15 +91,14 @@ help: try
|
||||
error: this if statement can be collapsed
|
||||
--> $DIR/collapsible_if.rs:53:5
|
||||
|
|
||||
53 | if 42 == 1337 {
|
||||
| _____^ starting here...
|
||||
53 | / if 42 == 1337 {
|
||||
54 | |
|
||||
55 | |
|
||||
56 | |
|
||||
... |
|
||||
59 | | }
|
||||
60 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| if 42 == 1337 && 'a' != 'A' {
|
||||
@ -115,14 +109,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:65:12
|
||||
|
|
||||
65 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
66 | |
|
||||
67 | |
|
||||
68 | |
|
||||
... |
|
||||
71 | | }
|
||||
72 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if y == "world" {
|
||||
@ -133,14 +127,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:76:12
|
||||
|
|
||||
76 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
77 | |
|
||||
78 | |
|
||||
79 | |
|
||||
... |
|
||||
82 | | }
|
||||
83 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
@ -151,14 +145,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:87:12
|
||||
|
|
||||
87 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
88 | |
|
||||
89 | |
|
||||
90 | |
|
||||
... |
|
||||
96 | | }
|
||||
97 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if y == "world" {
|
||||
@ -172,14 +166,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:101:12
|
||||
|
|
||||
101 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
102 | |
|
||||
103 | |
|
||||
104 | |
|
||||
... |
|
||||
110 | | }
|
||||
111 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
@ -193,14 +187,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:115:12
|
||||
|
|
||||
115 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
116 | |
|
||||
117 | |
|
||||
118 | |
|
||||
... |
|
||||
124 | | }
|
||||
125 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
@ -214,14 +208,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:129:12
|
||||
|
|
||||
129 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
130 | |
|
||||
131 | |
|
||||
132 | |
|
||||
... |
|
||||
138 | | }
|
||||
139 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if x == "hello" {
|
||||
@ -235,14 +229,14 @@ error: this `else { if .. }` block can be collapsed
|
||||
--> $DIR/collapsible_if.rs:143:12
|
||||
|
|
||||
143 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
144 | |
|
||||
145 | |
|
||||
146 | |
|
||||
... |
|
||||
152 | | }
|
||||
153 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| } else if let Some(42) = Some(42) {
|
||||
|
@ -2,14 +2,14 @@ error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:40:10
|
||||
|
|
||||
40 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
41 | | Foo { bar: 42 };
|
||||
42 | | 0..10;
|
||||
43 | | ..;
|
||||
... |
|
||||
47 | | foo();
|
||||
48 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/copies.rs:27:8
|
||||
@ -20,27 +20,27 @@ note: same as this
|
||||
--> $DIR/copies.rs:30:13
|
||||
|
|
||||
30 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
31 | |
|
||||
32 | | Foo { bar: 42 };
|
||||
33 | | 0..10;
|
||||
... |
|
||||
38 | | foo();
|
||||
39 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/copies.rs:91:14
|
||||
|
|
||||
91 | _ => {
|
||||
| ______________^ starting here...
|
||||
| ______________^
|
||||
92 | | foo();
|
||||
93 | | let mut a = 42 + [23].len() as i32;
|
||||
94 | | if true {
|
||||
... |
|
||||
98 | | a
|
||||
99 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/copies.rs:28:8
|
||||
@ -51,26 +51,26 @@ note: same as this
|
||||
--> $DIR/copies.rs:80:15
|
||||
|
|
||||
80 | 42 => {
|
||||
| _______________^ starting here...
|
||||
| _______________^
|
||||
81 | |
|
||||
82 | |
|
||||
83 | | foo();
|
||||
... |
|
||||
89 | | a
|
||||
90 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
note: `42` has the same arm body as the `_` wildcard, consider removing it`
|
||||
--> $DIR/copies.rs:80:15
|
||||
|
|
||||
80 | 42 => {
|
||||
| _______________^ starting here...
|
||||
| _______________^
|
||||
81 | |
|
||||
82 | |
|
||||
83 | | foo();
|
||||
... |
|
||||
89 | | a
|
||||
90 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/copies.rs:107:14
|
||||
@ -93,136 +93,136 @@ error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:118:10
|
||||
|
|
||||
118 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
119 | | 42
|
||||
120 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:114:21
|
||||
|
|
||||
114 | let _ = if true {
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
115 | |
|
||||
116 | | 42
|
||||
117 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:133:10
|
||||
|
|
||||
133 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
134 | | for _ in &[42] {
|
||||
135 | | let foo: &Option<_> = &Some::<u8>(42);
|
||||
136 | | if true {
|
||||
... |
|
||||
141 | | }
|
||||
142 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:122:13
|
||||
|
|
||||
122 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
123 | |
|
||||
124 | | for _ in &[42] {
|
||||
125 | | let foo: &Option<_> = &Some::<u8>(42);
|
||||
... |
|
||||
131 | | }
|
||||
132 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:156:10
|
||||
|
|
||||
156 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
157 | | let bar = if true {
|
||||
158 | | 42
|
||||
159 | | }
|
||||
... |
|
||||
165 | | bar + 1;
|
||||
166 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:144:13
|
||||
|
|
||||
144 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
145 | |
|
||||
146 | | let bar = if true {
|
||||
147 | | 42
|
||||
... |
|
||||
154 | | bar + 1;
|
||||
155 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:180:19
|
||||
|
|
||||
180 | else if foo() {
|
||||
| ___________________^ starting here...
|
||||
| ___________________^
|
||||
181 | | let _ = match 42 {
|
||||
182 | | 42 => 1,
|
||||
183 | | a if a > 0 => 2,
|
||||
... |
|
||||
186 | | };
|
||||
187 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:168:13
|
||||
|
|
||||
168 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
169 | |
|
||||
170 | | let _ = match 42 {
|
||||
171 | | 42 => 1,
|
||||
... |
|
||||
175 | | };
|
||||
176 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:193:10
|
||||
|
|
||||
193 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
194 | | if let Some(a) = Some(42) {}
|
||||
195 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:189:13
|
||||
|
|
||||
189 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
190 | |
|
||||
191 | | if let Some(a) = Some(42) {}
|
||||
192 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:201:10
|
||||
|
|
||||
201 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
202 | | if let (1, .., 3) = (1, 2, 3) {}
|
||||
203 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:197:13
|
||||
|
|
||||
197 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
198 | |
|
||||
199 | | if let (1, .., 3) = (1, 2, 3) {}
|
||||
200 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/copies.rs:258:15
|
||||
@ -313,98 +313,98 @@ error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:313:12
|
||||
|
|
||||
313 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
314 | | 0.0
|
||||
315 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:310:21
|
||||
|
|
||||
310 | let _ = if true {
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
311 | |
|
||||
312 | | 0.0
|
||||
313 | | } else {
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:320:12
|
||||
|
|
||||
320 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
321 | | -0.0
|
||||
322 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:317:21
|
||||
|
|
||||
317 | let _ = if true {
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
318 | |
|
||||
319 | | -0.0
|
||||
320 | | } else {
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:341:12
|
||||
|
|
||||
341 | } else {
|
||||
| ____________^ starting here...
|
||||
| ____________^
|
||||
342 | | std::f32::NAN
|
||||
343 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:338:21
|
||||
|
|
||||
338 | let _ = if true {
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
339 | |
|
||||
340 | | std::f32::NAN
|
||||
341 | | } else {
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:360:10
|
||||
|
|
||||
360 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
361 | | try!(Ok("foo"));
|
||||
362 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:356:13
|
||||
|
|
||||
356 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
357 | |
|
||||
358 | | try!(Ok("foo"));
|
||||
359 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/copies.rs:373:10
|
||||
|
|
||||
373 | else {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
374 | | let foo = "";
|
||||
375 | | return Ok(&foo[0..]);
|
||||
376 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/copies.rs:364:13
|
||||
|
|
||||
364 | if true {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
365 | |
|
||||
366 | | let foo = "";
|
||||
367 | | return Ok(&foo[0..]);
|
||||
368 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this `if` has the same condition as a previous if
|
||||
--> $DIR/copies.rs:388:13
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: the function has a cyclomatic complexity of 28
|
||||
--> $DIR/cyclomatic_complexity.rs:7:1
|
||||
|
|
||||
7 | fn main() {
|
||||
| _^ starting here...
|
||||
7 | / fn main() {
|
||||
8 | | if true {
|
||||
9 | | println!("a");
|
||||
10 | | }
|
||||
... |
|
||||
88 | | }
|
||||
89 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cyclomatic_complexity.rs:4:9
|
||||
@ -21,52 +20,48 @@ note: lint level defined here
|
||||
error: the function has a cyclomatic complexity of 7
|
||||
--> $DIR/cyclomatic_complexity.rs:92:1
|
||||
|
|
||||
92 | fn kaboom() {
|
||||
| _^ starting here...
|
||||
92 | / fn kaboom() {
|
||||
93 | | let n = 0;
|
||||
94 | | 'a: for i in 0..20 {
|
||||
95 | | 'b: for j in i..20 {
|
||||
... |
|
||||
110 | | }
|
||||
111 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:138:1
|
||||
|
|
||||
138 | fn lots_of_short_circuits() -> bool {
|
||||
| _^ starting here...
|
||||
138 | / fn lots_of_short_circuits() -> bool {
|
||||
139 | | true && false && true && false && true && false && true
|
||||
140 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:143:1
|
||||
|
|
||||
143 | fn lots_of_short_circuits2() -> bool {
|
||||
| _^ starting here...
|
||||
143 | / fn lots_of_short_circuits2() -> bool {
|
||||
144 | | true || false || true || false || true || false || true
|
||||
145 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:148:1
|
||||
|
|
||||
148 | fn baa() {
|
||||
| _^ starting here...
|
||||
148 | / fn baa() {
|
||||
149 | | let x = || match 99 {
|
||||
150 | | 0 => 0,
|
||||
151 | | 1 => 1,
|
||||
... |
|
||||
162 | | }
|
||||
163 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
@ -74,221 +69,207 @@ error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:149:13
|
||||
|
|
||||
149 | let x = || match 99 {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
150 | | 0 => 0,
|
||||
151 | | 1 => 1,
|
||||
152 | | 2 => 2,
|
||||
... |
|
||||
156 | | _ => 42,
|
||||
157 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:166:1
|
||||
|
|
||||
166 | fn bar() {
|
||||
| _^ starting here...
|
||||
166 | / fn bar() {
|
||||
167 | | match 99 {
|
||||
168 | | 0 => println!("hi"),
|
||||
169 | | _ => println!("bye"),
|
||||
170 | | }
|
||||
171 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:185:1
|
||||
|
|
||||
185 | fn barr() {
|
||||
| _^ starting here...
|
||||
185 | / fn barr() {
|
||||
186 | | match 99 {
|
||||
187 | | 0 => println!("hi"),
|
||||
188 | | 1 => println!("bla"),
|
||||
... |
|
||||
191 | | }
|
||||
192 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:195:1
|
||||
|
|
||||
195 | fn barr2() {
|
||||
| _^ starting here...
|
||||
195 | / fn barr2() {
|
||||
196 | | match 99 {
|
||||
197 | | 0 => println!("hi"),
|
||||
198 | | 1 => println!("bla"),
|
||||
... |
|
||||
207 | | }
|
||||
208 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:211:1
|
||||
|
|
||||
211 | fn barrr() {
|
||||
| _^ starting here...
|
||||
211 | / fn barrr() {
|
||||
212 | | match 99 {
|
||||
213 | | 0 => println!("hi"),
|
||||
214 | | 1 => panic!("bla"),
|
||||
... |
|
||||
217 | | }
|
||||
218 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:221:1
|
||||
|
|
||||
221 | fn barrr2() {
|
||||
| _^ starting here...
|
||||
221 | / fn barrr2() {
|
||||
222 | | match 99 {
|
||||
223 | | 0 => println!("hi"),
|
||||
224 | | 1 => panic!("bla"),
|
||||
... |
|
||||
233 | | }
|
||||
234 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:237:1
|
||||
|
|
||||
237 | fn barrrr() {
|
||||
| _^ starting here...
|
||||
237 | / fn barrrr() {
|
||||
238 | | match 99 {
|
||||
239 | | 0 => println!("hi"),
|
||||
240 | | 1 => println!("bla"),
|
||||
... |
|
||||
243 | | }
|
||||
244 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity.rs:247:1
|
||||
|
|
||||
247 | fn barrrr2() {
|
||||
| _^ starting here...
|
||||
247 | / fn barrrr2() {
|
||||
248 | | match 99 {
|
||||
249 | | 0 => println!("hi"),
|
||||
250 | | 1 => println!("bla"),
|
||||
... |
|
||||
259 | | }
|
||||
260 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 2
|
||||
--> $DIR/cyclomatic_complexity.rs:263:1
|
||||
|
|
||||
263 | fn cake() {
|
||||
| _^ starting here...
|
||||
263 | / fn cake() {
|
||||
264 | | if 4 == 5 {
|
||||
265 | | println!("yea");
|
||||
266 | | } else {
|
||||
... |
|
||||
269 | | println!("whee");
|
||||
270 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 4
|
||||
--> $DIR/cyclomatic_complexity.rs:274:1
|
||||
|
|
||||
274 | pub fn read_file(input_path: &str) -> String {
|
||||
| _^ starting here...
|
||||
274 | / pub fn read_file(input_path: &str) -> String {
|
||||
275 | | use std::fs::File;
|
||||
276 | | use std::io::{Read, Write};
|
||||
277 | | use std::path::Path;
|
||||
... |
|
||||
299 | | }
|
||||
300 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:305:1
|
||||
|
|
||||
305 | fn void(void: Void) {
|
||||
| _^ starting here...
|
||||
305 | / fn void(void: Void) {
|
||||
306 | | if true {
|
||||
307 | | match void {
|
||||
308 | | }
|
||||
309 | | }
|
||||
310 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:319:1
|
||||
|
|
||||
319 | fn try() -> Result<i32, &'static str> {
|
||||
| _^ starting here...
|
||||
319 | / fn try() -> Result<i32, &'static str> {
|
||||
320 | | match 5 {
|
||||
321 | | 5 => Ok(5),
|
||||
322 | | _ => return Err("bla"),
|
||||
323 | | }
|
||||
324 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:327:1
|
||||
|
|
||||
327 | fn try_again() -> Result<i32, &'static str> {
|
||||
| _^ starting here...
|
||||
327 | / fn try_again() -> Result<i32, &'static str> {
|
||||
328 | | let _ = try!(Ok(42));
|
||||
329 | | let _ = try!(Ok(43));
|
||||
330 | | let _ = try!(Ok(44));
|
||||
... |
|
||||
339 | | }
|
||||
340 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 1
|
||||
--> $DIR/cyclomatic_complexity.rs:343:1
|
||||
|
|
||||
343 | fn early() -> Result<i32, &'static str> {
|
||||
| _^ starting here...
|
||||
343 | / fn early() -> Result<i32, &'static str> {
|
||||
344 | | return Ok(5);
|
||||
345 | | return Ok(5);
|
||||
346 | | return Ok(5);
|
||||
... |
|
||||
352 | | return Ok(5);
|
||||
353 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
error: the function has a cyclomatic complexity of 8
|
||||
--> $DIR/cyclomatic_complexity.rs:356:1
|
||||
|
|
||||
356 | fn early_ret() -> i32 {
|
||||
| _^ starting here...
|
||||
356 | / fn early_ret() -> i32 {
|
||||
357 | | let a = if true { 42 } else { return 0; };
|
||||
358 | | let a = if a < 99 { 42 } else { return 0; };
|
||||
359 | | let a = if a < 99 { 42 } else { return 0; };
|
||||
... |
|
||||
372 | | }
|
||||
373 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: the function has a cyclomatic complexity of 3
|
||||
--> $DIR/cyclomatic_complexity_attr_used.rs:11:1
|
||||
|
|
||||
11 | fn kaboom() {
|
||||
| _^ starting here...
|
||||
11 | / fn kaboom() {
|
||||
12 | | if 42 == 43 {
|
||||
13 | | panic!();
|
||||
14 | | } else if "cake" == "lie" {
|
||||
15 | | println!("what?");
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/cyclomatic_complexity_attr_used.rs:3:9
|
||||
|
@ -13,11 +13,10 @@ note: lint level defined here
|
||||
note: `PartialEq` implemented here
|
||||
--> $DIR/derive.rs:22:1
|
||||
|
|
||||
22 | impl PartialEq for Bar {
|
||||
| _^ starting here...
|
||||
22 | / impl PartialEq for Bar {
|
||||
23 | | fn eq(&self, _: &Bar) -> bool { true }
|
||||
24 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
||||
--> $DIR/derive.rs:26:10
|
||||
@ -29,21 +28,19 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
||||
note: `PartialEq` implemented here
|
||||
--> $DIR/derive.rs:30:1
|
||||
|
|
||||
30 | impl PartialEq<Baz> for Baz {
|
||||
| _^ starting here...
|
||||
30 | / impl PartialEq<Baz> for Baz {
|
||||
31 | | fn eq(&self, _: &Baz) -> bool { true }
|
||||
32 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: you are implementing `Hash` explicitly but have derived `PartialEq`
|
||||
--> $DIR/derive.rs:37:1
|
||||
|
|
||||
37 | impl Hash for Bah {
|
||||
| _^ starting here...
|
||||
37 | / impl Hash for Bah {
|
||||
38 | |
|
||||
39 | | fn hash<H: Hasher>(&self, _: &mut H) {}
|
||||
40 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(derive_hash_xor_eq)] implied by #[deny(warnings)]
|
||||
note: `PartialEq` implemented here
|
||||
@ -55,12 +52,11 @@ note: `PartialEq` implemented here
|
||||
error: you are implementing `Clone` explicitly on a `Copy` type
|
||||
--> $DIR/derive.rs:45:1
|
||||
|
|
||||
45 | impl Clone for Qux {
|
||||
| _^ starting here...
|
||||
45 | / impl Clone for Qux {
|
||||
46 | |
|
||||
47 | | fn clone(&self) -> Self { Qux }
|
||||
48 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(expl_impl_clone_on_copy)] implied by #[deny(warnings)]
|
||||
note: lint level defined here
|
||||
@ -71,33 +67,30 @@ note: lint level defined here
|
||||
note: consider deriving `Clone` or removing `Copy`
|
||||
--> $DIR/derive.rs:45:1
|
||||
|
|
||||
45 | impl Clone for Qux {
|
||||
| _^ starting here...
|
||||
45 | / impl Clone for Qux {
|
||||
46 | |
|
||||
47 | | fn clone(&self) -> Self { Qux }
|
||||
48 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: you are implementing `Clone` explicitly on a `Copy` type
|
||||
--> $DIR/derive.rs:70:1
|
||||
|
|
||||
70 | impl<'a> Clone for Lt<'a> {
|
||||
| _^ starting here...
|
||||
70 | / impl<'a> Clone for Lt<'a> {
|
||||
71 | |
|
||||
72 | | fn clone(&self) -> Self { unimplemented!() }
|
||||
73 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(expl_impl_clone_on_copy)] implied by #[deny(warnings)]
|
||||
note: consider deriving `Clone` or removing `Copy`
|
||||
--> $DIR/derive.rs:70:1
|
||||
|
|
||||
70 | impl<'a> Clone for Lt<'a> {
|
||||
| _^ starting here...
|
||||
70 | / impl<'a> Clone for Lt<'a> {
|
||||
71 | |
|
||||
72 | | fn clone(&self) -> Self { unimplemented!() }
|
||||
73 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -38,13 +38,12 @@ error: Variant name starts with the enum's name
|
||||
error: All variants have the same prefix: `Food`
|
||||
--> $DIR/enum_variants.rs:24:1
|
||||
|
|
||||
24 | enum Food {
|
||||
| _^ starting here...
|
||||
24 | / enum Food {
|
||||
25 | | FoodGood,
|
||||
26 | | FoodMiddle,
|
||||
27 | | FoodBad,
|
||||
28 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
@ -52,13 +51,12 @@ error: All variants have the same prefix: `Food`
|
||||
error: All variants have the same prefix: `CallType`
|
||||
--> $DIR/enum_variants.rs:34:1
|
||||
|
|
||||
34 | enum BadCallType {
|
||||
| _^ starting here...
|
||||
34 | / enum BadCallType {
|
||||
35 | | CallTypeCall,
|
||||
36 | | CallTypeCreate,
|
||||
37 | | CallTypeDestroy,
|
||||
38 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
@ -66,13 +64,12 @@ error: All variants have the same prefix: `CallType`
|
||||
error: All variants have the same prefix: `Constant`
|
||||
--> $DIR/enum_variants.rs:45:1
|
||||
|
|
||||
45 | enum Consts {
|
||||
| _^ starting here...
|
||||
45 | / enum Consts {
|
||||
46 | | ConstantInt,
|
||||
47 | | ConstantCake,
|
||||
48 | | ConstantLie,
|
||||
49 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
@ -80,13 +77,12 @@ error: All variants have the same prefix: `Constant`
|
||||
error: All variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:78:1
|
||||
|
|
||||
78 | enum Seallll {
|
||||
| _^ starting here...
|
||||
78 | / enum Seallll {
|
||||
79 | | WithOutCake,
|
||||
80 | | WithOutTea,
|
||||
81 | | WithOut,
|
||||
82 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
@ -94,13 +90,12 @@ error: All variants have the same prefix: `With`
|
||||
error: All variants have the same prefix: `Prefix`
|
||||
--> $DIR/enum_variants.rs:84:1
|
||||
|
|
||||
84 | enum NonCaps {
|
||||
| _^ starting here...
|
||||
84 | / enum NonCaps {
|
||||
85 | | Prefix的,
|
||||
86 | | PrefixTea,
|
||||
87 | | PrefixCake,
|
||||
88 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(enum_variant_names)] implied by #[deny(clippy)]
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
@ -108,13 +103,12 @@ error: All variants have the same prefix: `Prefix`
|
||||
error: All variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:90:1
|
||||
|
|
||||
90 | pub enum PubSeall {
|
||||
| _^ starting here...
|
||||
90 | / pub enum PubSeall {
|
||||
91 | | WithOutCake,
|
||||
92 | | WithOutTea,
|
||||
93 | | WithOut,
|
||||
94 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/enum_variants.rs:3:17
|
||||
|
@ -2,10 +2,10 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre
|
||||
--> $DIR/filter_methods.rs:8:21
|
||||
|
|
||||
8 | let _: Vec<_> = vec![5; 6].into_iter()
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
9 | | .filter(|&x| x == 0)
|
||||
10 | | .map(|x| x * 2)
|
||||
| |_____________________________________________^ ...ending here
|
||||
| |_____________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
note: lint level defined here
|
||||
@ -18,10 +18,10 @@ error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly
|
||||
--> $DIR/filter_methods.rs:13:21
|
||||
|
|
||||
13 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
14 | | .filter(|&x| x == 0)
|
||||
15 | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________________________________^ ...ending here
|
||||
| |_______________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -29,10 +29,10 @@ error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinc
|
||||
--> $DIR/filter_methods.rs:18:21
|
||||
|
|
||||
18 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
19 | | .filter_map(|x| x.checked_mul(2))
|
||||
20 | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________________________________^ ...ending here
|
||||
| |_______________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -40,10 +40,10 @@ error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly e
|
||||
--> $DIR/filter_methods.rs:23:21
|
||||
|
|
||||
23 | let _: Vec<_> = vec![5_i8; 6].into_iter()
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
24 | | .filter_map(|x| x.checked_mul(2))
|
||||
25 | | .map(|x| x.checked_mul(2))
|
||||
| |__________________________________________________________^ ...ending here
|
||||
| |__________________________________________________________^
|
||||
|
|
||||
= note: #[deny(filter_map)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
|
@ -38,12 +38,11 @@ error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loop.rs:40:5
|
||||
|
|
||||
40 | for x in v.iter().next() {
|
||||
| _____^ starting here...
|
||||
40 | / for x in v.iter().next() {
|
||||
41 | |
|
||||
42 | | println!("{}", x);
|
||||
43 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(iter_next_loop)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -73,15 +72,14 @@ error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:99:5
|
||||
|
|
||||
99 | for i in 0..vec.len() {
|
||||
| _____^ starting here...
|
||||
99 | / for i in 0..vec.len() {
|
||||
100 | |
|
||||
101 | |
|
||||
102 | |
|
||||
103 | |
|
||||
104 | | println!("{}", vec[i]);
|
||||
105 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:90:8
|
||||
@ -111,15 +109,14 @@ help: consider using an iterator
|
||||
error: the loop variable `j` is only used to index `STATIC`.
|
||||
--> $DIR/for_loop.rs:120:5
|
||||
|
|
||||
120 | for j in 0..4 {
|
||||
| _____^ starting here...
|
||||
120 | / for j in 0..4 {
|
||||
121 | |
|
||||
122 | |
|
||||
123 | |
|
||||
124 | |
|
||||
125 | | println!("{:?}", STATIC[j]);
|
||||
126 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in STATIC.iter().take(4) {
|
||||
@ -127,15 +124,14 @@ help: consider using an iterator
|
||||
error: the loop variable `j` is only used to index `CONST`.
|
||||
--> $DIR/for_loop.rs:128:5
|
||||
|
|
||||
128 | for j in 0..4 {
|
||||
| _____^ starting here...
|
||||
128 | / for j in 0..4 {
|
||||
129 | |
|
||||
130 | |
|
||||
131 | |
|
||||
132 | |
|
||||
133 | | println!("{:?}", CONST[j]);
|
||||
134 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in CONST.iter().take(4) {
|
||||
@ -143,15 +139,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:136:5
|
||||
|
|
||||
136 | for i in 0..vec.len() {
|
||||
| _____^ starting here...
|
||||
136 | / for i in 0..vec.len() {
|
||||
137 | |
|
||||
138 | |
|
||||
139 | |
|
||||
140 | |
|
||||
141 | | println!("{} {}", vec[i], i);
|
||||
142 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate() {
|
||||
@ -159,15 +154,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec2`.
|
||||
--> $DIR/for_loop.rs:147:5
|
||||
|
|
||||
147 | for i in 0..vec.len() {
|
||||
| _____^ starting here...
|
||||
147 | / for i in 0..vec.len() {
|
||||
148 | |
|
||||
149 | |
|
||||
150 | |
|
||||
151 | |
|
||||
152 | | println!("{}", vec2[i]);
|
||||
153 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec2.iter().take(vec.len()) {
|
||||
@ -175,15 +169,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:155:5
|
||||
|
|
||||
155 | for i in 5..vec.len() {
|
||||
| _____^ starting here...
|
||||
155 | / for i in 5..vec.len() {
|
||||
156 | |
|
||||
157 | |
|
||||
158 | |
|
||||
159 | |
|
||||
160 | | println!("{}", vec[i]);
|
||||
161 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().skip(5) {
|
||||
@ -191,15 +184,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:163:5
|
||||
|
|
||||
163 | for i in 0..MAX_LEN {
|
||||
| _____^ starting here...
|
||||
163 | / for i in 0..MAX_LEN {
|
||||
164 | |
|
||||
165 | |
|
||||
166 | |
|
||||
167 | |
|
||||
168 | | println!("{}", vec[i]);
|
||||
169 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(MAX_LEN) {
|
||||
@ -207,15 +199,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:171:5
|
||||
|
|
||||
171 | for i in 0...MAX_LEN {
|
||||
| _____^ starting here...
|
||||
171 | / for i in 0...MAX_LEN {
|
||||
172 | |
|
||||
173 | |
|
||||
174 | |
|
||||
175 | |
|
||||
176 | | println!("{}", vec[i]);
|
||||
177 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(MAX_LEN + 1) {
|
||||
@ -223,15 +214,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:179:5
|
||||
|
|
||||
179 | for i in 5..10 {
|
||||
| _____^ starting here...
|
||||
179 | / for i in 5..10 {
|
||||
180 | |
|
||||
181 | |
|
||||
182 | |
|
||||
183 | |
|
||||
184 | | println!("{}", vec[i]);
|
||||
185 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(10).skip(5) {
|
||||
@ -239,15 +229,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is only used to index `vec`.
|
||||
--> $DIR/for_loop.rs:187:5
|
||||
|
|
||||
187 | for i in 5...10 {
|
||||
| _____^ starting here...
|
||||
187 | / for i in 5...10 {
|
||||
188 | |
|
||||
189 | |
|
||||
190 | |
|
||||
191 | |
|
||||
192 | | println!("{}", vec[i]);
|
||||
193 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for <item> in vec.iter().take(10 + 1).skip(5) {
|
||||
@ -255,15 +244,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:195:5
|
||||
|
|
||||
195 | for i in 5..vec.len() {
|
||||
| _____^ starting here...
|
||||
195 | / for i in 5..vec.len() {
|
||||
196 | |
|
||||
197 | |
|
||||
198 | |
|
||||
199 | |
|
||||
200 | | println!("{} {}", vec[i], i);
|
||||
201 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate().skip(5) {
|
||||
@ -271,15 +259,14 @@ help: consider using an iterator
|
||||
error: the loop variable `i` is used to index `vec`
|
||||
--> $DIR/for_loop.rs:203:5
|
||||
|
|
||||
203 | for i in 5..10 {
|
||||
| _____^ starting here...
|
||||
203 | / for i in 5..10 {
|
||||
204 | |
|
||||
205 | |
|
||||
206 | |
|
||||
207 | |
|
||||
208 | | println!("{} {}", vec[i], i);
|
||||
209 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using an iterator
|
||||
| for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
|
||||
@ -287,14 +274,13 @@ help: consider using an iterator
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:211:5
|
||||
|
|
||||
211 | for i in 10..0 {
|
||||
| _____^ starting here...
|
||||
211 | / for i in 10..0 {
|
||||
212 | |
|
||||
213 | |
|
||||
214 | |
|
||||
215 | | println!("{}", i);
|
||||
216 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:90:90
|
||||
@ -307,14 +293,13 @@ help: consider using the following if you are attempting to iterate over this ra
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:218:5
|
||||
|
|
||||
218 | for i in 10...0 {
|
||||
| _____^ starting here...
|
||||
218 | / for i in 10...0 {
|
||||
219 | |
|
||||
220 | |
|
||||
221 | |
|
||||
222 | | println!("{}", i);
|
||||
223 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (0...10).rev() {
|
||||
@ -322,13 +307,12 @@ help: consider using the following if you are attempting to iterate over this ra
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:225:5
|
||||
|
|
||||
225 | for i in MAX_LEN..0 {
|
||||
| _____^ starting here...
|
||||
225 | / for i in MAX_LEN..0 {
|
||||
226 | |
|
||||
227 | |
|
||||
228 | | println!("{}", i);
|
||||
229 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (0..MAX_LEN).rev() {
|
||||
@ -336,23 +320,21 @@ help: consider using the following if you are attempting to iterate over this ra
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:231:5
|
||||
|
|
||||
231 | for i in 5..5 {
|
||||
| _____^ starting here...
|
||||
231 | / for i in 5..5 {
|
||||
232 | | println!("{}", i);
|
||||
233 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:252:5
|
||||
|
|
||||
252 | for i in 10..5+4 {
|
||||
| _____^ starting here...
|
||||
252 | / for i in 10..5+4 {
|
||||
253 | |
|
||||
254 | |
|
||||
255 | |
|
||||
256 | | println!("{}", i);
|
||||
257 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in (5+4..10).rev() {
|
||||
@ -360,14 +342,13 @@ help: consider using the following if you are attempting to iterate over this ra
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:259:5
|
||||
|
|
||||
259 | for i in (5+2)..(3-1) {
|
||||
| _____^ starting here...
|
||||
259 | / for i in (5+2)..(3-1) {
|
||||
260 | |
|
||||
261 | |
|
||||
262 | |
|
||||
263 | | println!("{}", i);
|
||||
264 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: consider using the following if you are attempting to iterate over this range in reverse
|
||||
| for i in ((3-1)..(5+2)).rev() {
|
||||
@ -375,11 +356,10 @@ help: consider using the following if you are attempting to iterate over this ra
|
||||
error: this range is empty so this for loop will never run
|
||||
--> $DIR/for_loop.rs:266:5
|
||||
|
|
||||
266 | for i in (5+2)..(8-1) {
|
||||
| _____^ starting here...
|
||||
266 | / for i in (5+2)..(8-1) {
|
||||
267 | | println!("{}", i);
|
||||
268 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
||||
--> $DIR/for_loop.rs:289:15
|
||||
@ -553,15 +533,14 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:444:5
|
||||
|
|
||||
444 | for (_, v) in &m {
|
||||
| _____^ starting here...
|
||||
444 | / for (_, v) in &m {
|
||||
445 | |
|
||||
446 | |
|
||||
447 | |
|
||||
448 | |
|
||||
449 | | let _v = v;
|
||||
450 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/for_loop.rs:90:133
|
||||
@ -574,15 +553,14 @@ help: use the corresponding method
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:453:5
|
||||
|
|
||||
453 | for (_, v) in &*m {
|
||||
| _____^ starting here...
|
||||
453 | / for (_, v) in &*m {
|
||||
454 | |
|
||||
455 | |
|
||||
456 | |
|
||||
... |
|
||||
460 | | // `in *m.values()` as we used to
|
||||
461 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: use the corresponding method
|
||||
| for v in (*m).values() {
|
||||
@ -590,15 +568,14 @@ help: use the corresponding method
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:464:5
|
||||
|
|
||||
464 | for (_, v) in &mut m {
|
||||
| _____^ starting here...
|
||||
464 | / for (_, v) in &mut m {
|
||||
465 | |
|
||||
466 | |
|
||||
467 | |
|
||||
468 | |
|
||||
469 | | let _v = v;
|
||||
470 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: use the corresponding method
|
||||
| for v in m.values_mut() {
|
||||
@ -606,15 +583,14 @@ help: use the corresponding method
|
||||
error: you seem to want to iterate on a map's values
|
||||
--> $DIR/for_loop.rs:473:5
|
||||
|
|
||||
473 | for (_, v) in &mut *m {
|
||||
| _____^ starting here...
|
||||
473 | / for (_, v) in &mut *m {
|
||||
474 | |
|
||||
475 | |
|
||||
476 | |
|
||||
477 | |
|
||||
478 | | let _v = v;
|
||||
479 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: use the corresponding method
|
||||
| for v in (*m).values_mut() {
|
||||
@ -622,15 +598,14 @@ help: use the corresponding method
|
||||
error: you seem to want to iterate on a map's keys
|
||||
--> $DIR/for_loop.rs:483:5
|
||||
|
|
||||
483 | for (k, _value) in rm {
|
||||
| _____^ starting here...
|
||||
483 | / for (k, _value) in rm {
|
||||
484 | |
|
||||
485 | |
|
||||
486 | |
|
||||
487 | |
|
||||
488 | | let _k = k;
|
||||
489 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: use the corresponding method
|
||||
| for k in rm.keys() {
|
||||
|
@ -34,11 +34,11 @@ error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/formatting.rs:45:6
|
||||
|
|
||||
45 | } else
|
||||
| ______^ starting here...
|
||||
| ______^
|
||||
46 | |
|
||||
47 | |
|
||||
48 | | if foo() { // the span of the above error should continue here
|
||||
| |____^ ...ending here
|
||||
| |____^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
@ -47,12 +47,12 @@ error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/formatting.rs:52:6
|
||||
|
|
||||
52 | }
|
||||
| ______^ starting here...
|
||||
| ______^
|
||||
53 | |
|
||||
54 | |
|
||||
55 | | else
|
||||
56 | | if foo() { // the span of the above error should continue here
|
||||
| |____^ ...ending here
|
||||
| |____^
|
||||
|
|
||||
= note: #[deny(suspicious_else_formatting)] implied by #[deny(clippy)]
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: this function has too many arguments (8/7)
|
||||
--> $DIR/functions.rs:11:1
|
||||
|
|
||||
11 | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
|
||||
| _^ starting here...
|
||||
11 | / fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
|
||||
12 | |
|
||||
13 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
= note: #[deny(too_many_arguments)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
|
@ -1,13 +1,12 @@
|
||||
error: Unnecessary boolean `not` operation
|
||||
--> $DIR/if_not_else.rs:9:5
|
||||
|
|
||||
9 | if !bla() {
|
||||
| _____^ starting here...
|
||||
9 | / if !bla() {
|
||||
10 | | println!("Bugs");
|
||||
11 | | } else {
|
||||
12 | | println!("Bunny");
|
||||
13 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/if_not_else.rs:4:9
|
||||
@ -19,13 +18,12 @@ note: lint level defined here
|
||||
error: Unnecessary `!=` operation
|
||||
--> $DIR/if_not_else.rs:14:5
|
||||
|
|
||||
14 | if 4 != 5 {
|
||||
| _____^ starting here...
|
||||
14 | / if 4 != 5 {
|
||||
15 | | println!("Bugs");
|
||||
16 | | } else {
|
||||
17 | | println!("Bunny");
|
||||
18 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= help: change to `==` and swap the blocks of the if/else
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
error: item `PubOne` has a public `len` method but no corresponding `is_empty` method
|
||||
--> $DIR/len_zero.rs:9:1
|
||||
|
|
||||
9 | impl PubOne {
|
||||
| _^ starting here...
|
||||
9 | / impl PubOne {
|
||||
10 | | pub fn len(self: &Self) -> isize {
|
||||
11 | | 1
|
||||
12 | | }
|
||||
13 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/len_zero.rs:4:9
|
||||
@ -18,37 +17,34 @@ note: lint level defined here
|
||||
error: trait `PubTraitsToo` has a `len` method but no `is_empty` method
|
||||
--> $DIR/len_zero.rs:55:1
|
||||
|
|
||||
55 | pub trait PubTraitsToo {
|
||||
| _^ starting here...
|
||||
55 | / pub trait PubTraitsToo {
|
||||
56 | | fn len(self: &Self) -> isize;
|
||||
57 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method
|
||||
--> $DIR/len_zero.rs:89:1
|
||||
|
|
||||
89 | impl HasIsEmpty {
|
||||
| _^ starting here...
|
||||
89 | / impl HasIsEmpty {
|
||||
90 | | pub fn len(self: &Self) -> isize {
|
||||
91 | | 1
|
||||
92 | | }
|
||||
... |
|
||||
96 | | }
|
||||
97 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is_empty` method
|
||||
--> $DIR/len_zero.rs:118:1
|
||||
|
|
||||
118 | impl HasWrongIsEmpty {
|
||||
| _^ starting here...
|
||||
118 | / impl HasWrongIsEmpty {
|
||||
119 | | pub fn len(self: &Self) -> isize {
|
||||
120 | | 1
|
||||
121 | | }
|
||||
... |
|
||||
125 | | }
|
||||
126 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: length comparison to zero
|
||||
--> $DIR/len_zero.rs:130:8
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: `if _ { .. } else { .. }` is an expression
|
||||
--> $DIR/let_if_seq.rs:57:5
|
||||
|
|
||||
57 | let mut foo = 0;
|
||||
| _____^ starting here...
|
||||
57 | / let mut foo = 0;
|
||||
58 | |
|
||||
59 | |
|
||||
60 | |
|
||||
61 | | if f() {
|
||||
62 | | foo = 42;
|
||||
63 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/let_if_seq.rs:5:9
|
||||
@ -23,15 +22,14 @@ help: it is more idiomatic to write
|
||||
error: `if _ { .. } else { .. }` is an expression
|
||||
--> $DIR/let_if_seq.rs:65:5
|
||||
|
|
||||
65 | let mut bar = 0;
|
||||
| _____^ starting here...
|
||||
65 | / let mut bar = 0;
|
||||
66 | |
|
||||
67 | |
|
||||
68 | |
|
||||
... |
|
||||
74 | | f();
|
||||
75 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: it is more idiomatic to write
|
||||
| let <mut> bar = if f() { ..; 42 } else { ..; 0 };
|
||||
@ -40,15 +38,14 @@ help: it is more idiomatic to write
|
||||
error: `if _ { .. } else { .. }` is an expression
|
||||
--> $DIR/let_if_seq.rs:77:5
|
||||
|
|
||||
77 | let quz;
|
||||
| _____^ starting here...
|
||||
77 | / let quz;
|
||||
78 | |
|
||||
79 | |
|
||||
80 | |
|
||||
... |
|
||||
85 | | quz = 0;
|
||||
86 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: it is more idiomatic to write
|
||||
| let quz = if f() { 42 } else { 0 };
|
||||
@ -56,15 +53,14 @@ help: it is more idiomatic to write
|
||||
error: `if _ { .. } else { .. }` is an expression
|
||||
--> $DIR/let_if_seq.rs:111:5
|
||||
|
|
||||
111 | let mut baz = 0;
|
||||
| _____^ starting here...
|
||||
111 | / let mut baz = 0;
|
||||
112 | |
|
||||
113 | |
|
||||
114 | |
|
||||
115 | | if f() {
|
||||
116 | | baz = 42;
|
||||
117 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: it is more idiomatic to write
|
||||
| let <mut> baz = if f() { 42 } else { 0 };
|
||||
|
@ -43,11 +43,10 @@ error: explicit lifetimes given in parameter types where they could be elided
|
||||
error: explicit lifetimes given in parameter types where they could be elided
|
||||
--> $DIR/lifetimes.rs:58:1
|
||||
|
|
||||
58 | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
|
||||
| _^ starting here...
|
||||
58 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
|
||||
59 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I>
|
||||
60 | | { unreachable!() }
|
||||
| |__________________^ ...ending here
|
||||
| |__________________^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided
|
||||
--> $DIR/lifetimes.rs:67:5
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:26:5
|
||||
|
|
||||
26 | match ExprNode::Butterflies {
|
||||
| _____^ starting here...
|
||||
26 | / match ExprNode::Butterflies {
|
||||
27 | |
|
||||
28 | |
|
||||
29 | |
|
||||
30 | | ExprNode::ExprAddrOf => Some(&NODE),
|
||||
31 | | _ => { let x = 5; None },
|
||||
32 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/matches.rs:7:9
|
||||
@ -22,15 +21,14 @@ help: try this
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:38:5
|
||||
|
|
||||
38 | match x {
|
||||
| _____^ starting here...
|
||||
38 | / match x {
|
||||
39 | |
|
||||
40 | |
|
||||
41 | |
|
||||
42 | | Some(y) => { println!("{:?}", y); }
|
||||
43 | | _ => ()
|
||||
44 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(single_match)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -44,15 +42,14 @@ help: try this
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:47:5
|
||||
|
|
||||
47 | match z {
|
||||
| _____^ starting here...
|
||||
47 | / match z {
|
||||
48 | |
|
||||
49 | |
|
||||
50 | |
|
||||
51 | | (2...3, 7...9) => dummy(),
|
||||
52 | | _ => {}
|
||||
53 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(single_match)] implied by #[deny(clippy)]
|
||||
help: try this
|
||||
@ -61,15 +58,14 @@ help: try this
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:72:5
|
||||
|
|
||||
72 | match x {
|
||||
| _____^ starting here...
|
||||
72 | / match x {
|
||||
73 | |
|
||||
74 | |
|
||||
75 | |
|
||||
76 | | Some(y) => dummy(),
|
||||
77 | | None => ()
|
||||
78 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(single_match)] implied by #[deny(clippy)]
|
||||
help: try this
|
||||
@ -78,15 +74,14 @@ help: try this
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:80:5
|
||||
|
|
||||
80 | match y {
|
||||
| _____^ starting here...
|
||||
80 | / match y {
|
||||
81 | |
|
||||
82 | |
|
||||
83 | |
|
||||
84 | | Ok(y) => dummy(),
|
||||
85 | | Err(..) => ()
|
||||
86 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(single_match)] implied by #[deny(clippy)]
|
||||
help: try this
|
||||
@ -95,15 +90,14 @@ help: try this
|
||||
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
||||
--> $DIR/matches.rs:90:5
|
||||
|
|
||||
90 | match c {
|
||||
| _____^ starting here...
|
||||
90 | / match c {
|
||||
91 | |
|
||||
92 | |
|
||||
93 | |
|
||||
94 | | Cow::Borrowed(..) => dummy(),
|
||||
95 | | Cow::Owned(..) => (),
|
||||
96 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(single_match)] implied by #[deny(clippy)]
|
||||
help: try this
|
||||
@ -112,15 +106,14 @@ help: try this
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:114:5
|
||||
|
|
||||
114 | match test {
|
||||
| _____^ starting here...
|
||||
114 | / match test {
|
||||
115 | |
|
||||
116 | |
|
||||
117 | |
|
||||
118 | | true => 0,
|
||||
119 | | false => 42,
|
||||
120 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -134,15 +127,14 @@ help: consider using an if/else expression
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:123:5
|
||||
|
|
||||
123 | match option == 1 {
|
||||
| _____^ starting here...
|
||||
123 | / match option == 1 {
|
||||
124 | |
|
||||
125 | |
|
||||
126 | |
|
||||
127 | | true => 1,
|
||||
128 | | false => 0,
|
||||
129 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
help: consider using an if/else expression
|
||||
@ -151,15 +143,14 @@ help: consider using an if/else expression
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:131:5
|
||||
|
|
||||
131 | match test {
|
||||
| _____^ starting here...
|
||||
131 | / match test {
|
||||
132 | |
|
||||
133 | |
|
||||
134 | |
|
||||
135 | | true => (),
|
||||
136 | | false => { println!("Noooo!"); }
|
||||
137 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
help: consider using an if/else expression
|
||||
@ -168,15 +159,14 @@ help: consider using an if/else expression
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:139:5
|
||||
|
|
||||
139 | match test {
|
||||
| _____^ starting here...
|
||||
139 | / match test {
|
||||
140 | |
|
||||
141 | |
|
||||
142 | |
|
||||
143 | | false => { println!("Noooo!"); }
|
||||
144 | | _ => (),
|
||||
145 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
help: consider using an if/else expression
|
||||
@ -185,15 +175,14 @@ help: consider using an if/else expression
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:147:5
|
||||
|
|
||||
147 | match test && test {
|
||||
| _____^ starting here...
|
||||
147 | / match test && test {
|
||||
148 | |
|
||||
149 | |
|
||||
150 | |
|
||||
... |
|
||||
153 | | _ => (),
|
||||
154 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
help: consider using an if/else expression
|
||||
@ -215,15 +204,14 @@ note: lint level defined here
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/matches.rs:156:5
|
||||
|
|
||||
156 | match test {
|
||||
| _____^ starting here...
|
||||
156 | / match test {
|
||||
157 | |
|
||||
158 | |
|
||||
159 | |
|
||||
160 | | false => { println!("Noooo!"); }
|
||||
161 | | true => { println!("Yes!"); }
|
||||
162 | | };
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_bool)] implied by #[deny(clippy)]
|
||||
help: consider using an if/else expression
|
||||
@ -232,15 +220,14 @@ help: consider using an if/else expression
|
||||
error: you don't need to add `&` to all patterns
|
||||
--> $DIR/matches.rs:175:9
|
||||
|
|
||||
175 | match v {
|
||||
| _________^ starting here...
|
||||
175 | / match v {
|
||||
176 | |
|
||||
177 | |
|
||||
178 | |
|
||||
179 | | &Some(v) => println!("{:?}", v),
|
||||
180 | | &None => println!("none"),
|
||||
181 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
= note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -254,15 +241,14 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres
|
||||
error: you don't need to add `&` to all patterns
|
||||
--> $DIR/matches.rs:188:5
|
||||
|
|
||||
188 | match tup {
|
||||
| _____^ starting here...
|
||||
188 | / match tup {
|
||||
189 | |
|
||||
190 | |
|
||||
191 | |
|
||||
192 | | &(v, 1) => println!("{}", v),
|
||||
193 | | _ => println!("none"),
|
||||
194 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
|
||||
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
||||
@ -271,15 +257,14 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres
|
||||
error: you don't need to add `&` to both the expression and the patterns
|
||||
--> $DIR/matches.rs:197:5
|
||||
|
|
||||
197 | match &w {
|
||||
| _____^ starting here...
|
||||
197 | / match &w {
|
||||
198 | |
|
||||
199 | |
|
||||
200 | |
|
||||
201 | | &Some(v) => println!("{:?}", v),
|
||||
202 | | &None => println!("none"),
|
||||
203 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
@ -288,14 +273,13 @@ help: try
|
||||
error: you don't need to add `&` to all patterns
|
||||
--> $DIR/matches.rs:211:5
|
||||
|
|
||||
211 | if let &None = a {
|
||||
| _____^ starting here...
|
||||
211 | / if let &None = a {
|
||||
212 | |
|
||||
213 | |
|
||||
214 | |
|
||||
215 | | println!("none");
|
||||
216 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
|
||||
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
||||
@ -304,14 +288,13 @@ help: instead of prefixing all patterns with `&`, you can dereference the expres
|
||||
error: you don't need to add `&` to both the expression and the patterns
|
||||
--> $DIR/matches.rs:219:5
|
||||
|
|
||||
219 | if let &None = &b {
|
||||
| _____^ starting here...
|
||||
219 | / if let &None = &b {
|
||||
220 | |
|
||||
221 | |
|
||||
222 | |
|
||||
223 | | println!("none");
|
||||
224 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(match_ref_pats)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
|
@ -65,10 +65,10 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di
|
||||
--> $DIR/methods.rs:99:13
|
||||
|
|
||||
99 | let _ = opt.map(|x| x + 1)
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
100 | |
|
||||
101 | | .unwrap_or(0); // should lint even though this call is on a separate line
|
||||
| |____________________________^ ...ending here
|
||||
| |____________________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)]
|
||||
note: lint level defined here
|
||||
@ -82,11 +82,11 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di
|
||||
--> $DIR/methods.rs:103:13
|
||||
|
|
||||
103 | let _ = opt.map(|x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
104 | | x + 1
|
||||
105 | | }
|
||||
106 | | ).unwrap_or(0);
|
||||
| |____________________________^ ...ending here
|
||||
| |____________________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -94,11 +94,11 @@ error: called `map(f).unwrap_or(a)` on an Option value. This can be done more di
|
||||
--> $DIR/methods.rs:107:13
|
||||
|
|
||||
107 | let _ = opt.map(|x| x + 1)
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
108 | | .unwrap_or({
|
||||
109 | | 0
|
||||
110 | | });
|
||||
| |__________________^ ...ending here
|
||||
| |__________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -106,10 +106,10 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo
|
||||
--> $DIR/methods.rs:116:13
|
||||
|
|
||||
116 | let _ = opt.map(|x| x + 1)
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
117 | |
|
||||
118 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line
|
||||
| |____________________________________^ ...ending here
|
||||
| |____________________________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)]
|
||||
note: lint level defined here
|
||||
@ -123,11 +123,11 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo
|
||||
--> $DIR/methods.rs:120:13
|
||||
|
|
||||
120 | let _ = opt.map(|x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
121 | | x + 1
|
||||
122 | | }
|
||||
123 | | ).unwrap_or_else(|| 0);
|
||||
| |____________________________________^ ...ending here
|
||||
| |____________________________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -135,11 +135,11 @@ error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done mo
|
||||
--> $DIR/methods.rs:124:13
|
||||
|
|
||||
124 | let _ = opt.map(|x| x + 1)
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
125 | | .unwrap_or_else(||
|
||||
126 | | 0
|
||||
127 | | );
|
||||
| |_________________^ ...ending here
|
||||
| |_________________^
|
||||
|
|
||||
= note: #[deny(option_map_unwrap_or_else)] implied by #[deny(clippy_pedantic)]
|
||||
|
||||
@ -161,11 +161,11 @@ error: called `filter(p).next()` on an `Iterator`. This is more succinctly expre
|
||||
--> $DIR/methods.rs:201:13
|
||||
|
|
||||
201 | let _ = v.iter().filter(|&x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
202 | | *x < 0
|
||||
203 | | }
|
||||
204 | | ).next();
|
||||
| |___________________________^ ...ending here
|
||||
| |___________________________^
|
||||
|
|
||||
= note: #[deny(filter_next)] implied by #[deny(clippy)]
|
||||
|
||||
@ -187,11 +187,11 @@ error: called `is_some()` after searching an `Iterator` with find. This is more
|
||||
--> $DIR/methods.rs:221:13
|
||||
|
|
||||
221 | let _ = v.iter().find(|&x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
222 | | *x < 0
|
||||
223 | | }
|
||||
224 | | ).is_some();
|
||||
| |______________________________^ ...ending here
|
||||
| |______________________________^
|
||||
|
|
||||
= note: #[deny(search_is_some)] implied by #[deny(clippy)]
|
||||
|
||||
@ -208,11 +208,11 @@ error: called `is_some()` after searching an `Iterator` with position. This is m
|
||||
--> $DIR/methods.rs:232:13
|
||||
|
|
||||
232 | let _ = v.iter().position(|&x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
233 | | x < 0
|
||||
234 | | }
|
||||
235 | | ).is_some();
|
||||
| |______________________________^ ...ending here
|
||||
| |______________________________^
|
||||
|
|
||||
= note: #[deny(search_is_some)] implied by #[deny(clippy)]
|
||||
|
||||
@ -229,11 +229,11 @@ error: called `is_some()` after searching an `Iterator` with rposition. This is
|
||||
--> $DIR/methods.rs:243:13
|
||||
|
|
||||
243 | let _ = v.iter().rposition(|&x| {
|
||||
| _____________^ starting here...
|
||||
| _____________^
|
||||
244 | | x < 0
|
||||
245 | | }
|
||||
246 | | ).is_some();
|
||||
| |______________________________^ ...ending here
|
||||
| |______________________________^
|
||||
|
|
||||
= note: #[deny(search_is_some)] implied by #[deny(clippy)]
|
||||
|
||||
|
@ -19,12 +19,11 @@ error: missing documentation for a type alias
|
||||
error: missing documentation for a struct
|
||||
--> $DIR/missing-doc.rs:29:1
|
||||
|
|
||||
29 | struct Foo {
|
||||
| _^ starting here...
|
||||
29 | / struct Foo {
|
||||
30 | | a: isize,
|
||||
31 | | b: isize,
|
||||
32 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/missing-doc.rs:30:5
|
||||
@ -41,12 +40,11 @@ error: missing documentation for a struct field
|
||||
error: missing documentation for a struct
|
||||
--> $DIR/missing-doc.rs:34:1
|
||||
|
|
||||
34 | pub struct PubFoo {
|
||||
| _^ starting here...
|
||||
34 | / pub struct PubFoo {
|
||||
35 | | pub a: isize,
|
||||
36 | | b: isize,
|
||||
37 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/missing-doc.rs:35:5
|
||||
@ -87,12 +85,11 @@ error: missing documentation for a function
|
||||
error: missing documentation for a trait
|
||||
--> $DIR/missing-doc.rs:68:1
|
||||
|
|
||||
68 | pub trait C {
|
||||
| _^ starting here...
|
||||
68 | / pub trait C {
|
||||
69 | | fn foo(&self);
|
||||
70 | | fn foo_with_impl(&self) {}
|
||||
71 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a trait method
|
||||
--> $DIR/missing-doc.rs:69:5
|
||||
@ -145,25 +142,23 @@ error: missing documentation for a method
|
||||
error: missing documentation for an enum
|
||||
--> $DIR/missing-doc.rs:126:1
|
||||
|
|
||||
126 | enum Baz {
|
||||
| _^ starting here...
|
||||
126 | / enum Baz {
|
||||
127 | | BazA {
|
||||
128 | | a: isize,
|
||||
129 | | b: isize
|
||||
130 | | },
|
||||
131 | | BarB
|
||||
132 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a variant
|
||||
--> $DIR/missing-doc.rs:127:5
|
||||
|
|
||||
127 | BazA {
|
||||
| _____^ starting here...
|
||||
127 | / BazA {
|
||||
128 | | a: isize,
|
||||
129 | | b: isize
|
||||
130 | | },
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/missing-doc.rs:128:9
|
||||
@ -186,22 +181,20 @@ error: missing documentation for a variant
|
||||
error: missing documentation for an enum
|
||||
--> $DIR/missing-doc.rs:134:1
|
||||
|
|
||||
134 | pub enum PubBaz {
|
||||
| _^ starting here...
|
||||
134 | / pub enum PubBaz {
|
||||
135 | | PubBazA {
|
||||
136 | | a: isize,
|
||||
137 | | },
|
||||
138 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a variant
|
||||
--> $DIR/missing-doc.rs:135:5
|
||||
|
|
||||
135 | PubBazA {
|
||||
| _____^ starting here...
|
||||
135 | / PubBazA {
|
||||
136 | | a: isize,
|
||||
137 | | },
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/missing-doc.rs:136:9
|
||||
@ -236,15 +229,14 @@ error: missing documentation for a static
|
||||
error: missing documentation for a module
|
||||
--> $DIR/missing-doc.rs:180:1
|
||||
|
|
||||
180 | mod internal_impl {
|
||||
| _^ starting here...
|
||||
180 | / mod internal_impl {
|
||||
181 | | /// dox
|
||||
182 | | pub fn documented() {}
|
||||
183 | | pub fn undocumented1() {}
|
||||
... |
|
||||
192 | | }
|
||||
193 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/missing-doc.rs:183:5
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: module has the same name as its containing module
|
||||
--> $DIR/module_inception.rs:7:9
|
||||
|
|
||||
7 | mod bar {
|
||||
| _________^ starting here...
|
||||
7 | / mod bar {
|
||||
8 | | mod foo {}
|
||||
9 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/module_inception.rs:3:9
|
||||
@ -16,11 +15,10 @@ note: lint level defined here
|
||||
error: module has the same name as its containing module
|
||||
--> $DIR/module_inception.rs:12:5
|
||||
|
|
||||
12 | mod foo {
|
||||
| _____^ starting here...
|
||||
12 | / mod foo {
|
||||
13 | | mod bar {}
|
||||
14 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:8:5
|
||||
|
|
||||
8 | loop {
|
||||
| _____^ starting here...
|
||||
8 | / loop {
|
||||
9 | | println!("This is only ever printed once");
|
||||
10 | | break;
|
||||
11 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/never_loop.rs:4:9
|
||||
@ -17,25 +16,23 @@ note: lint level defined here
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:21:5
|
||||
|
|
||||
21 | loop {
|
||||
| _____^ starting here...
|
||||
21 | / loop {
|
||||
22 | | loop {
|
||||
23 | | // another one
|
||||
24 | | break;
|
||||
25 | | }
|
||||
26 | | break;
|
||||
27 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:22:9
|
||||
|
|
||||
22 | loop {
|
||||
| _________^ starting here...
|
||||
22 | / loop {
|
||||
23 | | // another one
|
||||
24 | | break;
|
||||
25 | | }
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![deny(if_let_some_result)]
|
||||
|
||||
fn str_to_int(x: &str) -> i32 {
|
||||
if let Some(y) = x.parse().ok() {
|
||||
if let Some(y) = x.parse().ok() {
|
||||
|
||||
y
|
||||
} else {
|
||||
|
@ -1,14 +1,13 @@
|
||||
error: Matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/ok_if_let.rs:7:5
|
||||
|
|
||||
7 | if let Some(y) = x.parse().ok() {
|
||||
| _____^ starting here...
|
||||
7 | / if let Some(y) = x.parse().ok() {
|
||||
8 | |
|
||||
9 | | y
|
||||
10 | | } else {
|
||||
11 | | 0
|
||||
12 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/ok_if_let.rs:4:9
|
||||
|
@ -1,14 +1,13 @@
|
||||
error: you should not implement `visit_string` without also implementing `visit_str`
|
||||
--> $DIR/serde.rs:39:5
|
||||
|
|
||||
39 | fn visit_string<E>(self, _v: String) -> Result<Self::Value, E>
|
||||
| _____^ starting here...
|
||||
39 | / fn visit_string<E>(self, _v: String) -> Result<Self::Value, E>
|
||||
40 | |
|
||||
41 | | where E: serde::de::Error,
|
||||
42 | | {
|
||||
43 | | unimplemented!()
|
||||
44 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/serde.rs:3:9
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:11:5
|
||||
|
|
||||
11 | let temp = foo[0];
|
||||
| _____^ starting here...
|
||||
11 | / let temp = foo[0];
|
||||
12 | | foo[0] = foo[1];
|
||||
13 | | foo[1] = temp;
|
||||
| |_________________^ ...ending here
|
||||
| |_________________^
|
||||
|
|
||||
= note: #[deny(manual_swap)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -19,11 +18,10 @@ help: try
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:23:5
|
||||
|
|
||||
23 | let temp = foo[0];
|
||||
| _____^ starting here...
|
||||
23 | / let temp = foo[0];
|
||||
24 | | foo[0] = foo[1];
|
||||
25 | | foo[1] = temp;
|
||||
| |_________________^ ...ending here
|
||||
| |_________________^
|
||||
|
|
||||
= note: #[deny(manual_swap)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
@ -32,11 +30,10 @@ help: try
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:35:5
|
||||
|
|
||||
35 | let temp = foo[0];
|
||||
| _____^ starting here...
|
||||
35 | / let temp = foo[0];
|
||||
36 | | foo[0] = foo[1];
|
||||
37 | | foo[1] = temp;
|
||||
| |_________________^ ...ending here
|
||||
| |_________________^
|
||||
|
|
||||
= note: #[deny(manual_swap)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
@ -46,10 +43,10 @@ error: this looks like you are swapping `a` and `b` manually
|
||||
--> $DIR/swap.rs:60:7
|
||||
|
|
||||
60 | ; let t = a;
|
||||
| _______^ starting here...
|
||||
| _______^
|
||||
61 | | a = b;
|
||||
62 | | b = t;
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
= note: #[deny(manual_swap)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
@ -60,10 +57,10 @@ error: this looks like you are swapping `c.0` and `a` manually
|
||||
--> $DIR/swap.rs:77:7
|
||||
|
|
||||
77 | ; let t = c.0;
|
||||
| _______^ starting here...
|
||||
| _______^
|
||||
78 | | c.0 = a;
|
||||
79 | | a = t;
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
= note: #[deny(manual_swap)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
@ -73,10 +70,9 @@ help: try
|
||||
error: this looks like you are trying to swap `a` and `b`
|
||||
--> $DIR/swap.rs:53:5
|
||||
|
|
||||
53 | a = b;
|
||||
| _____^ starting here...
|
||||
53 | / a = b;
|
||||
54 | | b = a;
|
||||
| |_________^ ...ending here
|
||||
| |_________^
|
||||
|
|
||||
= note: #[deny(almost_swapped)] implied by #[deny(clippy)]
|
||||
note: lint level defined here
|
||||
@ -91,10 +87,9 @@ help: try
|
||||
error: this looks like you are trying to swap `c.0` and `a`
|
||||
--> $DIR/swap.rs:70:5
|
||||
|
|
||||
70 | c.0 = a;
|
||||
| _____^ starting here...
|
||||
70 | / c.0 = a;
|
||||
71 | | a = c.0;
|
||||
| |___________^ ...ending here
|
||||
| |___________^
|
||||
|
|
||||
= note: #[deny(almost_swapped)] implied by #[deny(clippy)]
|
||||
help: try
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: unused label `'label`
|
||||
--> $DIR/unused_labels.rs:8:5
|
||||
|
|
||||
8 | 'label: for i in 1..2 {
|
||||
| _____^ starting here...
|
||||
8 | / 'label: for i in 1..2 {
|
||||
9 | | if i > 4 { continue }
|
||||
10 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/unused_labels.rs:5:9
|
||||
@ -22,11 +21,10 @@ error: unused label `'a`
|
||||
error: unused label `'same_label_in_two_fns`
|
||||
--> $DIR/unused_labels.rs:32:5
|
||||
|
|
||||
32 | 'same_label_in_two_fns: loop {
|
||||
| _____^ starting here...
|
||||
32 | / 'same_label_in_two_fns: loop {
|
||||
33 | | let _ = 1;
|
||||
34 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:9:5
|
||||
|
|
||||
9 | loop {
|
||||
| _____^ starting here...
|
||||
9 | / loop {
|
||||
10 | |
|
||||
11 | |
|
||||
12 | |
|
||||
... |
|
||||
17 | | }
|
||||
18 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/while_loop.rs:4:9
|
||||
@ -22,15 +21,14 @@ help: try
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:25:5
|
||||
|
|
||||
25 | loop {
|
||||
| _____^ starting here...
|
||||
25 | / loop {
|
||||
26 | |
|
||||
27 | |
|
||||
28 | |
|
||||
... |
|
||||
32 | | };
|
||||
33 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| while let Some(_x) = y { .. }
|
||||
@ -38,15 +36,14 @@ help: try
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:34:5
|
||||
|
|
||||
34 | loop {
|
||||
| _____^ starting here...
|
||||
34 | / loop {
|
||||
35 | |
|
||||
36 | |
|
||||
37 | |
|
||||
... |
|
||||
43 | | let _str = "foo";
|
||||
44 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| while let Some(x) = y { .. }
|
||||
@ -54,15 +51,14 @@ help: try
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:45:5
|
||||
|
|
||||
45 | loop {
|
||||
| _____^ starting here...
|
||||
45 | / loop {
|
||||
46 | |
|
||||
47 | |
|
||||
48 | |
|
||||
... |
|
||||
54 | | { let _b = "foobar"; }
|
||||
55 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| while let Some(x) = y { .. }
|
||||
@ -70,15 +66,14 @@ help: try
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:70:5
|
||||
|
|
||||
70 | loop {
|
||||
| _____^ starting here...
|
||||
70 | / loop {
|
||||
71 | |
|
||||
72 | |
|
||||
73 | |
|
||||
... |
|
||||
79 | | let _ = (e, l);
|
||||
80 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| while let Some(word) = "".split_whitespace().next() { .. }
|
||||
@ -86,14 +81,13 @@ help: try
|
||||
error: this loop could be written as a `for` loop
|
||||
--> $DIR/while_loop.rs:83:5
|
||||
|
|
||||
83 | while let Option::Some(x) = iter.next() {
|
||||
| _____^ starting here...
|
||||
83 | / while let Option::Some(x) = iter.next() {
|
||||
84 | |
|
||||
85 | |
|
||||
86 | |
|
||||
87 | | println!("{}", x);
|
||||
88 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/while_loop.rs:4:37
|
||||
@ -106,14 +100,13 @@ help: try
|
||||
error: this loop could be written as a `for` loop
|
||||
--> $DIR/while_loop.rs:91:5
|
||||
|
|
||||
91 | while let Some(x) = iter.next() {
|
||||
| _____^ starting here...
|
||||
91 | / while let Some(x) = iter.next() {
|
||||
92 | |
|
||||
93 | |
|
||||
94 | |
|
||||
95 | | println!("{}", x);
|
||||
96 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| for x in iter { .. }
|
||||
@ -130,15 +123,14 @@ help: try
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/while_loop.rs:142:5
|
||||
|
|
||||
142 | loop {
|
||||
| _____^ starting here...
|
||||
142 | / loop {
|
||||
143 | |
|
||||
144 | |
|
||||
145 | |
|
||||
... |
|
||||
150 | | loop {}
|
||||
151 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
help: try
|
||||
| while let Some(ele) = iter.next() { .. }
|
||||
|
Loading…
Reference in New Issue
Block a user