diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-12-04 03:30:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-04 03:30:39 +0100 |
| commit | 5cebbaa6a1509ca17cef41ef61df624dad9740c2 (patch) | |
| tree | 7738d2bb9056330eec73545e7897eeaae171629e /compiler/rustc_span/src/source_map.rs | |
| parent | a2aa3d6e49d472b2218d81ec6ef34e2a2e6ad883 (diff) | |
| parent | 0ad3dce83a4506875e6b1381f5261e458b5c5d98 (diff) | |
Rollup merge of #79678 - jyn514:THE-PAPERCLIP-COMETH, r=varkor
Fix some clippy lints
Happy to revert these if you think they're less readable, but personally I like them better now (especially the `else { if { ... } }` to `else if { ... }` change).
Diffstat (limited to 'compiler/rustc_span/src/source_map.rs')
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index f067cdb7308..e9b4eb6e4ab 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -623,7 +623,7 @@ impl SourceMap { self.span_to_source(sp, |src, start_index, end_index| { src.get(start_index..end_index) .map(|s| s.to_string()) - .ok_or_else(|| SpanSnippetError::IllFormedSpan(sp)) + .ok_or(SpanSnippetError::IllFormedSpan(sp)) }) } @@ -640,9 +640,7 @@ impl SourceMap { /// Returns the source snippet as `String` before the given `Span`. pub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError> { self.span_to_source(sp, |src, start_index, _| { - src.get(..start_index) - .map(|s| s.to_string()) - .ok_or_else(|| SpanSnippetError::IllFormedSpan(sp)) + src.get(..start_index).map(|s| s.to_string()).ok_or(SpanSnippetError::IllFormedSpan(sp)) }) } |
