diff options
| author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2022-02-10 16:32:53 +0800 |
|---|---|---|
| committer | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2022-02-10 16:32:53 +0800 |
| commit | 73a5f01263ffb80d113a9afe7004d940eebb0114 (patch) | |
| tree | a5dbcaf85b7dee4a9c201ea6623b05fb6f87d8d8 | |
| parent | a8e9708aeb7907979d103f0b56eebba7706c7d0e (diff) | |
| download | rust-73a5f01263ffb80d113a9afe7004d940eebb0114.tar.gz rust-73a5f01263ffb80d113a9afe7004d940eebb0114.zip | |
Use 0-based idx for array content
| -rw-r--r-- | library/core/src/option.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs index f8758056db9..9fe38a505ab 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1216,10 +1216,10 @@ impl<T> Option<T> { /// Often used to chain fallible operations that may return [`None`]. /// /// ``` - /// let arr_2d = [["A1", "A2"], ["B1", "B2"]]; + /// let arr_2d = [["A0", "A1"], ["B0", "B1"]]; /// /// let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1)); - /// assert_eq!(item_0_1, Some(&"A2")); + /// assert_eq!(item_0_1, Some(&"A1")); /// /// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0)); /// assert_eq!(item_2_0, None); |
