diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-20 07:06:55 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-20 07:06:55 +0000 |
commit | f3125555a8de6fad4529408436800a6b1243a442 (patch) | |
tree | 6cc2943b901f35ea3c351490f15cad9061a69c15 /crates/assists/src | |
parent | 87886e89867d36c14812e70505c4db61a6b66bf0 (diff) | |
parent | f6ed16674c461cb20c39e787fffab2269b9629b0 (diff) |
Merge #6958
6958: Align code_model name with ungrammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/assists/src')
-rw-r--r-- | crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 8 | ||||
-rw-r--r-- | crates/assists/src/handlers/fill_match_arms.rs | 2 | ||||
-rw-r--r-- | crates/assists/src/handlers/fix_visibility.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index 2e56bd7ff..030b9cd0c 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use either::Either; | 3 | use either::Either; |
4 | use hir::{AsName, EnumVariant, Module, ModuleDef, Name}; | 4 | use hir::{AsName, Module, ModuleDef, Name, Variant}; |
5 | use ide_db::helpers::{ | 5 | use ide_db::helpers::{ |
6 | insert_use::{insert_use, ImportScope}, | 6 | insert_use::{insert_use, ImportScope}, |
7 | mod_path_to_ast, | 7 | mod_path_to_ast, |
@@ -53,7 +53,7 @@ pub(crate) fn extract_struct_from_enum_variant( | |||
53 | let variant_hir_name = variant_hir.name(ctx.db()); | 53 | let variant_hir_name = variant_hir.name(ctx.db()); |
54 | let enum_module_def = ModuleDef::from(enum_hir); | 54 | let enum_module_def = ModuleDef::from(enum_hir); |
55 | let usages = | 55 | let usages = |
56 | Definition::ModuleDef(ModuleDef::EnumVariant(variant_hir)).usages(&ctx.sema).all(); | 56 | Definition::ModuleDef(ModuleDef::Variant(variant_hir)).usages(&ctx.sema).all(); |
57 | 57 | ||
58 | let mut visited_modules_set = FxHashSet::default(); | 58 | let mut visited_modules_set = FxHashSet::default(); |
59 | let current_module = enum_hir.module(ctx.db()); | 59 | let current_module = enum_hir.module(ctx.db()); |
@@ -109,7 +109,7 @@ fn extract_field_list_if_applicable( | |||
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &EnumVariant) -> bool { | 112 | fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Variant) -> bool { |
113 | variant | 113 | variant |
114 | .parent_enum(db) | 114 | .parent_enum(db) |
115 | .module(db) | 115 | .module(db) |
@@ -119,7 +119,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &En | |||
119 | // only check type-namespace | 119 | // only check type-namespace |
120 | hir::ScopeDef::ModuleDef(def) => matches!(def, | 120 | hir::ScopeDef::ModuleDef(def) => matches!(def, |
121 | ModuleDef::Module(_) | ModuleDef::Adt(_) | | 121 | ModuleDef::Module(_) | ModuleDef::Adt(_) | |
122 | ModuleDef::EnumVariant(_) | ModuleDef::Trait(_) | | 122 | ModuleDef::Variant(_) | ModuleDef::Trait(_) | |
123 | ModuleDef::TypeAlias(_) | ModuleDef::BuiltinType(_) | 123 | ModuleDef::TypeAlias(_) | ModuleDef::BuiltinType(_) |
124 | ), | 124 | ), |
125 | _ => false, | 125 | _ => false, |
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs index ef12ef0cf..cb60a3128 100644 --- a/crates/assists/src/handlers/fill_match_arms.rs +++ b/crates/assists/src/handlers/fill_match_arms.rs | |||
@@ -192,7 +192,7 @@ fn resolve_tuple_of_enum_def( | |||
192 | .collect() | 192 | .collect() |
193 | } | 193 | } |
194 | 194 | ||
195 | fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::EnumVariant) -> Option<ast::Pat> { | 195 | fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Option<ast::Pat> { |
196 | let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); | 196 | let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); |
197 | 197 | ||
198 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though | 198 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though |
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs index c86720787..8558a8ff0 100644 --- a/crates/assists/src/handlers/fix_visibility.rs +++ b/crates/assists/src/handlers/fix_visibility.rs | |||
@@ -201,7 +201,7 @@ fn target_data_for_def( | |||
201 | (vis_offset(syntax), in_file_source.value.visibility(), syntax.text_range(), file_id) | 201 | (vis_offset(syntax), in_file_source.value.visibility(), syntax.text_range(), file_id) |
202 | } | 202 | } |
203 | // Enum variants can't be private, we can't modify builtin types | 203 | // Enum variants can't be private, we can't modify builtin types |
204 | hir::ModuleDef::EnumVariant(_) | hir::ModuleDef::BuiltinType(_) => return None, | 204 | hir::ModuleDef::Variant(_) | hir::ModuleDef::BuiltinType(_) => return None, |
205 | }; | 205 | }; |
206 | 206 | ||
207 | Some((offset, current_visibility, target, target_file, target_name)) | 207 | Some((offset, current_visibility, target, target_file, target_name)) |