Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8ccd264

Browse files
committed
modify code
1 parent 8d5d9e0 commit 8ccd264

File tree

1 file changed

+7
-4
lines changed
  • clippy_lints/src/methods

1 file changed

+7
-4
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,10 +2402,13 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
24022402
("to_os_string" | "to_owned" | "to_path_buf" | "to_vec", []) => {
24032403
implicit_clone::check(cx, name, expr, recv);
24042404
},
2405-
("unwrap", []) => match method_call(recv) {
2406-
Some(("get", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, false),
2407-
Some(("get_mut", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, true),
2408-
_ => unwrap_used::check(cx, expr, recv),
2405+
("unwrap", []) => {
2406+
match method_call(recv) {
2407+
Some(("get", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, false),
2408+
Some(("get_mut", [recv, get_arg], _)) => get_unwrap::check(cx, expr, recv, get_arg, true),
2409+
_ => {},
2410+
}
2411+
unwrap_used::check(cx, expr, recv);
24092412
},
24102413
("unwrap_or", [u_arg]) => match method_call(recv) {
24112414
Some((arith @ ("checked_add" | "checked_sub" | "checked_mul"), [lhs, rhs], _)) => {

0 commit comments

Comments
 (0)