diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-10-11 12:11:23 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-10-11 12:11:23 -0700 |
| commit | c71228e2f4d6ea82c9538391454801baa7946bff (patch) | |
| tree | 5b526897bb8867ea584a20f71e7f385dc0821812 /src/libcore | |
| parent | a0fd68b088fc8ce869ad89bdea4c8ef4441f1874 (diff) | |
| download | rust-c71228e2f4d6ea82c9538391454801baa7946bff.tar.gz rust-c71228e2f4d6ea82c9538391454801baa7946bff.zip | |
review comments
- reword messages - apply custom comments to all types of ranges - fix indentation
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter/iterator.rs | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 9e68ab92882..ff1bd71bd55 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -33,8 +33,32 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {} on( _Self="[std::ops::Range<Idx>; 1]", label="if you meant to iterate between two values, remove the square brackets", - note="`[start..end]` is an array of one `Range`, you might have meant to have a `Range`: \ - `start..end`" + note="`[start..end]` is an array of one `Range`; you might have meant to have a `Range` \ + without the brackets: `start..end`" + ), + on( + _Self="[std::ops::RangeFrom<Idx>; 1]", + label="if you meant to iterate from a value onwards, remove the square brackets", + note="`[start..]` is an array of one `RangeFrom`; you might have meant to have a \ + `RangeFrom` without the brackets: `start..`" + ), + on( + _Self="[std::ops::RangeTo<Idx>; 1]", + label="if you meant to iterate until a value, remove the square brackets", + note="`[..end]` is an array of one `RangeTo`; you might have meant to have a \ + `RangeTo` without the brackets: `..end`" + ), + on( + _Self="[std::ops::RangeInclusive<Idx>; 1]", + label="if you meant to iterate between two values, remove the square brackets", + note="`[start..=end]` is an array of one `RangeInclusive`; you might have meant to have a \ + `RangeInclusive` without the brackets: `start..=end`" + ), + on( + _Self="[std::ops::RangeToInclusive<Idx>; 1]", + label="if you meant to iterate until a value, remove the square brackets", + note="`[..=end]` is an array of one `RangeToInclusive`; you might have meant to have a \ + `RangeToInclusive` without the brackets: `..=end`" ), on( _Self="&str", @@ -51,8 +75,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {} ), on( _Self="{integral}", - note="if you want to iterate between `0` until a value `end`, use the range syntax: \ - `0..end`" + note="if you want to iterate between `start` until a value `end`, use the exclusive range \ + syntax `start..end` or the inclusive range syntax `start..=end`" ), label="`{Self}` is not an iterator", message="`{Self}` is not an iterator" |
