Skip to content

Commit 72b8c9b

Browse files
authored
Merge pull request #3049 from mikerite/fix-2799
Add a test to ensure that #2799 is fixed
2 parents b2a4013 + a1f8e12 commit 72b8c9b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

tests/ui/redundant_field_names.rs

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ fn main() {
4949
let _ = ..=end;
5050
let _ = start..=end;
5151

52+
// Issue #2799
53+
let _: Vec<_> = (start..end).collect();
54+
5255
// hand-written Range family structs are linted
5356
let _ = RangeFrom { start: start };
5457
let _ = RangeTo { end: end };

tests/ui/redundant_field_names.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@ error: redundant field names in struct initialization
1313
| ^^^^^^^^ help: replace it with: `age`
1414

1515
error: redundant field names in struct initialization
16-
--> $DIR/redundant_field_names.rs:53:25
16+
--> $DIR/redundant_field_names.rs:56:25
1717
|
18-
53 | let _ = RangeFrom { start: start };
18+
56 | let _ = RangeFrom { start: start };
1919
| ^^^^^^^^^^^^ help: replace it with: `start`
2020

2121
error: redundant field names in struct initialization
22-
--> $DIR/redundant_field_names.rs:54:23
22+
--> $DIR/redundant_field_names.rs:57:23
2323
|
24-
54 | let _ = RangeTo { end: end };
24+
57 | let _ = RangeTo { end: end };
2525
| ^^^^^^^^ help: replace it with: `end`
2626

2727
error: redundant field names in struct initialization
28-
--> $DIR/redundant_field_names.rs:55:21
28+
--> $DIR/redundant_field_names.rs:58:21
2929
|
30-
55 | let _ = Range { start: start, end: end };
30+
58 | let _ = Range { start: start, end: end };
3131
| ^^^^^^^^^^^^ help: replace it with: `start`
3232

3333
error: redundant field names in struct initialization
34-
--> $DIR/redundant_field_names.rs:55:35
34+
--> $DIR/redundant_field_names.rs:58:35
3535
|
36-
55 | let _ = Range { start: start, end: end };
36+
58 | let _ = Range { start: start, end: end };
3737
| ^^^^^^^^ help: replace it with: `end`
3838

3939
error: redundant field names in struct initialization
40-
--> $DIR/redundant_field_names.rs:57:32
40+
--> $DIR/redundant_field_names.rs:60:32
4141
|
42-
57 | let _ = RangeToInclusive { end: end };
42+
60 | let _ = RangeToInclusive { end: end };
4343
| ^^^^^^^^ help: replace it with: `end`
4444

4545
error: aborting due to 7 previous errors

0 commit comments

Comments
 (0)