Replace more Name::to_string usages with Name::to_smol_str

This commit is contained in:
Lukas Wirth 2021-11-04 18:12:05 +01:00
parent 962be38004
commit 439a8194b0
24 changed files with 49 additions and 41 deletions

View file

@ -580,7 +580,7 @@ impl Module {
});
for token in tokens {
if token.kind() == SyntaxKind::IDENT
&& token.text() == derive_name.as_str()
&& token.text() == &**derive_name
{
precise_location = Some(token.text_range());
break 'outer;
@ -606,7 +606,12 @@ impl Module {
}
};
acc.push(
UnresolvedProcMacro { node, precise_location, macro_name: name }.into(),
UnresolvedProcMacro {
node,
precise_location,
macro_name: name.map(Into::into),
}
.into(),
);
}
@ -2219,7 +2224,7 @@ impl Impl {
.attrs()
.filter_map(|it| {
let path = ModPath::from_src(db.upcast(), it.path()?, &hygenic)?;
if path.as_ident()?.to_string() == "derive" {
if path.as_ident()?.to_smol_str() == "derive" {
Some(it)
} else {
None