Add a test to ensure that #2799 is fixed

Closes #2799
This commit is contained in:
Michael Wright 2018-08-14 07:27:56 +02:00
parent 99a087bea5
commit a1f8e129fd
2 changed files with 13 additions and 10 deletions

View File

@ -49,6 +49,9 @@ fn main() {
let _ = ..=end;
let _ = start..=end;
// Issue #2799
let _: Vec<_> = (start..end).collect();
// hand-written Range family structs are linted
let _ = RangeFrom { start: start };
let _ = RangeTo { end: end };

View File

@ -13,33 +13,33 @@ error: redundant field names in struct initialization
| ^^^^^^^^ help: replace it with: `age`
error: redundant field names in struct initialization
--> $DIR/redundant_field_names.rs:53:25
--> $DIR/redundant_field_names.rs:56:25
|
53 | let _ = RangeFrom { start: start };
56 | let _ = RangeFrom { start: start };
| ^^^^^^^^^^^^ help: replace it with: `start`
error: redundant field names in struct initialization
--> $DIR/redundant_field_names.rs:54:23
--> $DIR/redundant_field_names.rs:57:23
|
54 | let _ = RangeTo { end: end };
57 | let _ = RangeTo { end: end };
| ^^^^^^^^ help: replace it with: `end`
error: redundant field names in struct initialization
--> $DIR/redundant_field_names.rs:55:21
--> $DIR/redundant_field_names.rs:58:21
|
55 | let _ = Range { start: start, end: end };
58 | let _ = Range { start: start, end: end };
| ^^^^^^^^^^^^ help: replace it with: `start`
error: redundant field names in struct initialization
--> $DIR/redundant_field_names.rs:55:35
--> $DIR/redundant_field_names.rs:58:35
|
55 | let _ = Range { start: start, end: end };
58 | let _ = Range { start: start, end: end };
| ^^^^^^^^ help: replace it with: `end`
error: redundant field names in struct initialization
--> $DIR/redundant_field_names.rs:57:32
--> $DIR/redundant_field_names.rs:60:32
|
57 | let _ = RangeToInclusive { end: end };
60 | let _ = RangeToInclusive { end: end };
| ^^^^^^^^ help: replace it with: `end`
error: aborting due to 7 previous errors