about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Rutter <michael.john.rutter@gmail.com>2018-10-28 08:12:47 +0000
committerMichael Rutter <michael.john.rutter@gmail.com>2018-10-28 08:12:47 +0000
commit061a48321c46c4050afcdadbc57f5869cae37eeb (patch)
treec12083b2f1ef8646d3d774a9ad73e274784bebc8
parent457e7f12e9fc028eae182f23b279194e5344b676 (diff)
downloadrust-061a48321c46c4050afcdadbc57f5869cae37eeb.tar.gz
rust-061a48321c46c4050afcdadbc57f5869cae37eeb.zip
added downsides to "known problems" for get_unwrap lint
-rw-r--r--clippy_lints/src/methods/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 01f97264d0b..8e3a75f2c7b 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -568,7 +568,14 @@ declare_clippy_lint! {
 /// **Why is this bad?** Using the Index trait (`[]`) is more clear and more
 /// concise.
 ///
-/// **Known problems:** None.
+/// **Known problems:** Not a replacement for error handling: Using either
+/// `.unwrap()` or the Index syntax (`[]`) carries the risk of causing a `panic`
+/// if the value being accessed is `None`. If the use of `.get().unwrap()` is a
+/// temporary placeholder for dealing with the `Option` type, then this does
+/// not mitigate the need for error handling. If there is a chance that `.get()`
+/// will be `None` in your program, then it is advisable that the `None` case
+/// is eventually handled in a future refactor instead of using `.unwrap()`
+/// or the Index syntax.
 ///
 /// **Example:**
 /// ```rust