Skip to content

Commit 5dbca1f

Browse files
flip1995HMPerson1
authored andcommitted
Add Applicability
1 parent aabf808 commit 5dbca1f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/mem_discriminant.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use crate::rustc::hir::{Expr, ExprKind};
1212
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
1313
use crate::rustc::{declare_tool_lint, lint_array};
14+
use crate::rustc_errors::Applicability;
1415
use crate::utils::{match_def_path, opt_def_id, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth};
1516
use if_chain::if_chain;
1617

@@ -79,10 +80,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant {
7980
}
8081

8182
let derefs: String = iter::repeat('*').take(derefs_needed).collect();
82-
db.span_suggestion(
83+
db.span_suggestion_with_applicability(
8384
param.span,
8485
"try dereferencing",
8586
format!("{}{}", derefs, snippet(cx, cur_expr.span, "<param>")),
87+
Applicability::MachineApplicable,
8688
);
8789
}
8890
},

0 commit comments

Comments
 (0)