mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
needless_late_init refactoring
Simplify the creation of suggestions by using `flat_map` instead of `chain`. Note that the order of the suggestions is not important.
This commit is contained in:
parent
94e321a6ff
commit
2a1a80d80c
1 changed files with 6 additions and 6 deletions
|
@ -185,12 +185,12 @@ fn assignment_suggestions<'tcx>(
|
||||||
|
|
||||||
let suggestions = assignments
|
let suggestions = assignments
|
||||||
.iter()
|
.iter()
|
||||||
.map(|assignment| assignment.span.until(assignment.rhs_span))
|
.flat_map(|assignment| {
|
||||||
.chain(
|
[
|
||||||
assignments
|
assignment.span.until(assignment.rhs_span),
|
||||||
.iter()
|
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
|
||||||
.map(|assignment| assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi())),
|
]
|
||||||
)
|
})
|
||||||
.map(|span| Some((span, String::new())))
|
.map(|span| Some((span, String::new())))
|
||||||
.collect::<Option<Vec<(Span, String)>>>()?;
|
.collect::<Option<Vec<(Span, String)>>>()?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue