This commit is contained in:
Oliver Schneider 2018-03-16 09:44:20 +01:00
parent c215702555
commit 8749927973
No known key found for this signature in database
GPG Key ID: A69F8D225B3AD7D9
15 changed files with 224 additions and 226 deletions

View File

@ -1,6 +1,10 @@
# Change Log # Change Log
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 0.0.188
* Rustup to *rustc 1.26.0-nightly (392645394 2018-03-15)*
* New lint: [`while_immutable_condition`]
## 0.0.187 ## 0.0.187
* Rustup to *rustc 1.26.0-nightly (322d7f7b9 2018-02-25)* * Rustup to *rustc 1.26.0-nightly (322d7f7b9 2018-02-25)*
* New lints: [`redundant_field_names`], [`suspicious_arithmetic_impl`], [`suspicious_op_assign_impl`] * New lints: [`redundant_field_names`], [`suspicious_arithmetic_impl`], [`suspicious_op_assign_impl`]
@ -777,6 +781,7 @@ All notable changes to this project will be documented in this file.
[`useless_transmute`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#useless_transmute [`useless_transmute`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#useless_transmute
[`useless_vec`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#useless_vec [`useless_vec`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#useless_vec
[`verbose_bit_mask`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#verbose_bit_mask [`verbose_bit_mask`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#verbose_bit_mask
[`while_immutable_condition`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#while_immutable_condition
[`while_let_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#while_let_loop [`while_let_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#while_let_loop
[`while_let_on_iterator`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#while_let_on_iterator [`while_let_on_iterator`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#while_let_on_iterator
[`wrong_pub_self_convention`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#wrong_pub_self_convention [`wrong_pub_self_convention`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#wrong_pub_self_convention

View File

@ -1,6 +1,6 @@
[package] [package]
name = "clippy" name = "clippy"
version = "0.0.187" version = "0.0.188"
authors = [ authors = [
"Manish Goregaokar <manishsmail@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>", "Andre Bogus <bogusandre@gmail.com>",
@ -37,7 +37,7 @@ path = "src/driver.rs"
[dependencies] [dependencies]
# begin automatic update # begin automatic update
clippy_lints = { version = "0.0.187", path = "clippy_lints" } clippy_lints = { version = "0.0.188", path = "clippy_lints" }
# end automatic update # end automatic update
cargo_metadata = "0.5" cargo_metadata = "0.5"
regex = "0.2" regex = "0.2"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "clippy_lints" name = "clippy_lints"
# begin automatic update # begin automatic update
version = "0.0.187" version = "0.0.188"
# end automatic update # end automatic update
authors = [ authors = [
"Manish Goregaokar <manishsmail@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>",

View File

@ -519,9 +519,9 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
loops::NEVER_LOOP, loops::NEVER_LOOP,
loops::REVERSE_RANGE_LOOP, loops::REVERSE_RANGE_LOOP,
loops::UNUSED_COLLECT, loops::UNUSED_COLLECT,
loops::WHILE_IMMUTABLE_CONDITION,
loops::WHILE_LET_LOOP, loops::WHILE_LET_LOOP,
loops::WHILE_LET_ON_ITERATOR, loops::WHILE_LET_ON_ITERATOR,
loops::WHILE_IMMUTABLE_CONDITION,
map_clone::MAP_CLONE, map_clone::MAP_CLONE,
matches::MATCH_AS_REF, matches::MATCH_AS_REF,
matches::MATCH_BOOL, matches::MATCH_BOOL,

View File

@ -531,7 +531,7 @@ fn is_questionmark_desugar_marked_call(expr: &Expr) -> bool {
fn is_unit(ty: Ty) -> bool { fn is_unit(ty: Ty) -> bool {
match ty.sty { match ty.sty {
ty::TyTuple(slice, _) if slice.is_empty() => true, ty::TyTuple(slice) if slice.is_empty() => true,
_ => false, _ => false,
} }
} }

View File

@ -1,4 +1,4 @@
#![feature(inclusive_range_syntax, plugin)] #![feature(plugin)]
#![warn(indexing_slicing)] #![warn(indexing_slicing)]

View File

@ -1,5 +1,3 @@
#![feature(dotdoteq_in_patterns, inclusive_range_syntax)]
#![allow(blacklisted_name, collapsible_if, cyclomatic_complexity, eq_op, needless_continue, #![allow(blacklisted_name, collapsible_if, cyclomatic_complexity, eq_op, needless_continue,
needless_return, never_loop, no_effect, zero_divided_by_zero)] needless_return, never_loop, no_effect, zero_divided_by_zero)]

View File

@ -1,384 +1,384 @@
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:31:10 --> $DIR/copies.rs:29:10
| |
31 | else { //~ ERROR same body as `if` block 29 | else { //~ ERROR same body as `if` block
| __________^ | __________^
32 | | Foo { bar: 42 }; 30 | | Foo { bar: 42 };
33 | | 0..10; 31 | | 0..10;
34 | | ..; 32 | | ..;
... | ... |
38 | | foo(); 36 | | foo();
39 | | } 37 | | }
| |_____^ | |_____^
| |
= note: `-D if-same-then-else` implied by `-D warnings` = note: `-D if-same-then-else` implied by `-D warnings`
note: same as this note: same as this
--> $DIR/copies.rs:22:13 --> $DIR/copies.rs:20:13
| |
22 | if true { 20 | if true {
| _____________^ | _____________^
23 | | Foo { bar: 42 }; 21 | | Foo { bar: 42 };
24 | | 0..10; 22 | | 0..10;
25 | | ..; 23 | | ..;
... | ... |
29 | | foo(); 27 | | foo();
30 | | } 28 | | }
| |_____^ | |_____^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:80:14 --> $DIR/copies.rs:78:14
| |
80 | _ => { //~ ERROR match arms have same body 78 | _ => { //~ ERROR match arms have same body
| ______________^ | ______________^
81 | | foo(); 79 | | foo();
82 | | let mut a = 42 + [23].len() as i32; 80 | | let mut a = 42 + [23].len() as i32;
83 | | if true { 81 | | if true {
... | ... |
87 | | a 85 | | a
88 | | } 86 | | }
| |_________^ | |_________^
| |
= note: `-D match-same-arms` implied by `-D warnings` = note: `-D match-same-arms` implied by `-D warnings`
note: same as this note: same as this
--> $DIR/copies.rs:71:15 --> $DIR/copies.rs:69:15
| |
71 | 42 => { 69 | 42 => {
| _______________^ | _______________^
72 | | foo(); 70 | | foo();
73 | | let mut a = 42 + [23].len() as i32; 71 | | let mut a = 42 + [23].len() as i32;
74 | | if true { 72 | | if true {
... | ... |
78 | | a 76 | | a
79 | | } 77 | | }
| |_________^ | |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it` note: `42` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:71:15 --> $DIR/copies.rs:69:15
| |
71 | 42 => { 69 | 42 => {
| _______________^ | _______________^
72 | | foo(); 70 | | foo();
73 | | let mut a = 42 + [23].len() as i32; 71 | | let mut a = 42 + [23].len() as i32;
74 | | if true { 72 | | if true {
... | ... |
78 | | a 76 | | a
79 | | } 77 | | }
| |_________^ | |_________^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:94:14 --> $DIR/copies.rs:92:14
| |
94 | _ => 0, //~ ERROR match arms have same body 92 | _ => 0, //~ ERROR match arms have same body
| ^ | ^
| |
note: same as this note: same as this
--> $DIR/copies.rs:92:19 --> $DIR/copies.rs:90:19
| |
92 | Abc::A => 0, 90 | Abc::A => 0,
| ^ | ^
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it` note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:92:19 --> $DIR/copies.rs:90:19
| |
92 | Abc::A => 0, 90 | Abc::A => 0,
| ^ | ^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:104:10 --> $DIR/copies.rs:102:10
| |
104 | else { //~ ERROR same body as `if` block 102 | else { //~ ERROR same body as `if` block
| __________^ | __________^
105 | | 42 103 | | 42
106 | | }; 104 | | };
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:101:21 --> $DIR/copies.rs:99:21
| |
101 | let _ = if true { 99 | let _ = if true {
| _____________________^ | _____________________^
102 | | 42 100 | | 42
103 | | } 101 | | }
| |_____^ | |_____^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:118:10 --> $DIR/copies.rs:116:10
| |
118 | else { //~ ERROR same body as `if` block 116 | else { //~ ERROR same body as `if` block
| __________^ | __________^
119 | | for _ in &[42] { 117 | | for _ in &[42] {
120 | | let foo: &Option<_> = &Some::<u8>(42); 118 | | let foo: &Option<_> = &Some::<u8>(42);
121 | | if true { 119 | | if true {
... | ... |
126 | | } 124 | | }
127 | | } 125 | | }
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:108:13 --> $DIR/copies.rs:106:13
| |
108 | if true { 106 | if true {
| _____________^ | _____________^
109 | | for _ in &[42] { 107 | | for _ in &[42] {
110 | | let foo: &Option<_> = &Some::<u8>(42); 108 | | let foo: &Option<_> = &Some::<u8>(42);
111 | | if true { 109 | | if true {
... | ... |
116 | | } 114 | | }
117 | | } 115 | | }
| |_____^ | |_____^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:140:10 --> $DIR/copies.rs:138:10
| |
140 | else { //~ ERROR same body as `if` block 138 | else { //~ ERROR same body as `if` block
| __________^ | __________^
141 | | let bar = if true { 139 | | let bar = if true {
142 | | 42 140 | | 42
143 | | } 141 | | }
... | ... |
149 | | bar + 1; 147 | | bar + 1;
150 | | } 148 | | }
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:129:13 --> $DIR/copies.rs:127:13
| |
129 | if true { 127 | if true {
| _____________^ | _____________^
130 | | let bar = if true { 128 | | let bar = if true {
131 | | 42 129 | | 42
132 | | } 130 | | }
... | ... |
138 | | bar + 1; 136 | | bar + 1;
139 | | } 137 | | }
| |_____^ | |_____^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:175:10 --> $DIR/copies.rs:173:10
| |
175 | else { //~ ERROR same body as `if` block 173 | else { //~ ERROR same body as `if` block
| __________^ | __________^
176 | | if let Some(a) = Some(42) {} 174 | | if let Some(a) = Some(42) {}
177 | | } 175 | | }
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:172:13 --> $DIR/copies.rs:170:13
| |
172 | if true { 170 | if true {
| _____________^ | _____________^
173 | | if let Some(a) = Some(42) {} 171 | | if let Some(a) = Some(42) {}
174 | | } 172 | | }
| |_____^ | |_____^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:182:10 --> $DIR/copies.rs:180:10
| |
182 | else { //~ ERROR same body as `if` block 180 | else { //~ ERROR same body as `if` block
| __________^ | __________^
183 | | if let (1, .., 3) = (1, 2, 3) {} 181 | | if let (1, .., 3) = (1, 2, 3) {}
184 | | } 182 | | }
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:179:13 --> $DIR/copies.rs:177:13
| |
179 | if true { 177 | if true {
| _____________^ | _____________^
180 | | if let (1, .., 3) = (1, 2, 3) {} 178 | | if let (1, .., 3) = (1, 2, 3) {}
181 | | } 179 | | }
| |_____^ | |_____^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:237:15 --> $DIR/copies.rs:235:15
| |
237 | 51 => foo(), //~ ERROR match arms have same body 235 | 51 => foo(), //~ ERROR match arms have same body
| ^^^^^ | ^^^^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:236:15 --> $DIR/copies.rs:234:15
| |
236 | 42 => foo(), 234 | 42 => foo(),
| ^^^^^ | ^^^^^
note: consider refactoring into `42 | 51` note: consider refactoring into `42 | 51`
--> $DIR/copies.rs:236:15 --> $DIR/copies.rs:234:15
| |
236 | 42 => foo(), 234 | 42 => foo(),
| ^^^^^ | ^^^^^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:243:17 --> $DIR/copies.rs:241:17
| |
243 | None => 24, //~ ERROR match arms have same body 241 | None => 24, //~ ERROR match arms have same body
| ^^ | ^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:242:20 --> $DIR/copies.rs:240:20
| |
242 | Some(_) => 24, 240 | Some(_) => 24,
| ^^ | ^^
note: consider refactoring into `Some(_) | None` note: consider refactoring into `Some(_) | None`
--> $DIR/copies.rs:242:20 --> $DIR/copies.rs:240:20
| |
242 | Some(_) => 24, 240 | Some(_) => 24,
| ^^ | ^^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:265:28 --> $DIR/copies.rs:263:28
| |
265 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body 263 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^ | ^^^^^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:264:28 --> $DIR/copies.rs:262:28
| |
264 | (Some(a), None) => bar(a), 262 | (Some(a), None) => bar(a),
| ^^^^^^ | ^^^^^^
note: consider refactoring into `(Some(a), None) | (None, Some(a))` note: consider refactoring into `(Some(a), None) | (None, Some(a))`
--> $DIR/copies.rs:264:28 --> $DIR/copies.rs:262:28
| |
264 | (Some(a), None) => bar(a), 262 | (Some(a), None) => bar(a),
| ^^^^^^ | ^^^^^^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:271:26 --> $DIR/copies.rs:269:26
| |
271 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body 269 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^ | ^^^^^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:270:26 --> $DIR/copies.rs:268:26
| |
270 | (Some(a), ..) => bar(a), 268 | (Some(a), ..) => bar(a),
| ^^^^^^ | ^^^^^^
note: consider refactoring into `(Some(a), ..) | (.., Some(a))` note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
--> $DIR/copies.rs:270:26 --> $DIR/copies.rs:268:26
| |
270 | (Some(a), ..) => bar(a), 268 | (Some(a), ..) => bar(a),
| ^^^^^^ | ^^^^^^
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/copies.rs:277:20 --> $DIR/copies.rs:275:20
| |
277 | (.., 3) => 42, //~ ERROR match arms have same body 275 | (.., 3) => 42, //~ ERROR match arms have same body
| ^^ | ^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:276:23 --> $DIR/copies.rs:274:23
| |
276 | (1, .., 3) => 42, 274 | (1, .., 3) => 42,
| ^^ | ^^
note: consider refactoring into `(1, .., 3) | (.., 3)` note: consider refactoring into `(1, .., 3) | (.., 3)`
--> $DIR/copies.rs:276:23 --> $DIR/copies.rs:274:23
| |
276 | (1, .., 3) => 42, 274 | (1, .., 3) => 42,
| ^^ | ^^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:283:12 --> $DIR/copies.rs:281:12
| |
283 | } else { //~ ERROR same body as `if` block 281 | } else { //~ ERROR same body as `if` block
| ____________^ | ____________^
284 | | 0.0
285 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:281:21
|
281 | let _ = if true {
| _____________________^
282 | | 0.0 282 | | 0.0
283 | | } else { //~ ERROR same body as `if` block 283 | | };
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:289:12
|
289 | } else { //~ ERROR same body as `if` block
| ____________^
290 | | -0.0
291 | | };
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:287:21 --> $DIR/copies.rs:279:21
| |
287 | let _ = if true { 279 | let _ = if true {
| _____________________^ | _____________________^
280 | | 0.0
281 | | } else { //~ ERROR same body as `if` block
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:287:12
|
287 | } else { //~ ERROR same body as `if` block
| ____________^
288 | | -0.0 288 | | -0.0
289 | | } else { //~ ERROR same body as `if` block 289 | | };
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:309:12
|
309 | } else { //~ ERROR same body as `if` block
| ____________^
310 | | std::f32::NAN
311 | | };
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:307:21 --> $DIR/copies.rs:285:21
| |
307 | let _ = if true { 285 | let _ = if true {
| _____________________^ | _____________________^
308 | | std::f32::NAN 286 | | -0.0
309 | | } else { //~ ERROR same body as `if` block 287 | | } else { //~ ERROR same body as `if` block
| |_____^ | |_____^
error: this `if` has identical blocks error: this `if` has identical blocks
--> $DIR/copies.rs:327:10 --> $DIR/copies.rs:307:12
| |
327 | else { //~ ERROR same body as `if` block 307 | } else { //~ ERROR same body as `if` block
| __________^ | ____________^
328 | | try!(Ok("foo")); 308 | | std::f32::NAN
329 | | } 309 | | };
| |_____^ | |_____^
| |
note: same as this note: same as this
--> $DIR/copies.rs:324:13 --> $DIR/copies.rs:305:21
| |
324 | if true { 305 | let _ = if true {
| _____________________^
306 | | std::f32::NAN
307 | | } else { //~ ERROR same body as `if` block
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:325:10
|
325 | else { //~ ERROR same body as `if` block
| __________^
326 | | try!(Ok("foo"));
327 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:322:13
|
322 | if true {
| _____________^ | _____________^
325 | | try!(Ok("foo")); 323 | | try!(Ok("foo"));
326 | | } 324 | | }
| |_____^ | |_____^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:353:13 --> $DIR/copies.rs:351:13
| |
353 | else if b { //~ ERROR ifs same condition 351 | else if b { //~ ERROR ifs same condition
| ^ | ^
| |
= note: `-D ifs-same-cond` implied by `-D warnings` = note: `-D ifs-same-cond` implied by `-D warnings`
note: same as this note: same as this
--> $DIR/copies.rs:351:8 --> $DIR/copies.rs:349:8
| |
351 | if b { 349 | if b {
| ^ | ^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:358:13 --> $DIR/copies.rs:356:13
| |
358 | else if a == 1 { //~ ERROR ifs same condition 356 | else if a == 1 { //~ ERROR ifs same condition
| ^^^^^^ | ^^^^^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:356:8 --> $DIR/copies.rs:354:8
| |
356 | if a == 1 { 354 | if a == 1 {
| ^^^^^^ | ^^^^^^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:365:13 --> $DIR/copies.rs:363:13
| |
365 | else if 2*a == 1 { //~ ERROR ifs same condition 363 | else if 2*a == 1 { //~ ERROR ifs same condition
| ^^^^^^^^ | ^^^^^^^^
| |
note: same as this note: same as this
--> $DIR/copies.rs:361:8 --> $DIR/copies.rs:359:8
| |
361 | if 2*a == 1 { 359 | if 2*a == 1 {
| ^^^^^^^^ | ^^^^^^^^
error: aborting due to 20 previous errors error: aborting due to 20 previous errors

View File

@ -1,4 +1,4 @@
#![feature(plugin, inclusive_range_syntax, custom_attribute)] #![feature(plugin, custom_attribute)]
use std::collections::*; use std::collections::*;

View File

@ -1,4 +1,4 @@
#![feature(plugin, box_syntax, inclusive_range_syntax)] #![feature(plugin, box_syntax)]
#![warn(no_effect, unnecessary_operation)] #![warn(no_effect, unnecessary_operation)]

View File

@ -1,7 +1,4 @@
#![feature(iterator_step_by)] #![feature(iterator_step_by)]
#![feature(inclusive_range_syntax)]
struct NotARange; struct NotARange;
impl NotARange { impl NotARange {

View File

@ -1,41 +1,41 @@
error: Iterator::step_by(0) will panic at runtime error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:13:13 --> $DIR/range.rs:10:13
| |
13 | let _ = (0..1).step_by(0); 10 | let _ = (0..1).step_by(0);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: `-D iterator-step-by-zero` implied by `-D warnings` = note: `-D iterator-step-by-zero` implied by `-D warnings`
error: Iterator::step_by(0) will panic at runtime error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:17:13 --> $DIR/range.rs:14:13
| |
17 | let _ = (1..).step_by(0); 14 | let _ = (1..).step_by(0);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:15:13
|
15 | let _ = (1..=2).step_by(0);
| ^^^^^^^^^^^^^^^^^^
error: Iterator::step_by(0) will panic at runtime error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:18:13 --> $DIR/range.rs:18:13
| |
18 | let _ = (1..=2).step_by(0); 18 | let _ = x.step_by(0);
| ^^^^^^^^^^^^^^^^^^
error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:21:13
|
21 | let _ = x.step_by(0);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: It is more idiomatic to use v1.iter().enumerate() error: It is more idiomatic to use v1.iter().enumerate()
--> $DIR/range.rs:29:14 --> $DIR/range.rs:26:14
| |
29 | let _x = v1.iter().zip(0..v1.len()); 26 | let _x = v1.iter().zip(0..v1.len());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D range-zip-with-len` implied by `-D warnings` = note: `-D range-zip-with-len` implied by `-D warnings`
error: Iterator::step_by(0) will panic at runtime error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:33:13 --> $DIR/range.rs:30:13
| |
33 | let _ = v1.iter().step_by(2/3); 30 | let _ = v1.iter().step_by(2/3);
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -1,5 +1,3 @@
#![feature(inclusive_range_syntax)]
fn f() -> usize { fn f() -> usize {
42 42
} }

View File

@ -1,47 +1,47 @@
error: an inclusive range would be more readable error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:12:14 --> $DIR/range_plus_minus_one.rs:10:14
| |
12 | for _ in 0..3+1 { } 10 | for _ in 0..3+1 { }
| ^^^^^^ help: use: `0..=3` | ^^^^^^ help: use: `0..=3`
| |
= note: `-D range-plus-one` implied by `-D warnings` = note: `-D range-plus-one` implied by `-D warnings`
error: an inclusive range would be more readable error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:15:14 --> $DIR/range_plus_minus_one.rs:13:14
| |
15 | for _ in 0..1+5 { } 13 | for _ in 0..1+5 { }
| ^^^^^^ help: use: `0..=5` | ^^^^^^ help: use: `0..=5`
error: an inclusive range would be more readable error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:18:14 --> $DIR/range_plus_minus_one.rs:16:14
| |
18 | for _ in 1..1+1 { } 16 | for _ in 1..1+1 { }
| ^^^^^^ help: use: `1..=1` | ^^^^^^ help: use: `1..=1`
error: an inclusive range would be more readable error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:24:14 --> $DIR/range_plus_minus_one.rs:22:14
| |
24 | for _ in 0..(1+f()) { } 22 | for _ in 0..(1+f()) { }
| ^^^^^^^^^^ help: use: `0..=f()` | ^^^^^^^^^^ help: use: `0..=f()`
error: an exclusive range would be more readable error: an exclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:28:13 --> $DIR/range_plus_minus_one.rs:26:13
| |
28 | let _ = ..=11-1; 26 | let _ = ..=11-1;
| ^^^^^^^ help: use: `..11` | ^^^^^^^ help: use: `..11`
| |
= note: `-D range-minus-one` implied by `-D warnings` = note: `-D range-minus-one` implied by `-D warnings`
error: an exclusive range would be more readable error: an exclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:29:13 --> $DIR/range_plus_minus_one.rs:27:13
| |
29 | let _ = ..=(11-1); 27 | let _ = ..=(11-1);
| ^^^^^^^^^ help: use: `..11` | ^^^^^^^^^ help: use: `..11`
error: an inclusive range would be more readable error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:30:13 --> $DIR/range_plus_minus_one.rs:28:13
| |
30 | let _ = (f()+1)..(f()+1); 28 | let _ = (f()+1)..(f()+1);
| ^^^^^^^^^^^^^^^^ help: use: `(f()+1)..=f()` | ^^^^^^^^^^^^^^^^ help: use: `(f()+1)..=f()`
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View File

@ -1,6 +1,6 @@
#![warn(redundant_field_names)] #![warn(redundant_field_names)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![feature(inclusive_range, inclusive_range_syntax)] #![feature(inclusive_range, inclusive_range_fields)]
#[macro_use] #[macro_use]
extern crate derive_new; extern crate derive_new;