diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-05-03 17:32:06 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-05-03 17:32:06 -0400 |
| commit | b73ad09dfd8ec347799da54f12059e69fa355d1d (patch) | |
| tree | 07f37ca9f6ba09ea3eb97526a17caec7b53dce94 /compiler/rustc_span | |
| parent | 716394d6581b60c75cfdd88b8e5b876f2db88b62 (diff) | |
| download | rust-b73ad09dfd8ec347799da54f12059e69fa355d1d.tar.gz rust-b73ad09dfd8ec347799da54f12059e69fa355d1d.zip | |
Remove SpanInterner::get
- It's used exactly once, so it's trivial to replace - It doesn't match the normal convention for containers: normally `get()` returns and option and indexing panics. Instead `get()` panicked and there's no indexing operation available.
Diffstat (limited to 'compiler/rustc_span')
| -rw-r--r-- | compiler/rustc_span/src/span_encoding.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index ceb9b59b13a..5ea39b343b5 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -102,7 +102,7 @@ impl Span { // Interned format. debug_assert!(self.ctxt_or_zero == 0); let index = self.base_or_index; - with_span_interner(|interner| *interner.get(index)) + with_span_interner(|interner| interner.spans[index as usize]) } } } @@ -117,11 +117,6 @@ impl SpanInterner { let (index, _) = self.spans.insert_full(*span_data); index as u32 } - - #[inline] - fn get(&self, index: u32) -> &SpanData { - &self.spans[index as usize] - } } // If an interner exists, return it. Otherwise, prepare a fresh one. |
