Skip to content

Commit 9886c23

Browse files
committed
Remove Symbol::len
It is used exactly once and can be replaced with the equally fast .as_str().len()
1 parent ce45663 commit 9886c23

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl server::Literal for Rustc<'_> {
577577
}
578578

579579
// Synthesize a new symbol that includes the minus sign.
580-
let symbol = Symbol::intern(&s[..1 + lit.symbol.len()]);
580+
let symbol = Symbol::intern(&s[..1 + lit.symbol.as_str().len()]);
581581
lit = token::Lit::new(lit.kind, symbol, lit.suffix);
582582
}
583583

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,10 +1642,6 @@ impl Symbol {
16421642
self.0.as_u32()
16431643
}
16441644

1645-
pub fn len(self) -> usize {
1646-
with_session_globals(|session_globals| session_globals.symbol_interner.get(self).len())
1647-
}
1648-
16491645
pub fn is_empty(self) -> bool {
16501646
self == kw::Empty
16511647
}

0 commit comments

Comments
 (0)