Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/add_missing_match_arms.rs')
-rw-r--r--crates/ide-assists/src/handlers/add_missing_match_arms.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ide-assists/src/handlers/add_missing_match_arms.rs b/crates/ide-assists/src/handlers/add_missing_match_arms.rs
index 37f5f44dfa..8c1c83e3f7 100644
--- a/crates/ide-assists/src/handlers/add_missing_match_arms.rs
+++ b/crates/ide-assists/src/handlers/add_missing_match_arms.rs
@@ -1,17 +1,17 @@
use std::iter::{self, Peekable};
use either::Either;
-use hir::{sym, Adt, Crate, HasAttrs, ImportPathConfig, ModuleDef, Semantics};
-use ide_db::syntax_helpers::suggest_name;
+use hir::{Adt, Crate, HasAttrs, ImportPathConfig, ModuleDef, Semantics, sym};
use ide_db::RootDatabase;
+use ide_db::syntax_helpers::suggest_name;
use ide_db::{famous_defs::FamousDefs, helpers::mod_path_to_ast};
use itertools::Itertools;
use syntax::ast::edit::IndentLevel;
use syntax::ast::edit_in_place::Indent;
use syntax::ast::syntax_factory::SyntaxFactory;
-use syntax::ast::{self, make, AstNode, MatchArmList, MatchExpr, Pat};
+use syntax::ast::{self, AstNode, MatchArmList, MatchExpr, Pat, make};
-use crate::{utils, AssistContext, AssistId, AssistKind, Assists};
+use crate::{AssistContext, AssistId, Assists, utils};
// Assist: add_missing_match_arms
//
@@ -76,7 +76,7 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext<'_>)
let cfg = ctx.config.import_path_config();
- let make = SyntaxFactory::new();
+ let make = SyntaxFactory::with_mappings();
let module = ctx.sema.scope(expr.syntax())?.module();
let (mut missing_pats, is_non_exhaustive, has_hidden_variants): (
@@ -204,7 +204,7 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext<'_>)
}
acc.add(
- AssistId("add_missing_match_arms", AssistKind::QuickFix),
+ AssistId::quick_fix("add_missing_match_arms"),
"Fill match arms",
ctx.sema.original_range(match_expr.syntax()).range,
|builder| {
@@ -294,7 +294,7 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext<'_>)
}
editor.add_mappings(make.take());
- builder.add_file_edits(ctx.file_id(), editor);
+ builder.add_file_edits(ctx.vfs_file_id(), editor);
},
)
}
@@ -386,7 +386,7 @@ impl ExtendedEnum {
fn is_non_exhaustive(self, db: &RootDatabase, krate: Crate) -> bool {
match self {
ExtendedEnum::Enum(e) => {
- e.attrs(db).by_key(&sym::non_exhaustive).exists() && e.module(db).krate() != krate
+ e.attrs(db).by_key(sym::non_exhaustive).exists() && e.module(db).krate() != krate
}
_ => false,
}
@@ -461,7 +461,7 @@ fn build_pat(
let fields = var.fields(db);
let pat: ast::Pat = match var.kind(db) {
hir::StructKind::Tuple => {
- let mut name_generator = suggest_name::NameGenerator::new();
+ let mut name_generator = suggest_name::NameGenerator::default();
let pats = fields.into_iter().map(|f| {
let name = name_generator.for_type(&f.ty(db), db, edition);
match name {