mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +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
@ -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 New Issue
Block a user