diff options
| author | Jason Schein <jschein@google.com> | 2018-02-11 17:54:44 -0800 |
|---|---|---|
| committer | Jason Schein <jschein@google.com> | 2018-02-11 17:54:44 -0800 |
| commit | bd426f1d69ec8371d86e06382e96e9ed842f3933 (patch) | |
| tree | 3f1f133a7129f5d24850ce0ef2fedea2fed39322 | |
| parent | b8398d947d160ad4f26cc22da66e5fbc7030817b (diff) | |
| download | rust-bd426f1d69ec8371d86e06382e96e9ed842f3933.tar.gz rust-bd426f1d69ec8371d86e06382e96e9ed842f3933.zip | |
Update ops range example to avoid confusion between indexes and values.
| -rw-r--r-- | src/libcore/ops/range.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 3f573f7c7eb..a80699c0f5a 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -68,11 +68,11 @@ impl fmt::Debug for RangeFull { /// assert_eq!((3..5), std::ops::Range { start: 3, end: 5 }); /// assert_eq!(3 + 4 + 5, (3..6).sum()); /// -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); -/// assert_eq!(arr[ ..3], [0,1,2 ]); -/// assert_eq!(arr[1.. ], [ 1,2,3]); -/// assert_eq!(arr[1..3], [ 1,2 ]); // Range +/// let arr = ['a', 'b', 'c', 'd']; +/// assert_eq!(arr[ .. ], ['a', 'b', 'c', 'd']); +/// assert_eq!(arr[ ..3], ['a', 'b', 'c', ]); +/// assert_eq!(arr[1.. ], [ 'b', 'c', 'd']); +/// assert_eq!(arr[1..3], [ 'b', 'c' ]); // Range /// ``` #[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 #[stable(feature = "rust1", since = "1.0.0")] |
