Skip to content

Commit 8583e35

Browse files
committed
replace make:: to SyntaxFactory:: in inline_type_alias
1 parent 96f619d commit 8583e35

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

crates/ide-assists/src/handlers/inline_type_alias.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ use ide_db::{
99
search::FileReference,
1010
};
1111
use itertools::Itertools;
12+
use syntax::ast::syntax_factory::SyntaxFactory;
1213
use syntax::syntax_editor::SyntaxEditor;
1314
use syntax::{
1415
AstNode, NodeOrToken, SyntaxNode,
15-
ast::{self, HasGenericParams, HasName, make},
16+
ast::{self, HasGenericParams, HasName},
1617
};
1718

1819
use crate::{
@@ -206,8 +207,8 @@ impl LifetimeMap {
206207
alias_generics: &ast::GenericParamList,
207208
) -> Option<Self> {
208209
let mut inner = FxHashMap::default();
209-
210-
let wildcard_lifetime = make::lifetime("'_");
210+
let make = SyntaxFactory::without_mappings();
211+
let wildcard_lifetime = make.lifetime("'_");
211212
let lifetimes = alias_generics
212213
.lifetime_params()
213214
.filter_map(|lp| lp.lifetime())
@@ -334,9 +335,10 @@ fn create_replacement(
334335
};
335336
let new_string = replacement_syntax.to_string();
336337
let new = if new_string == "_" {
337-
make::wildcard_pat().syntax().clone_for_update()
338+
let make = SyntaxFactory::without_mappings();
339+
make.wildcard_pat().syntax().clone()
338340
} else {
339-
replacement_syntax.clone_for_update()
341+
replacement_syntax.clone()
340342
};
341343

342344
replacements.push((syntax.clone(), new));
@@ -385,12 +387,15 @@ impl ConstOrTypeGeneric {
385387
}
386388

387389
fn replacement_value(&self) -> Option<SyntaxNode> {
388-
Some(match self {
389-
ConstOrTypeGeneric::ConstArg(ca) => ca.expr()?.syntax().clone(),
390-
ConstOrTypeGeneric::TypeArg(ta) => ta.syntax().clone(),
391-
ConstOrTypeGeneric::ConstParam(cp) => cp.default_val()?.syntax().clone(),
392-
ConstOrTypeGeneric::TypeParam(tp) => tp.default_type()?.syntax().clone(),
393-
})
390+
Some(
391+
match self {
392+
ConstOrTypeGeneric::ConstArg(ca) => ca.expr()?.syntax().clone(),
393+
ConstOrTypeGeneric::TypeArg(ta) => ta.syntax().clone(),
394+
ConstOrTypeGeneric::ConstParam(cp) => cp.default_val()?.syntax().clone(),
395+
ConstOrTypeGeneric::TypeParam(tp) => tp.default_type()?.syntax().clone(),
396+
}
397+
.clone_for_update(),
398+
)
394399
}
395400
}
396401

0 commit comments

Comments
 (0)