@@ -65,28 +65,24 @@ declare_lint_pass!(HashMapPass => [MAP_ENTRY]);
65
65
impl < ' tcx > LateLintPass < ' tcx > for HashMapPass {
66
66
#[ expect( clippy:: too_many_lines) ]
67
67
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
68
- let ( cond_expr, then_expr, else_expr) = match higher:: If :: hir ( expr) {
69
- Some ( higher:: If { cond, then, r#else } ) => ( cond, then, r#else) ,
70
- _ => return ,
68
+ let Some ( higher:: If { cond : cond_expr, then : then_expr, r#else : else_expr } ) = higher:: If :: hir ( expr) else {
69
+ return
71
70
} ;
72
71
73
- let ( map_ty, contains_expr) = match try_parse_contains ( cx, cond_expr) {
74
- Some ( x) => x,
75
- None => return ,
72
+ let Some ( ( map_ty, contains_expr) ) = try_parse_contains ( cx, cond_expr) else {
73
+ return
76
74
} ;
77
75
78
- let then_search = match find_insert_calls ( cx, & contains_expr, then_expr) {
79
- Some ( x) => x,
80
- None => return ,
76
+ let Some ( then_search) = find_insert_calls ( cx, & contains_expr, then_expr) else {
77
+ return
81
78
} ;
82
79
83
80
let mut app = Applicability :: MachineApplicable ;
84
81
let map_str = snippet_with_context ( cx, contains_expr. map . span , contains_expr. call_ctxt , ".." , & mut app) . 0 ;
85
82
let key_str = snippet_with_context ( cx, contains_expr. key . span , contains_expr. call_ctxt , ".." , & mut app) . 0 ;
86
83
let sugg = if let Some ( else_expr) = else_expr {
87
- let else_search = match find_insert_calls ( cx, & contains_expr, else_expr) {
88
- Some ( search) => search,
89
- None => return ,
84
+ let Some ( else_search) = find_insert_calls ( cx, & contains_expr, else_expr) else {
85
+ return ;
90
86
} ;
91
87
92
88
if then_search. edits . is_empty ( ) && else_search. edits . is_empty ( ) {
0 commit comments