File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: rustc_lint:: LintContext ;
2
- use clippy_utils:: diagnostics:: span_lint_and_sugg ;
2
+ use clippy_utils:: diagnostics:: span_lint_and_then ;
3
3
use clippy_utils:: source:: snippet_with_context;
4
4
use if_chain:: if_chain;
5
5
use rustc_errors:: Applicability ;
@@ -33,7 +33,6 @@ declare_clippy_lint! {
33
33
pedantic,
34
34
"add a semicolon if nothing is returned"
35
35
}
36
-
37
36
declare_lint_pass ! ( SemicolonIfNothingReturned => [ SEMICOLON_IF_NOTHING_RETURNED ] ) ;
38
37
39
38
impl < ' tcx > LateLintPass < ' tcx > for SemicolonIfNothingReturned {
@@ -52,14 +51,19 @@ impl<'tcx> LateLintPass<'tcx> for SemicolonIfNothingReturned {
52
51
if let ExprKind :: DropTemps ( ..) = & expr. kind {
53
52
return ;
54
53
}
55
- span_lint_and_sugg (
54
+ span_lint_and_then (
56
55
cx,
57
56
SEMICOLON_IF_NOTHING_RETURNED ,
58
57
expr. span. source_callsite( ) ,
59
58
"consider adding a `;` to the last statement for consistent formatting" ,
60
- "add a `;` here" ,
61
- format!( "{snippet};" ) ,
62
- app,
59
+ |diag| {
60
+ diag. span_suggestion(
61
+ expr. span,
62
+ "add a `;` here" ,
63
+ format!( "{snippet};" ) ,
64
+ Applicability :: MachineApplicable ,
65
+ ) ;
66
+ }
63
67
) ;
64
68
}
65
69
}
You can’t perform that action at this time.
0 commit comments