about summary refs log tree commit diff
diff options
context:
space:
mode:
authortamaron <tamaron1203@gmail.com>2022-01-30 12:56:07 +0900
committertamaron <tamaron1203@gmail.com>2022-01-30 12:56:07 +0900
commit8ccd26462032427741f753424702e78e1050e96b (patch)
tree80eb081a309382a107a4f46d3c194b2a246723c1
parent8d5d9e01037b841ca9ae9add09cdf4ada12a0fae (diff)
downloadrust-8ccd26462032427741f753424702e78e1050e96b.tar.gz
rust-8ccd26462032427741f753424702e78e1050e96b.zip
modify code
-rw-r--r--clippy_lints/src/methods/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 18d4867b7eb..7847adce0f1 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -2402,10 +2402,13 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
             ("to_os_string" | "to_owned" | "to_path_buf" | "to_vec", []) => {
                 implicit_clone::check(cx, name, expr, recv);
             },
-            ("unwrap", []) => match method_call(recv) {
-                Some(("get", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, false),
-                Some(("get_mut", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, true),
-                _ => unwrap_used::check(cx, expr, recv),
+            ("unwrap", []) => {
+                match method_call(recv) {
+                    Some(("get", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, false),
+                    Some(("get_mut", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, true),
+                    _ => {},
+                }
+                unwrap_used::check(cx, expr, recv);
             },
             ("unwrap_or", [u_arg]) => match method_call(recv) {
                 Some((arith @ ("checked_add" | "checked_sub" | "checked_mul"), [lhs, rhs], _)) => {