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
|
@ -9,6 +9,7 @@ use itertools::Itertools;
|
|||
use rustc_hash::FxHashSet;
|
||||
use smallvec::SmallVec;
|
||||
use stdx::{format_to, TupleExt};
|
||||
use syntax::ToSmolStr;
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::{
|
||||
|
@ -81,9 +82,9 @@ impl ImportMap {
|
|||
.iter()
|
||||
// We've only collected items, whose name cannot be tuple field so unwrapping is fine.
|
||||
.flat_map(|(&item, (info, _))| {
|
||||
info.iter()
|
||||
.enumerate()
|
||||
.map(move |(idx, info)| (item, info.name.to_smol_str(), idx as u32))
|
||||
info.iter().enumerate().map(move |(idx, info)| {
|
||||
(item, info.name.display(db.upcast()).to_smolstr(), idx as u32)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
importables.sort_by(|(_, l_info, _), (_, r_info, _)| {
|
||||
|
@ -412,7 +413,7 @@ pub fn search_dependencies(
|
|||
for map in &import_maps {
|
||||
op = op.add(map.fst.search(&automaton));
|
||||
}
|
||||
search_maps(&import_maps, op.union(), query)
|
||||
search_maps(db, &import_maps, op.union(), query)
|
||||
}
|
||||
SearchMode::Fuzzy => {
|
||||
let automaton = fst::automaton::Subsequence::new(&query.lowercased);
|
||||
|
@ -420,7 +421,7 @@ pub fn search_dependencies(
|
|||
for map in &import_maps {
|
||||
op = op.add(map.fst.search(&automaton));
|
||||
}
|
||||
search_maps(&import_maps, op.union(), query)
|
||||
search_maps(db, &import_maps, op.union(), query)
|
||||
}
|
||||
SearchMode::Prefix => {
|
||||
let automaton = fst::automaton::Str::new(&query.lowercased).starts_with();
|
||||
|
@ -428,12 +429,13 @@ pub fn search_dependencies(
|
|||
for map in &import_maps {
|
||||
op = op.add(map.fst.search(&automaton));
|
||||
}
|
||||
search_maps(&import_maps, op.union(), query)
|
||||
search_maps(db, &import_maps, op.union(), query)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn search_maps(
|
||||
db: &dyn DefDatabase,
|
||||
import_maps: &[Arc<ImportMap>],
|
||||
mut stream: fst::map::Union<'_>,
|
||||
query: &Query,
|
||||
|
@ -459,7 +461,7 @@ fn search_maps(
|
|||
query.search_mode.check(
|
||||
&query.query,
|
||||
query.case_sensitive,
|
||||
&info.name.to_smol_str(),
|
||||
&info.name.display(db.upcast()).to_smolstr(),
|
||||
)
|
||||
});
|
||||
res.extend(iter.map(TupleExt::head));
|
||||
|
|
|
@ -24,6 +24,7 @@ use hir_expand::{
|
|||
span_map::SpanMapRef,
|
||||
InFile, MacroFileId, MacroFileIdExt,
|
||||
};
|
||||
use intern::Symbol;
|
||||
use span::Span;
|
||||
use stdx::{format_to, format_to_acc};
|
||||
use syntax::{
|
||||
|
@ -55,7 +56,7 @@ pub fn identity_when_valid(_attr: TokenStream, item: TokenStream) -> TokenStream
|
|||
"#
|
||||
.into(),
|
||||
ProcMacro {
|
||||
name: "identity_when_valid".into(),
|
||||
name: Symbol::intern("identity_when_valid"),
|
||||
kind: ProcMacroKind::Attr,
|
||||
expander: sync::Arc::new(IdentityWhenValidProcMacroExpander),
|
||||
disabled: false,
|
||||
|
|
|
@ -82,7 +82,7 @@ pub(super) fn collect_defs(db: &dyn DefDatabase, def_map: DefMap, tree_id: TreeI
|
|||
.iter()
|
||||
.enumerate()
|
||||
.map(|(idx, it)| {
|
||||
let name = Name::new(&it.name, tt::IdentIsRaw::No, ctx);
|
||||
let name = Name::new_symbol(it.name.clone(), ctx);
|
||||
(
|
||||
name,
|
||||
if !db.expand_proc_attr_macros() {
|
||||
|
|
|
@ -3,6 +3,7 @@ use arrayvec::ArrayVec;
|
|||
use base_db::{AnchoredPath, FileId};
|
||||
use hir_expand::{name::Name, HirFileIdExt, MacroFileIdExt};
|
||||
use limit::Limit;
|
||||
use syntax::ToSmolStr as _;
|
||||
|
||||
use crate::{db::DefDatabase, HirFileId};
|
||||
|
||||
|
@ -33,7 +34,7 @@ impl ModDir {
|
|||
let path = match attr_path {
|
||||
None => {
|
||||
let mut path = self.dir_path.clone();
|
||||
path.push(&name.unescaped().to_smol_str());
|
||||
path.push(&name.unescaped().display_no_db().to_smolstr());
|
||||
path
|
||||
}
|
||||
Some(attr_path) => {
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
};
|
||||
use hir_expand::name::Name;
|
||||
use intern::Interned;
|
||||
use syntax::ast;
|
||||
use syntax::{ast, ToSmolStr};
|
||||
|
||||
pub use hir_expand::mod_path::{path, ModPath, PathKind};
|
||||
|
||||
|
@ -29,7 +29,7 @@ impl Display for ImportAlias {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
ImportAlias::Underscore => f.write_str("_"),
|
||||
ImportAlias::Alias(name) => f.write_str(&name.to_smol_str()),
|
||||
ImportAlias::Alias(name) => f.write_str(&name.display_no_db().to_smolstr()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue