Auto merge of #13409 - lukaslueg:issue13407, r=dswij
Fix `if_then_some_else_none` sugg missing closure intro
Fixes #13407
#13407 works in current stable. The suggestion-generating code got trampled over in 0532104247 :-)
changelog: [`if_then_some_else_none`]: Fix missing closure in suggestion
This commit is contained in:
commit
612ae353d7
4 changed files with 17 additions and 1 deletions
|
|
@ -105,6 +105,8 @@ impl<'tcx> LateLintPass<'tcx> for IfThenSomeElseNone {
|
|||
snippet_with_context(cx, first_stmt.span.until(then_arg.span), ctxt, "..", &mut app);
|
||||
let closure = if method_name == "then" { "|| " } else { "" };
|
||||
format!("{closure} {{ {block_snippet}; {arg_snip} }}")
|
||||
} else if method_name == "then" {
|
||||
(std::borrow::Cow::Borrowed("|| ") + arg_snip).into_owned()
|
||||
} else {
|
||||
arg_snip.into_owned()
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue