diff options
| author | y21 <30553356+y21@users.noreply.github.com> | 2024-03-16 14:15:45 +0100 |
|---|---|---|
| committer | y21 <30553356+y21@users.noreply.github.com> | 2024-03-16 14:15:45 +0100 |
| commit | 4e72ca31b5ff35bbe6ff02431bc214138417ed30 (patch) | |
| tree | e076e8e9ab822725a2a9901783ef69c156a151ee /clippy_lints/src | |
| parent | 660b058ba250e4f32ef165aaf8f61479da5dbb87 (diff) | |
[`map_entry`]: call the visitor on the local's `else` block
Diffstat (limited to 'clippy_lints/src')
| -rw-r--r-- | clippy_lints/src/entry.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index de6073c2723..219fe588d3c 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -358,7 +358,7 @@ struct InsertSearcher<'cx, 'tcx> { can_use_entry: bool, /// Whether this expression is the final expression in this code path. This may be a statement. in_tail_pos: bool, - // Is this expression a single insert. A slightly better suggestion can be made in this case. + /// Is this expression a single insert. A slightly better suggestion can be made in this case. is_single_insert: bool, /// If the visitor has seen the map being used. is_map_used: bool, @@ -431,6 +431,9 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> { self.is_single_insert = false; self.visit_expr(e); } + if let Some(els) = &l.els { + self.visit_block(els); + } }, StmtKind::Item(_) => { self.allow_insert_closure &= !self.in_tail_pos; |
