Skip to content

Commit

Permalink
Remove SpanInterner::get
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
jyn514 committed May 3, 2021
1 parent 716394d commit b73ad09
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions compiler/rustc_span/src/span_encoding.rs
Expand Up @@ -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])
}
}
}
Expand All @@ -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.
Expand Down

0 comments on commit b73ad09

Please sign in to comment.