mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
refactor(rustfix): only compute snippets when needed
This commit is contained in:
parent
f483dc0b95
commit
c9102e54bb
@ -167,8 +167,6 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let snippets = diagnostic.spans.iter().map(span_to_snippet).collect();
|
|
||||||
|
|
||||||
let solutions: Vec<_> = diagnostic
|
let solutions: Vec<_> = diagnostic
|
||||||
.children
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
@ -204,7 +202,7 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
|
|||||||
} else {
|
} else {
|
||||||
Some(Suggestion {
|
Some(Suggestion {
|
||||||
message: diagnostic.message.clone(),
|
message: diagnostic.message.clone(),
|
||||||
snippets,
|
snippets: diagnostic.spans.iter().map(span_to_snippet).collect(),
|
||||||
solutions,
|
solutions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user