Auto merge of #8951 - mikerite:needless-late-init-20220605, r=giraffate

Some refactoring in `needless_late_init`

changelog: none
This commit is contained in:
bors 2022-06-06 00:25:14 +00:00
commit 3e771624e1

View file

@ -185,14 +185,14 @@ fn assignment_suggestions<'tcx>(
let suggestions = assignments
.iter()
.map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
.chain(assignments.iter().map(|assignment| {
Some((
.flat_map(|assignment| {
[
assignment.span.until(assignment.rhs_span),
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
String::new(),
))
}))
.collect::<Option<Vec<(Span, String)>>>()?;
]
})
.map(|span| (span, String::new()))
.collect::<Vec<(Span, String)>>();
match suggestions.len() {
// All of `exprs` are never types