@@ -418,7 +418,7 @@ impl EarlyLintPass for CollapsibleCalls {
418418 if let ExprKind :: Block ( block, _) = & block. kind;
419419 let stmts = & block. stmts;
420420 if stmts. len( ) == 1 ;
421- if let StmtKind :: Expr ( only_expr) = & stmts[ 0 ] . kind;
421+ if let StmtKind :: Semi ( only_expr) = & stmts[ 0 ] . kind;
422422 if let ExprKind :: MethodCall ( ref ps, ref span_call_args) = & only_expr. kind;
423423 let and_then_args = get_and_then_args( cx, and_then_args) ;
424424 then {
@@ -480,7 +480,6 @@ fn suggestion_args<'a>(cx: &EarlyContext<'_>, span_call_args: &Vec<P<AstExpr>>)
480480
481481fn suggest_span_suggestion ( cx : & EarlyContext < ' _ > , expr : & AstExpr , and_then_args : AndThenArgs < ' _ > , suggestion_args : SuggestionArgs < ' _ > ) {
482482 if and_then_args. span == suggestion_args. span {
483- println ! ( "suggestion true" ) ;
484483 span_lint_and_sugg (
485484 cx,
486485 COLLAPSIBLE_SPAN_LINT_CALLS ,
@@ -499,6 +498,16 @@ fn suggest_span_suggestion(cx: &EarlyContext<'_>, expr: &AstExpr, and_then_args:
499498 ) ,
500499 Applicability :: MachineApplicable
501500 ) ;
501+ } else {
502+ span_lint_and_sugg (
503+ cx,
504+ COLLAPSIBLE_SPAN_LINT_CALLS ,
505+ expr. span ,
506+ "Lint activated" ,
507+ "Lint helped" ,
508+ "modify to" . to_string ( ) ,
509+ Applicability :: MachineApplicable
510+ )
502511 }
503512}
504513
@@ -562,11 +571,12 @@ fn suggest_span_note(cx: &EarlyContext<'_>, expr: &AstExpr, and_then_args: AndTh
562571 "this call is collspible" ,
563572 "collapse into" ,
564573 format ! (
565- "span_lint_and_note({},{}, {}, {}, {})" ,
574+ "span_lint_and_note({}, {}, {}, {}, {}, {})" ,
566575 and_then_args. cx,
567576 and_then_args. lint,
568577 and_then_args. span,
569578 and_then_args. msg,
579+ and_then_args. span,
570580 note_args. note
571581 ) ,
572582 Applicability :: MachineApplicable
@@ -575,5 +585,5 @@ fn suggest_span_note(cx: &EarlyContext<'_>, expr: &AstExpr, and_then_args: AndTh
575585}
576586
577587fn snippet < ' a > ( cx : & EarlyContext < ' _ > , span : Span ) -> Cow < ' a , str > {
578- other_snippet ( cx, span, "Should not be" )
588+ other_snippet ( cx, span, "Should not be this snippet " )
579589}
0 commit comments