diff options
| author | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-10-15 20:36:39 +0900 |
|---|---|---|
| committer | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-10-15 23:59:08 +0900 |
| commit | 751bcf5fa08ee5c5ba156e43c7f8327f7968b02f (patch) | |
| tree | e09c906d3e3a2f64c60c10e23a83d0cd9648f1d1 /src/source_map.rs | |
| parent | d55729987ff798b49838e5b5707cfca807b5b6b7 (diff) | |
Clippy
Diffstat (limited to 'src/source_map.rs')
| -rw-r--r-- | src/source_map.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/source_map.rs b/src/source_map.rs index dee5e4f7601..ed081adcd86 100644 --- a/src/source_map.rs +++ b/src/source_map.rs @@ -51,11 +51,13 @@ impl<'a> SpanUtils for SnippetProvider<'a> { } fn span_before(&self, original: Span, needle: &str) -> BytePos { - self.opt_span_before(original, needle).expect(&format!( - "bad span: {}: {}", - needle, - self.span_to_snippet(original).unwrap() - )) + self.opt_span_before(original, needle).unwrap_or_else(|| { + panic!( + "bad span: {}: {}", + needle, + self.span_to_snippet(original).unwrap() + ) + }) } fn opt_span_after(&self, original: Span, needle: &str) -> Option<BytePos> { |
