Skip to content

Commit

Permalink
Ensure map callee references an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Raji committed Jan 23, 2025
1 parent 2c0e047 commit 4df6872
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clippy_lints/src/single_option_map.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::peel_blocks;
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::{path_res, peel_blocks};
use rustc_hir::def::Res;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::FnKind;
use rustc_hir::{Body, ExprKind, FnDecl, FnRetTy};
Expand Down Expand Up @@ -56,6 +57,7 @@ impl<'tcx> LateLintPass<'tcx> for SingleOptionMap {
&& let callee_type = cx.typeck_results().expr_ty(callee)
&& is_type_diagnostic_item(cx, callee_type, sym::Option)
&& let ExprKind::Path(_path) = callee.kind
&& let Res::Local(_id) = path_res(cx, callee)
{
span_lint_and_help(
cx,
Expand Down

0 comments on commit 4df6872

Please sign in to comment.