From 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:50:40 +0200 Subject: Rename StructDef -> Struct --- crates/ra_ide/src/display/navigation_target.rs | 4 +-- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 4 +-- crates/ra_ide/src/goto_implementation.rs | 2 +- crates/ra_ide/src/hover.rs | 34 +++++++++++++------------- crates/ra_ide/src/references.rs | 16 ++++++------ crates/ra_ide/src/syntax_highlighting.rs | 2 +- 7 files changed, 32 insertions(+), 32 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 797d2d8e3..5686faaab 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -380,7 +380,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option match_ast! { match node { ast::Fn(it) => it.doc_comment_text(), - ast::StructDef(it) => it.doc_comment_text(), + ast::Struct(it) => it.doc_comment_text(), ast::EnumDef(it) => it.doc_comment_text(), ast::TraitDef(it) => it.doc_comment_text(), ast::Module(it) => it.doc_comment_text(), @@ -405,7 +405,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> match_ast! { match node { ast::Fn(it) => it.short_label(), - ast::StructDef(it) => it.short_label(), + ast::Struct(it) => it.short_label(), ast::EnumDef(it) => it.short_label(), ast::TraitDef(it) => it.short_label(), ast::Module(it) => it.short_label(), diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 730df1414..504b884c5 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -13,7 +13,7 @@ impl ShortLabel for ast::Fn { } } -impl ShortLabel for ast::StructDef { +impl ShortLabel for ast::Struct { fn short_label(&self) -> Option { short_label_from_node(self, "struct ") } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 874cf72ef..6f198fcbc 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -126,7 +126,7 @@ fn structure_node(node: &SyntaxNode) -> Option { decl_with_detail(it, Some(detail)) }, - ast::StructDef(it) => decl(it), + ast::Struct(it) => decl(it), ast::Union(it) => decl(it), ast::EnumDef(it) => decl(it), ast::EnumVariant(it) => decl(it), @@ -238,7 +238,7 @@ fn very_obsolete() {} label: "Foo", navigation_range: 8..11, node_range: 1..26, - kind: STRUCT_DEF, + kind: STRUCT, detail: None, deprecated: false, }, diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index e41a4a12b..699fad57d 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs @@ -44,7 +44,7 @@ fn impls_for_def( krate: Crate, ) -> Option> { let ty = match node { - ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db), + ast::AdtDef::Struct(def) => sema.to_def(def)?.ty(sema.db), ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db), ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db), }; diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 4ef7efd26..83228af2e 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -1443,7 +1443,7 @@ fn main() { let s<|>t = S{ f1:0 }; } 7..8, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1482,7 +1482,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } 24..25, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1501,7 +1501,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } 7..10, ), name: "Arg", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct Arg", @@ -1540,7 +1540,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 24..25, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1559,7 +1559,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 7..10, ), name: "Arg", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct Arg", @@ -1601,7 +1601,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 7..8, ), name: "A", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct A", @@ -1620,7 +1620,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 22..23, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -1639,7 +1639,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 53..54, ), name: "C", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "pub struct C", @@ -1737,7 +1737,7 @@ fn main() { let s<|>t = foo(); } 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1877,7 +1877,7 @@ fn main() { let s<|>t = foo(); } 39..41, ), name: "S1", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S1", @@ -1896,7 +1896,7 @@ fn main() { let s<|>t = foo(); } 52..54, ), name: "S2", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S2", @@ -2011,7 +2011,7 @@ fn foo(ar<|>g: &impl Foo + Bar) {} 36..37, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2068,7 +2068,7 @@ fn foo(ar<|>g: &impl Foo) {} 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2111,7 +2111,7 @@ fn main() { let s<|>t = foo(); } 49..50, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -2224,7 +2224,7 @@ fn foo(ar<|>g: &dyn Foo) {} 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2284,7 +2284,7 @@ fn foo(a<|>rg: &impl ImplTrait>>>) {} 50..51, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -2322,7 +2322,7 @@ fn foo(a<|>rg: &impl ImplTrait>>>) {} 65..66, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index d61ac271e..2a62dab6c 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -172,7 +172,7 @@ fn get_struct_def_name_for_struct_literal_search( if let Some(name) = sema.find_node_at_offset_with_descend::(&syntax, left.text_range().start()) { - return name.syntax().ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); + return name.syntax().ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); } if sema .find_node_at_offset_with_descend::( @@ -181,7 +181,7 @@ fn get_struct_def_name_for_struct_literal_search( ) .is_some() { - return left.ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); + return left.ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); } } None @@ -212,7 +212,7 @@ fn main() { ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..26 7..10 Other", + "Foo STRUCT FileId(1) 0..26 7..10 Other", &["FileId(1) 101..104 StructLiteral"], ); } @@ -230,7 +230,7 @@ struct Foo<|> {} ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..13 7..10 Other", + "Foo STRUCT FileId(1) 0..13 7..10 Other", &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], ); } @@ -248,7 +248,7 @@ struct Foo <|>{} ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", + "Foo STRUCT FileId(1) 0..16 7..10 Other", &["FileId(1) 64..67 StructLiteral"], ); } @@ -267,7 +267,7 @@ fn main() { ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", + "Foo STRUCT FileId(1) 0..16 7..10 Other", &["FileId(1) 54..57 StructLiteral"], ); } @@ -431,7 +431,7 @@ fn f() { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "Foo STRUCT_DEF FileId(2) 17..51 28..31 Other", + "Foo STRUCT FileId(2) 17..51 28..31 Other", &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], ); } @@ -486,7 +486,7 @@ pub(super) struct Foo<|> { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", + "Foo STRUCT FileId(3) 0..41 18..21 Other", &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], ); } diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index b0ab160ac..ba1fd6242 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -705,7 +705,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { }; let tag = match parent.kind() { - STRUCT_DEF => HighlightTag::Struct, + STRUCT => HighlightTag::Struct, ENUM_DEF => HighlightTag::Enum, UNION => HighlightTag::Union, TRAIT_DEF => HighlightTag::Trait, -- cgit v1.2.3