diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 16:50:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 16:50:40 +0100 |
commit | 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 (patch) | |
tree | 2bda021d9fafc6af927ebfbcafd31537496bd53c /crates/ra_assists | |
parent | 1ae4721c9cfea746fce59a816b1c266bf373d6cf (diff) |
Rename StructDef -> Struct
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/handlers/change_visibility.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/generate_new.rs | 6 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/move_bounds.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 72d06d55b..12c40a3cc 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, NameOwner, VisibilityOwner}, | 2 | ast::{self, NameOwner, VisibilityOwner}, |
3 | AstNode, | 3 | AstNode, |
4 | SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY}, | 4 | SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT, TRAIT_DEF, VISIBILITY}, |
5 | T, | 5 | T, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | 7 | use test_utils::mark; |
@@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
36 | 36 | ||
37 | let (offset, target) = if let Some(keyword) = item_keyword { | 37 | let (offset, target) = if let Some(keyword) = item_keyword { |
38 | let parent = keyword.parent(); | 38 | let parent = keyword.parent(); |
39 | let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF]; | 39 | let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT, ENUM_DEF, TRAIT_DEF]; |
40 | // Parent is not a definition, can't add visibility | 40 | // Parent is not a definition, can't add visibility |
41 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { | 41 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { |
42 | return None; | 42 | return None; |
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs index 340f9b103..22b47d254 100644 --- a/crates/ra_assists/src/handlers/generate_new.rs +++ b/crates/ra_assists/src/handlers/generate_new.rs | |||
@@ -31,7 +31,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
31 | // | 31 | // |
32 | // ``` | 32 | // ``` |
33 | pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 33 | pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
34 | let strukt = ctx.find_node_at_offset::<ast::StructDef>()?; | 34 | let strukt = ctx.find_node_at_offset::<ast::Struct>()?; |
35 | 35 | ||
36 | // We want to only apply this to non-union structs with named fields | 36 | // We want to only apply this to non-union structs with named fields |
37 | let field_list = match strukt.kind() { | 37 | let field_list = match strukt.kind() { |
@@ -91,7 +91,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
91 | 91 | ||
92 | // Generates the surrounding `impl Type { <code> }` including type and lifetime | 92 | // Generates the surrounding `impl Type { <code> }` including type and lifetime |
93 | // parameters | 93 | // parameters |
94 | fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | 94 | fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String { |
95 | let type_params = strukt.generic_param_list(); | 95 | let type_params = strukt.generic_param_list(); |
96 | let mut buf = String::with_capacity(code.len()); | 96 | let mut buf = String::with_capacity(code.len()); |
97 | buf.push_str("\n\nimpl"); | 97 | buf.push_str("\n\nimpl"); |
@@ -122,7 +122,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | |||
122 | // | 122 | // |
123 | // FIXME: change the new fn checking to a more semantic approach when that's more | 123 | // FIXME: change the new fn checking to a more semantic approach when that's more |
124 | // viable (e.g. we process proc macros, etc) | 124 | // viable (e.g. we process proc macros, etc) |
125 | fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Option<ast::ImplDef>> { | 125 | fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::ImplDef>> { |
126 | let db = ctx.db(); | 126 | let db = ctx.db(); |
127 | let module = strukt.syntax().ancestors().find(|node| { | 127 | let module = strukt.syntax().ancestors().find(|node| { |
128 | ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) | 128 | ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) |
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 15327facb..3b82477c5 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs | |||
@@ -41,7 +41,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext | |||
41 | ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 41 | ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), |
42 | ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 42 | ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), |
43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), | 43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), |
44 | ast::StructDef(it) => { | 44 | ast::Struct(it) => { |
45 | it.syntax().children_with_tokens() | 45 | it.syntax().children_with_tokens() |
46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? | 46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? |
47 | }, | 47 | }, |