diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-09-18 18:01:36 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-09-22 13:37:09 +0200 |
| commit | 9886c233d84c231030af76419d002996df981ebc (patch) | |
| tree | a8bcec45a11b49d7bbd6f6f54485a336ccfb06fb | |
| parent | ce45663e14dac3f0f58be698cc530bc2e6e21682 (diff) | |
| download | rust-9886c233d84c231030af76419d002996df981ebc.tar.gz rust-9886c233d84c231030af76419d002996df981ebc.zip | |
Remove Symbol::len
It is used exactly once and can be replaced with the equally fast .as_str().len()
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro_server.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 4 |
2 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 52b60c3047e..5cb97198765 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -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); } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7c2a09e0a32..eaf92487bff 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -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 } |
