File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1- use clippy_utils:: diagnostics:: span_lint_and_sugg;
1+ use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_and_then } ;
22use clippy_utils:: eq_expr_value;
33use clippy_utils:: source:: snippet_with_applicability;
44use rustc_errors:: Applicability ;
55use rustc_hir:: { Arm , ExprKind } ;
66use rustc_lint:: { LateContext , LateLintPass } ;
77use rustc_session:: declare_lint_pass;
8+ use rustc_span:: Span ;
89
910declare_clippy_lint ! {
1011 /// ### What it does
@@ -97,14 +98,18 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMatchGuard {
9798 //
9899 // suggest removing the `if` _and_ the curlies of the inner brace,
99100 // since the arm body already has braces
100- span_lint_and_sugg (
101+ span_lint_and_then (
101102 cx,
102103 DUPLICATE_MATCH_GUARD ,
103104 arm_body_expr. span ,
104105 "condition duplicates match guard" ,
105- "remove the condition" ,
106- sugg. to_string ( ) ,
107- applicability,
106+ |diag| {
107+ diag. multipart_suggestion_verbose (
108+ "remove the condition" ,
109+ vec ! [ ( remove_block_curlies( arm_body_expr. span) , sugg. to_string( ) ) ] ,
110+ applicability,
111+ ) ;
112+ } ,
108113 ) ;
109114 } else {
110115 // the uncommon case (rusfmt would add the braces here automatically)
You can’t perform that action at this time.
0 commit comments