Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use 0-based idx for array content
  • Loading branch information
cyqsimon committed Feb 10, 2022
commit 73a5f01263ffb80d113a9afe7004d940eebb0114
4 changes: 2 additions & 2 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down