1
Fork 0

fix clippy::toplevel_ref_arg and ::manual_map

This commit is contained in:
Matthias Krüger 2023-04-15 20:18:30 +02:00
parent e6e956dade
commit 543f8bc38c
12 changed files with 42 additions and 70 deletions

View file

@ -1663,10 +1663,11 @@ impl SourceFile {
if let Some(ref src) = self.src {
Some(Cow::from(get_until_newline(src, begin)))
} else if let Some(src) = self.external_src.borrow().get_source() {
Some(Cow::Owned(String::from(get_until_newline(src, begin))))
} else {
None
self.external_src
.borrow()
.get_source()
.map(|src| Cow::Owned(String::from(get_until_newline(src, begin))))
}
}

View file

@ -906,10 +906,8 @@ impl SourceMap {
let snippet = if let Some(ref src) = local_begin.sf.src {
Some(&src[start_index..])
} else if let Some(src) = src.get_source() {
Some(&src[start_index..])
} else {
None
src.get_source().map(|src| &src[start_index..])
};
match snippet {