Prefer unwrap_or_else to unwrap_or in case of function calls/allocations
This commit is contained in:
parent
cb5e1b93e3
commit
d28aed6dc4
35 changed files with 57 additions and 54 deletions
|
@ -942,7 +942,8 @@ impl SourceMap {
|
|||
} else {
|
||||
format!("{}<", &snippet[..offset])
|
||||
};
|
||||
new_snippet.push_str(&self.span_to_snippet(span).unwrap_or("T".to_string()));
|
||||
new_snippet.push_str(
|
||||
&self.span_to_snippet(span).unwrap_or_else(|_| "T".to_string()));
|
||||
new_snippet.push('>');
|
||||
|
||||
return Some((sugg_span, new_snippet));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue