diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-05-08 01:06:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-08 01:06:23 +0200 |
| commit | 44bee536fea1031ce97b9b89ca5a1b3ca5d348e0 (patch) | |
| tree | 2d6c4434e8bd065f2f9b9579be4693716b10b851 /compiler/rustc_span/src | |
| parent | eb36bc666a4e1e8b6f54f50f275ae10a4c22c77f (diff) | |
| parent | b73ad09dfd8ec347799da54f12059e69fa355d1d (diff) | |
| download | rust-44bee536fea1031ce97b9b89ca5a1b3ca5d348e0.tar.gz rust-44bee536fea1031ce97b9b89ca5a1b3ca5d348e0.zip | |
Rollup merge of #84887 - jyn514:index-span, r=Xanewok
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 an option and indexing panics. Instead `SpanInterner::get()` panics and there's no indexing operation available.
Diffstat (limited to 'compiler/rustc_span/src')
| -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. |
