We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
SourceFileRange::as_str
2 parents 88bcf1c + 2d8d45e commit 151a045Copy full SHA for 151a045
clippy_utils/src/source.rs
@@ -342,11 +342,8 @@ impl SourceFileRange {
342
/// Attempts to get the text from the source file. This can fail if the source text isn't
343
/// loaded.
344
pub fn as_str(&self) -> Option<&str> {
345
- self.sf
346
- .src
347
- .as_ref()
348
- .map(|src| src.as_str())
349
- .or_else(|| self.sf.external_src.get().and_then(|src| src.get_source()))
+ (self.sf.src.as_ref().map(|src| src.as_str()))
+ .or_else(|| self.sf.external_src.get()?.get_source())
350
.and_then(|x| x.get(self.range.clone()))
351
}
352
0 commit comments