Remove Symbol::len

It is used exactly once and can be replaced with the equally fast
.as_str().len()
This commit is contained in:
bjorn3 2021-09-18 18:01:36 +02:00
parent ce45663e14
commit 9886c233d8
2 changed files with 1 additions and 5 deletions

View File

@ -577,7 +577,7 @@ fn from_str(&mut self, s: &str) -> Result<Self::Literal, ()> {
} }
// Synthesize a new symbol that includes the minus sign. // Synthesize a new symbol that includes the minus sign.
let symbol = Symbol::intern(&s[..1 + lit.symbol.len()]); let symbol = Symbol::intern(&s[..1 + lit.symbol.as_str().len()]);
lit = token::Lit::new(lit.kind, symbol, lit.suffix); lit = token::Lit::new(lit.kind, symbol, lit.suffix);
} }

View File

@ -1642,10 +1642,6 @@ pub fn as_u32(self) -> u32 {
self.0.as_u32() self.0.as_u32()
} }
pub fn len(self) -> usize {
with_session_globals(|session_globals| session_globals.symbol_interner.get(self).len())
}
pub fn is_empty(self) -> bool { pub fn is_empty(self) -> bool {
self == kw::Empty self == kw::Empty
} }