From a1f8e129fd24d9d596faf7502c3e6e39906b212b Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 14 Aug 2018 07:27:56 +0200 Subject: [PATCH] Add a test to ensure that #2799 is fixed Closes #2799 --- tests/ui/redundant_field_names.rs | 3 +++ tests/ui/redundant_field_names.stderr | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/ui/redundant_field_names.rs b/tests/ui/redundant_field_names.rs index 095ac7c0cc1..dc8548754d2 100644 --- a/tests/ui/redundant_field_names.rs +++ b/tests/ui/redundant_field_names.rs @@ -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 }; diff --git a/tests/ui/redundant_field_names.stderr b/tests/ui/redundant_field_names.stderr index d757f1871a7..5821baf4c85 100644 --- a/tests/ui/redundant_field_names.stderr +++ b/tests/ui/redundant_field_names.stderr @@ -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