refactor(rustfix): only compute snippets when needed

This commit is contained in:
Weihang Lo 2024-10-20 12:13:42 -04:00
parent f483dc0b95
commit c9102e54bb
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -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
.children
.iter()
@ -204,7 +202,7 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
} else {
Some(Suggestion {
message: diagnostic.message.clone(),
snippets,
snippets: diagnostic.spans.iter().map(span_to_snippet).collect(),
solutions,
})
}