We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f7a9be commit 73c5adeCopy full SHA for 73c5ade
clippy_lints/src/use_last.rs
@@ -11,6 +11,10 @@ use if_chain::if_chain;
11
///
12
/// **Why is this bad?** Using `x.last()` is easier to read and has the same result.
13
14
+/// Note that using x[x.len() - 1] is semantically different from x.last(),
15
+/// since indexing into the array will panic on out-of-bounds accesses, while
16
+/// x.get() and x.last() will return None.
17
+///
18
/// **Known problems:** None.
19
20
/// **Example:**
0 commit comments