diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-15 20:18:30 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-16 13:28:13 +0200 |
| commit | 543f8bc38c78c05319b5774ec2337c6d3c9b434b (patch) | |
| tree | ff617ed6f58a0e2622730499574eceb7bbccf461 /compiler/rustc_span/src | |
| parent | e6e956dade79bdc084dfe3078abab24656a1b483 (diff) | |
| download | rust-543f8bc38c78c05319b5774ec2337c6d3c9b434b.tar.gz rust-543f8bc38c78c05319b5774ec2337c6d3c9b434b.zip | |
fix clippy::toplevel_ref_arg and ::manual_map
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index aa8859ed1a3..1e9653d0c5b 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -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)))) } } diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 88e3674f899..29a7e74a816 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -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 { |
