mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Remove Name::to_smol_str
This commit is contained in:
parent
df5f1777b8
commit
2346a80ab4
54 changed files with 288 additions and 190 deletions
|
@ -10,7 +10,7 @@ use hir_def::{
|
|||
};
|
||||
use hir_expand::{HirFileId, InFile};
|
||||
use hir_ty::{db::HirDatabase, display::HirDisplay};
|
||||
use syntax::{ast::HasName, AstNode, AstPtr, SmolStr, SyntaxNode, SyntaxNodePtr};
|
||||
use syntax::{ast::HasName, AstNode, AstPtr, SmolStr, SyntaxNode, SyntaxNodePtr, ToSmolStr};
|
||||
|
||||
use crate::{Module, ModuleDef, Semantics};
|
||||
|
||||
|
@ -258,10 +258,18 @@ impl<'a> SymbolCollector<'a> {
|
|||
|
||||
fn def_with_body_id_name(&self, body_id: DefWithBodyId) -> Option<SmolStr> {
|
||||
match body_id {
|
||||
DefWithBodyId::FunctionId(id) => Some(self.db.function_data(id).name.to_smol_str()),
|
||||
DefWithBodyId::StaticId(id) => Some(self.db.static_data(id).name.to_smol_str()),
|
||||
DefWithBodyId::ConstId(id) => Some(self.db.const_data(id).name.as_ref()?.to_smol_str()),
|
||||
DefWithBodyId::VariantId(id) => Some(self.db.enum_variant_data(id).name.to_smol_str()),
|
||||
DefWithBodyId::FunctionId(id) => {
|
||||
Some(self.db.function_data(id).name.display_no_db().to_smolstr())
|
||||
}
|
||||
DefWithBodyId::StaticId(id) => {
|
||||
Some(self.db.static_data(id).name.display_no_db().to_smolstr())
|
||||
}
|
||||
DefWithBodyId::ConstId(id) => {
|
||||
Some(self.db.const_data(id).name.as_ref()?.display_no_db().to_smolstr())
|
||||
}
|
||||
DefWithBodyId::VariantId(id) => {
|
||||
Some(self.db.enum_variant_data(id).name.display_no_db().to_smolstr())
|
||||
}
|
||||
DefWithBodyId::InTypeConstId(_) => Some("in type const".into()),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue