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
|
||||
.iter()
|
||||
.map(|assignment| assignment.span.until(assignment.rhs_span))
|
||||
.chain(
|
||||
assignments
|
||||
.iter()
|
||||
.map(|assignment| assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi())),
|
||||
)
|
||||
.flat_map(|assignment| {
|
||||
[
|
||||
assignment.span.until(assignment.rhs_span),
|
||||
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
|
||||
]
|
||||
})
|
||||
.map(|span| Some((span, String::new())))
|
||||
.collect::<Option<Vec<(Span, String)>>>()?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue