File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -568,7 +568,14 @@ declare_clippy_lint! {
568
568
/// **Why is this bad?** Using the Index trait (`[]`) is more clear and more
569
569
/// concise.
570
570
///
571
- /// **Known problems:** None.
571
+ /// **Known problems:** Not a replacement for error handling: Using either
572
+ /// `.unwrap()` or the Index syntax (`[]`) carries the risk of causing a `panic`
573
+ /// if the value being accessed is `None`. If the use of `.get().unwrap()` is a
574
+ /// temporary placeholder for dealing with the `Option` type, then this does
575
+ /// not mitigate the need for error handling. If there is a chance that `.get()`
576
+ /// will be `None` in your program, then it is advisable that the `None` case
577
+ /// is eventually handled in a future refactor instead of using `.unwrap()`
578
+ /// or the Index syntax.
572
579
///
573
580
/// **Example:**
574
581
/// ```rust
You can’t perform that action at this time.
0 commit comments