Skip to content

Commit

Permalink
Remove Symbol::len
Browse files Browse the repository at this point in the history
It is used exactly once and can be replaced with the equally fast
.as_str().len()
  • Loading branch information
bjorn3 committed Sep 22, 2021
1 parent ce45663 commit 9886c23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/proc_macro_server.rs
Expand Up @@ -577,7 +577,7 @@ impl server::Literal for Rustc<'_> {
}

// 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);
}

Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_span/src/symbol.rs
Expand Up @@ -1642,10 +1642,6 @@ impl Symbol {
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 {
self == kw::Empty
}
Expand Down

0 comments on commit 9886c23

Please sign in to comment.