mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
needless_late_init refactoring
Remove duplication in creating suggestions by first mapping assignments to spans and then suggestions.
This commit is contained in:
parent
542d474d38
commit
94e321a6ff
1 changed files with 7 additions and 7 deletions
|
@ -185,13 +185,13 @@ 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((
|
||||
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
|
||||
String::new(),
|
||||
))
|
||||
}))
|
||||
.map(|assignment| assignment.span.until(assignment.rhs_span))
|
||||
.chain(
|
||||
assignments
|
||||
.iter()
|
||||
.map(|assignment| assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi())),
|
||||
)
|
||||
.map(|span| Some((span, String::new())))
|
||||
.collect::<Option<Vec<(Span, String)>>>()?;
|
||||
|
||||
match suggestions.len() {
|
||||
|
|
Loading…
Reference in a new issue