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.
This commit is contained in:
commit
44bee536fe
1 changed files with 1 additions and 6 deletions
|
@ -102,7 +102,7 @@ impl Span {
|
||||||
// Interned format.
|
// Interned format.
|
||||||
debug_assert!(self.ctxt_or_zero == 0);
|
debug_assert!(self.ctxt_or_zero == 0);
|
||||||
let index = self.base_or_index;
|
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);
|
let (index, _) = self.spans.insert_full(*span_data);
|
||||||
index as u32
|
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.
|
// If an interner exists, return it. Otherwise, prepare a fresh one.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue