commit
151a045fdd
1 changed files with 2 additions and 5 deletions
|
|
@ -342,11 +342,8 @@ impl SourceFileRange {
|
|||
/// Attempts to get the text from the source file. This can fail if the source text isn't
|
||||
/// loaded.
|
||||
pub fn as_str(&self) -> Option<&str> {
|
||||
self.sf
|
||||
.src
|
||||
.as_ref()
|
||||
.map(|src| src.as_str())
|
||||
.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())
|
||||
.and_then(|x| x.get(self.range.clone()))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue