aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 13:51:08 +0100
committerAleksey Kladov <[email protected]>2020-07-30 14:16:05 +0100
commit1142112c70b705f59b7d559d9d72cdc831865158 (patch)
tree1ca467302b268c800da8b26482e90effcea08229 /crates/ra_ide/src
parent3e1e6227ca525f8631e0bff2215fa3de1b4f4cc1 (diff)
Rename FnDef -> Fn
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/call_hierarchy.rs54
-rw-r--r--crates/ra_ide/src/completion/complete_fn_param.rs10
-rw-r--r--crates/ra_ide/src/completion/complete_keyword.rs2
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs6
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs4
-rw-r--r--crates/ra_ide/src/completion/patterns.rs2
-rw-r--r--crates/ra_ide/src/display.rs2
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs4
-rw-r--r--crates/ra_ide/src/display/short_label.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs12
-rw-r--r--crates/ra_ide/src/hover.rs2
-rw-r--r--crates/ra_ide/src/references.rs10
-rw-r--r--crates/ra_ide/src/references/rename.rs4
-rw-r--r--crates/ra_ide/src/runnables.rs40
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs4
-rw-r--r--crates/ra_ide/src/syntax_tree.rs14
16 files changed, 86 insertions, 86 deletions
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index c28af8ab3..1fcaf4a32 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -59,7 +59,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
59 if let Some(nav) = syntax.ancestors().find_map(|node| { 59 if let Some(nav) = syntax.ancestors().find_map(|node| {
60 match_ast! { 60 match_ast! {
61 match node { 61 match node {
62 ast::FnDef(it) => { 62 ast::Fn(it) => {
63 let def = sema.to_def(&it)?; 63 let def = sema.to_def(&it)?;
64 Some(def.to_nav(sema.db)) 64 Some(def.to_nav(sema.db))
65 }, 65 },
@@ -181,8 +181,8 @@ fn caller() {
181 call<|>ee(); 181 call<|>ee();
182} 182}
183"#, 183"#,
184 "callee FN_DEF FileId(1) 0..14 3..9", 184 "callee FN FileId(1) 0..14 3..9",
185 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], 185 &["caller FN FileId(1) 15..44 18..24 : [33..39]"],
186 &[], 186 &[],
187 ); 187 );
188 } 188 }
@@ -197,8 +197,8 @@ fn caller() {
197 callee(); 197 callee();
198} 198}
199"#, 199"#,
200 "callee FN_DEF FileId(1) 0..14 3..9", 200 "callee FN FileId(1) 0..14 3..9",
201 &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], 201 &["caller FN FileId(1) 15..44 18..24 : [33..39]"],
202 &[], 202 &[],
203 ); 203 );
204 } 204 }
@@ -214,8 +214,8 @@ fn caller() {
214 callee(); 214 callee();
215} 215}
216"#, 216"#,
217 "callee FN_DEF FileId(1) 0..14 3..9", 217 "callee FN FileId(1) 0..14 3..9",
218 &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], 218 &["caller FN FileId(1) 15..58 18..24 : [33..39, 47..53]"],
219 &[], 219 &[],
220 ); 220 );
221 } 221 }
@@ -234,10 +234,10 @@ fn caller2() {
234 callee(); 234 callee();
235} 235}
236"#, 236"#,
237 "callee FN_DEF FileId(1) 0..14 3..9", 237 "callee FN FileId(1) 0..14 3..9",
238 &[ 238 &[
239 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", 239 "caller1 FN FileId(1) 15..45 18..25 : [34..40]",
240 "caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]", 240 "caller2 FN FileId(1) 47..77 50..57 : [66..72]",
241 ], 241 ],
242 &[], 242 &[],
243 ); 243 );
@@ -263,10 +263,10 @@ mod tests {
263 } 263 }
264} 264}
265"#, 265"#,
266 "callee FN_DEF FileId(1) 0..14 3..9", 266 "callee FN FileId(1) 0..14 3..9",
267 &[ 267 &[
268 "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", 268 "caller1 FN FileId(1) 15..45 18..25 : [34..40]",
269 "test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]", 269 "test_caller FN FileId(1) 95..149 110..121 : [134..140]",
270 ], 270 ],
271 &[], 271 &[],
272 ); 272 );
@@ -287,8 +287,8 @@ fn caller() {
287//- /foo/mod.rs 287//- /foo/mod.rs
288pub fn callee() {} 288pub fn callee() {}
289"#, 289"#,
290 "callee FN_DEF FileId(2) 0..18 7..13", 290 "callee FN FileId(2) 0..18 7..13",
291 &["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"], 291 &["caller FN FileId(1) 27..56 30..36 : [45..51]"],
292 &[], 292 &[],
293 ); 293 );
294 } 294 }
@@ -304,9 +304,9 @@ fn call<|>er() {
304 callee(); 304 callee();
305} 305}
306"#, 306"#,
307 "caller FN_DEF FileId(1) 15..58 18..24", 307 "caller FN FileId(1) 15..58 18..24",
308 &[], 308 &[],
309 &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], 309 &["callee FN FileId(1) 0..14 3..9 : [33..39, 47..53]"],
310 ); 310 );
311 } 311 }
312 312
@@ -325,9 +325,9 @@ fn call<|>er() {
325//- /foo/mod.rs 325//- /foo/mod.rs
326pub fn callee() {} 326pub fn callee() {}
327"#, 327"#,
328 "caller FN_DEF FileId(1) 27..56 30..36", 328 "caller FN FileId(1) 27..56 30..36",
329 &[], 329 &[],
330 &["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"], 330 &["callee FN FileId(2) 0..18 7..13 : [45..51]"],
331 ); 331 );
332 } 332 }
333 333
@@ -348,9 +348,9 @@ fn caller3() {
348 348
349} 349}
350"#, 350"#,
351 "caller2 FN_DEF FileId(1) 33..64 36..43", 351 "caller2 FN FileId(1) 33..64 36..43",
352 &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], 352 &["caller1 FN FileId(1) 0..31 3..10 : [19..26]"],
353 &["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"], 353 &["caller3 FN FileId(1) 66..83 69..76 : [52..59]"],
354 ); 354 );
355 } 355 }
356 356
@@ -368,9 +368,9 @@ fn main() {
368 a<|>() 368 a<|>()
369} 369}
370"#, 370"#,
371 "a FN_DEF FileId(1) 0..18 3..4", 371 "a FN FileId(1) 0..18 3..4",
372 &["main FN_DEF FileId(1) 31..52 34..38 : [47..48]"], 372 &["main FN FileId(1) 31..52 34..38 : [47..48]"],
373 &["b FN_DEF FileId(1) 20..29 23..24 : [13..14]"], 373 &["b FN FileId(1) 20..29 23..24 : [13..14]"],
374 ); 374 );
375 375
376 check_hierarchy( 376 check_hierarchy(
@@ -385,8 +385,8 @@ fn main() {
385 a() 385 a()
386} 386}
387"#, 387"#,
388 "b FN_DEF FileId(1) 20..29 23..24", 388 "b FN FileId(1) 20..29 23..24",
389 &["a FN_DEF FileId(1) 0..18 3..4 : [13..14]"], 389 &["a FN FileId(1) 0..18 3..4 : [13..14]"],
390 &[], 390 &[],
391 ); 391 );
392 } 392 }
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs
index d4b6112a5..406334257 100644
--- a/crates/ra_ide/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide/src/completion/complete_fn_param.rs
@@ -19,8 +19,8 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
19 19
20 let mut params = FxHashMap::default(); 20 let mut params = FxHashMap::default();
21 21
22 let me = ctx.token.ancestors().find_map(ast::FnDef::cast); 22 let me = ctx.token.ancestors().find_map(ast::Fn::cast);
23 let mut process_fn = |func: ast::FnDef| { 23 let mut process_fn = |func: ast::Fn| {
24 if Some(&func) == me.as_ref() { 24 if Some(&func) == me.as_ref() {
25 return; 25 return;
26 } 26 }
@@ -34,15 +34,15 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
34 match_ast! { 34 match_ast! {
35 match node { 35 match node {
36 ast::SourceFile(it) => it.items().filter_map(|item| match item { 36 ast::SourceFile(it) => it.items().filter_map(|item| match item {
37 ast::Item::FnDef(it) => Some(it), 37 ast::Item::Fn(it) => Some(it),
38 _ => None, 38 _ => None,
39 }).for_each(&mut process_fn), 39 }).for_each(&mut process_fn),
40 ast::ItemList(it) => it.items().filter_map(|item| match item { 40 ast::ItemList(it) => it.items().filter_map(|item| match item {
41 ast::Item::FnDef(it) => Some(it), 41 ast::Item::Fn(it) => Some(it),
42 _ => None, 42 _ => None,
43 }).for_each(&mut process_fn), 43 }).for_each(&mut process_fn),
44 ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item { 44 ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item {
45 ast::AssocItem::FnDef(it) => Some(it), 45 ast::AssocItem::Fn(it) => Some(it),
46 _ => None, 46 _ => None,
47 }).for_each(&mut process_fn), 47 }).for_each(&mut process_fn),
48 _ => continue, 48 _ => continue,
diff --git a/crates/ra_ide/src/completion/complete_keyword.rs b/crates/ra_ide/src/completion/complete_keyword.rs
index 1581b2d5d..b62064797 100644
--- a/crates/ra_ide/src/completion/complete_keyword.rs
+++ b/crates/ra_ide/src/completion/complete_keyword.rs
@@ -169,7 +169,7 @@ fn add_keyword(ctx: &CompletionContext, acc: &mut Completions, kw: &str, snippet
169 169
170fn complete_return( 170fn complete_return(
171 ctx: &CompletionContext, 171 ctx: &CompletionContext,
172 fn_def: &ast::FnDef, 172 fn_def: &ast::Fn,
173 can_be_stmt: bool, 173 can_be_stmt: bool,
174) -> Option<CompletionItem> { 174) -> Option<CompletionItem> {
175 let snip = match (can_be_stmt, fn_def.ret_type().is_some()) { 175 let snip = match (can_be_stmt, fn_def.ret_type().is_some()) {
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index cf716540f..dbb9eecc6 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -2,7 +2,7 @@
2//! 2//!
3//! This module adds the completion items related to implementing associated 3//! This module adds the completion items related to implementing associated
4//! items within a `impl Trait for Struct` block. The current context node 4//! items within a `impl Trait for Struct` block. The current context node
5//! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node 5//! must be within either a `FN`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node
6//! and an direct child of an `IMPL_DEF`. 6//! and an direct child of an `IMPL_DEF`.
7//! 7//!
8//! # Examples 8//! # Examples
@@ -63,7 +63,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
63 } 63 }
64 }), 64 }),
65 65
66 SyntaxKind::FN_DEF => { 66 SyntaxKind::FN => {
67 for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) 67 for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
68 .into_iter() 68 .into_iter()
69 .filter_map(|item| match item { 69 .filter_map(|item| match item {
@@ -106,7 +106,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
106 106
107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { 107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { 108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
109 SyntaxKind::FN_DEF 109 SyntaxKind::FN
110 | SyntaxKind::TYPE_ALIAS_DEF 110 | SyntaxKind::TYPE_ALIAS_DEF
111 | SyntaxKind::CONST_DEF 111 | SyntaxKind::CONST_DEF
112 | SyntaxKind::BLOCK_EXPR => Some((p, 2)), 112 | SyntaxKind::BLOCK_EXPR => Some((p, 2)),
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index cc55f6dd6..221d7847e 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -35,7 +35,7 @@ pub(crate) struct CompletionContext<'a> {
35 pub(super) krate: Option<hir::Crate>, 35 pub(super) krate: Option<hir::Crate>,
36 pub(super) expected_type: Option<Type>, 36 pub(super) expected_type: Option<Type>,
37 pub(super) name_ref_syntax: Option<ast::NameRef>, 37 pub(super) name_ref_syntax: Option<ast::NameRef>,
38 pub(super) function_syntax: Option<ast::FnDef>, 38 pub(super) function_syntax: Option<ast::Fn>,
39 pub(super) use_item_syntax: Option<ast::Use>, 39 pub(super) use_item_syntax: Option<ast::Use>,
40 pub(super) record_lit_syntax: Option<ast::RecordLit>, 40 pub(super) record_lit_syntax: Option<ast::RecordLit>,
41 pub(super) record_pat_syntax: Option<ast::RecordPat>, 41 pub(super) record_pat_syntax: Option<ast::RecordPat>,
@@ -349,7 +349,7 @@ impl<'a> CompletionContext<'a> {
349 .sema 349 .sema
350 .ancestors_with_macros(self.token.parent()) 350 .ancestors_with_macros(self.token.parent())
351 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) 351 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
352 .find_map(ast::FnDef::cast); 352 .find_map(ast::Fn::cast);
353 353
354 self.record_field_syntax = self 354 self.record_field_syntax = self
355 .sema 355 .sema
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index 175209d8a..b8408da4e 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {
134 NodeOrToken::Token(token) => token.parent(), 134 NodeOrToken::Token(token) => token.parent(),
135 }; 135 };
136 for node in leaf.ancestors() { 136 for node in leaf.ancestors() {
137 if node.kind() == FN_DEF || node.kind() == LAMBDA_EXPR { 137 if node.kind() == FN || node.kind() == LAMBDA_EXPR {
138 break; 138 break;
139 } 139 }
140 let loop_body = match_ast! { 140 let loop_body = match_ast! {
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs
index 6d4151dd8..e4effc66c 100644
--- a/crates/ra_ide/src/display.rs
+++ b/crates/ra_ide/src/display.rs
@@ -16,7 +16,7 @@ pub use navigation_target::NavigationTarget;
16pub(crate) use navigation_target::{ToNav, TryToNav}; 16pub(crate) use navigation_target::{ToNav, TryToNav};
17pub(crate) use short_label::ShortLabel; 17pub(crate) use short_label::ShortLabel;
18 18
19pub(crate) fn function_declaration(node: &ast::FnDef) -> String { 19pub(crate) fn function_declaration(node: &ast::Fn) -> String {
20 let mut buf = String::new(); 20 let mut buf = String::new();
21 if let Some(vis) = node.visibility() { 21 if let Some(vis) = node.visibility() {
22 format_to!(buf, "{} ", vis); 22 format_to!(buf, "{} ", vis);
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index fd245705c..222cb3502 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -379,7 +379,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
379 379
380 match_ast! { 380 match_ast! {
381 match node { 381 match node {
382 ast::FnDef(it) => it.doc_comment_text(), 382 ast::Fn(it) => it.doc_comment_text(),
383 ast::StructDef(it) => it.doc_comment_text(), 383 ast::StructDef(it) => it.doc_comment_text(),
384 ast::EnumDef(it) => it.doc_comment_text(), 384 ast::EnumDef(it) => it.doc_comment_text(),
385 ast::TraitDef(it) => it.doc_comment_text(), 385 ast::TraitDef(it) => it.doc_comment_text(),
@@ -404,7 +404,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
404 404
405 match_ast! { 405 match_ast! {
406 match node { 406 match node {
407 ast::FnDef(it) => it.short_label(), 407 ast::Fn(it) => it.short_label(),
408 ast::StructDef(it) => it.short_label(), 408 ast::StructDef(it) => it.short_label(),
409 ast::EnumDef(it) => it.short_label(), 409 ast::EnumDef(it) => it.short_label(),
410 ast::TraitDef(it) => it.short_label(), 410 ast::TraitDef(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 5588130a1..63863943a 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -7,7 +7,7 @@ pub(crate) trait ShortLabel {
7 fn short_label(&self) -> Option<String>; 7 fn short_label(&self) -> Option<String>;
8} 8}
9 9
10impl ShortLabel for ast::FnDef { 10impl ShortLabel for ast::Fn {
11 fn short_label(&self) -> Option<String> { 11 fn short_label(&self) -> Option<String> {
12 Some(crate::display::function_declaration(self)) 12 Some(crate::display::function_declaration(self))
13 } 13 }
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index 1f6a3febf..41603480e 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -111,7 +111,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
111 111
112 match_ast! { 112 match_ast! {
113 match node { 113 match node {
114 ast::FnDef(it) => { 114 ast::Fn(it) => {
115 let mut detail = String::from("fn"); 115 let mut detail = String::from("fn");
116 if let Some(type_param_list) = it.type_param_list() { 116 if let Some(type_param_list) = it.type_param_list() {
117 collapse_ws(type_param_list.syntax(), &mut detail); 117 collapse_ws(type_param_list.syntax(), &mut detail);
@@ -271,7 +271,7 @@ fn very_obsolete() {}
271 label: "bar1", 271 label: "bar1",
272 navigation_range: 43..47, 272 navigation_range: 43..47,
273 node_range: 40..52, 273 node_range: 40..52,
274 kind: FN_DEF, 274 kind: FN,
275 detail: Some( 275 detail: Some(
276 "fn()", 276 "fn()",
277 ), 277 ),
@@ -284,7 +284,7 @@ fn very_obsolete() {}
284 label: "bar2", 284 label: "bar2",
285 navigation_range: 60..64, 285 navigation_range: 60..64,
286 node_range: 57..81, 286 node_range: 57..81,
287 kind: FN_DEF, 287 kind: FN,
288 detail: Some( 288 detail: Some(
289 "fn<T>(t: T) -> T", 289 "fn<T>(t: T) -> T",
290 ), 290 ),
@@ -297,7 +297,7 @@ fn very_obsolete() {}
297 label: "bar3", 297 label: "bar3",
298 navigation_range: 89..93, 298 navigation_range: 89..93,
299 node_range: 86..156, 299 node_range: 86..156,
300 kind: FN_DEF, 300 kind: FN,
301 detail: Some( 301 detail: Some(
302 "fn<A, B>(a: A, b: B) -> Vec< u32 >", 302 "fn<A, B>(a: A, b: B) -> Vec< u32 >",
303 ), 303 ),
@@ -417,7 +417,7 @@ fn very_obsolete() {}
417 label: "obsolete", 417 label: "obsolete",
418 navigation_range: 428..436, 418 navigation_range: 428..436,
419 node_range: 411..441, 419 node_range: 411..441,
420 kind: FN_DEF, 420 kind: FN,
421 detail: Some( 421 detail: Some(
422 "fn()", 422 "fn()",
423 ), 423 ),
@@ -428,7 +428,7 @@ fn very_obsolete() {}
428 label: "very_obsolete", 428 label: "very_obsolete",
429 navigation_range: 481..494, 429 navigation_range: 481..494,
430 node_range: 443..499, 430 node_range: 443..499,
431 kind: FN_DEF, 431 kind: FN,
432 detail: Some( 432 detail: Some(
433 "fn()", 433 "fn()",
434 ), 434 ),
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index d067c339d..4ef7efd26 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -1361,7 +1361,7 @@ fn foo_<|>test() {}
1361 11..19, 1361 11..19,
1362 ), 1362 ),
1363 name: "foo_test", 1363 name: "foo_test",
1364 kind: FN_DEF, 1364 kind: FN,
1365 container_name: None, 1365 container_name: None,
1366 description: None, 1366 description: None,
1367 docs: None, 1367 docs: None,
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index fe1c074d1..8d3452a83 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -376,7 +376,7 @@ impl Foo {
376} 376}
377"#, 377"#,
378 ); 378 );
379 check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]); 379 check_result(refs, "f FN FileId(1) 27..43 30..31 Other", &[]);
380 } 380 }
381 381
382 #[test] 382 #[test]
@@ -514,7 +514,7 @@ pub(super) struct Foo<|> {
514 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 514 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
515 check_result( 515 check_result(
516 refs, 516 refs,
517 "quux FN_DEF FileId(1) 19..35 26..30 Other", 517 "quux FN FileId(1) 19..35 26..30 Other",
518 &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], 518 &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"],
519 ); 519 );
520 520
@@ -522,7 +522,7 @@ pub(super) struct Foo<|> {
522 analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); 522 analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap();
523 check_result( 523 check_result(
524 refs, 524 refs,
525 "quux FN_DEF FileId(1) 19..35 26..30 Other", 525 "quux FN FileId(1) 19..35 26..30 Other",
526 &["FileId(3) 16..20 StructLiteral"], 526 &["FileId(3) 16..20 StructLiteral"],
527 ); 527 );
528 } 528 }
@@ -619,7 +619,7 @@ fn main() {
619 ); 619 );
620 check_result( 620 check_result(
621 refs, 621 refs,
622 "new FN_DEF FileId(1) 54..101 61..64 Other", 622 "new FN FileId(1) 54..101 61..64 Other",
623 &["FileId(1) 146..149 StructLiteral"], 623 &["FileId(1) 146..149 StructLiteral"],
624 ); 624 );
625 } 625 }
@@ -646,7 +646,7 @@ fn main() {
646 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); 646 let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
647 check_result( 647 check_result(
648 refs, 648 refs,
649 "f FN_DEF FileId(1) 26..35 29..30 Other", 649 "f FN FileId(1) 26..35 29..30 Other",
650 &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], 650 &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"],
651 ); 651 );
652 } 652 }
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 8735ec53c..d8ffb8c84 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -149,7 +149,7 @@ fn rename_to_self(
149 let source_file = sema.parse(position.file_id); 149 let source_file = sema.parse(position.file_id);
150 let syn = source_file.syntax(); 150 let syn = source_file.syntax();
151 151
152 let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?; 152 let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?;
153 let params = fn_def.param_list()?; 153 let params = fn_def.param_list()?;
154 if params.self_param().is_some() { 154 if params.self_param().is_some() {
155 return None; // method already has self param 155 return None; // method already has self param
@@ -221,7 +221,7 @@ fn rename_self_to_param(
221 let syn = source_file.syntax(); 221 let syn = source_file.syntax();
222 222
223 let text = sema.db.file_text(position.file_id); 223 let text = sema.db.file_text(position.file_id);
224 let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?; 224 let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?;
225 let search_range = fn_def.syntax().text_range(); 225 let search_range = fn_def.syntax().text_range();
226 226
227 let mut edits: Vec<SourceFileEdit> = vec![]; 227 let mut edits: Vec<SourceFileEdit> = vec![];
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index f612835c2..3b7162b84 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -102,7 +102,7 @@ pub(crate) fn runnable(
102) -> Option<Runnable> { 102) -> Option<Runnable> {
103 match_ast! { 103 match_ast! {
104 match item { 104 match item {
105 ast::FnDef(it) => runnable_fn(sema, it, file_id), 105 ast::Fn(it) => runnable_fn(sema, it, file_id),
106 ast::Module(it) => runnable_mod(sema, it, file_id), 106 ast::Module(it) => runnable_mod(sema, it, file_id),
107 _ => None, 107 _ => None,
108 } 108 }
@@ -111,7 +111,7 @@ pub(crate) fn runnable(
111 111
112fn runnable_fn( 112fn runnable_fn(
113 sema: &Semantics<RootDatabase>, 113 sema: &Semantics<RootDatabase>,
114 fn_def: ast::FnDef, 114 fn_def: ast::Fn,
115 file_id: FileId, 115 file_id: FileId,
116) -> Option<Runnable> { 116) -> Option<Runnable> {
117 let name_string = fn_def.name()?.text().to_string(); 117 let name_string = fn_def.name()?.text().to_string();
@@ -188,7 +188,7 @@ pub struct TestAttr {
188} 188}
189 189
190impl TestAttr { 190impl TestAttr {
191 fn from_fn(fn_def: &ast::FnDef) -> TestAttr { 191 fn from_fn(fn_def: &ast::Fn) -> TestAttr {
192 let ignore = fn_def 192 let ignore = fn_def
193 .attrs() 193 .attrs()
194 .filter_map(|attr| attr.simple_name()) 194 .filter_map(|attr| attr.simple_name())
@@ -203,7 +203,7 @@ impl TestAttr {
203/// 203///
204/// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test, 204/// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test,
205/// but it's better than not to have the runnables for the tests at all. 205/// but it's better than not to have the runnables for the tests at all.
206fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { 206fn has_test_related_attribute(fn_def: &ast::Fn) -> bool {
207 fn_def 207 fn_def
208 .attrs() 208 .attrs()
209 .filter_map(|attr| attr.path()) 209 .filter_map(|attr| attr.path())
@@ -211,7 +211,7 @@ fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool {
211 .any(|attribute_text| attribute_text.contains("test")) 211 .any(|attribute_text| attribute_text.contains("test"))
212} 212}
213 213
214fn has_doc_test(fn_def: &ast::FnDef) -> bool { 214fn has_doc_test(fn_def: &ast::Fn) -> bool {
215 fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```")) 215 fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```"))
216} 216}
217 217
@@ -246,7 +246,7 @@ fn has_test_function_or_multiple_test_submodules(module: &ast::Module) -> bool {
246 246
247 for item in item_list.items() { 247 for item in item_list.items() {
248 match item { 248 match item {
249 ast::Item::FnDef(f) => { 249 ast::Item::Fn(f) => {
250 if has_test_related_attribute(&f) { 250 if has_test_related_attribute(&f) {
251 return true; 251 return true;
252 } 252 }
@@ -320,7 +320,7 @@ fn bench() {}
320 4..8, 320 4..8,
321 ), 321 ),
322 name: "main", 322 name: "main",
323 kind: FN_DEF, 323 kind: FN,
324 container_name: None, 324 container_name: None,
325 description: None, 325 description: None,
326 docs: None, 326 docs: None,
@@ -338,7 +338,7 @@ fn bench() {}
338 26..34, 338 26..34,
339 ), 339 ),
340 name: "test_foo", 340 name: "test_foo",
341 kind: FN_DEF, 341 kind: FN,
342 container_name: None, 342 container_name: None,
343 description: None, 343 description: None,
344 docs: None, 344 docs: None,
@@ -363,7 +363,7 @@ fn bench() {}
363 62..70, 363 62..70,
364 ), 364 ),
365 name: "test_foo", 365 name: "test_foo",
366 kind: FN_DEF, 366 kind: FN,
367 container_name: None, 367 container_name: None,
368 description: None, 368 description: None,
369 docs: None, 369 docs: None,
@@ -388,7 +388,7 @@ fn bench() {}
388 89..94, 388 89..94,
389 ), 389 ),
390 name: "bench", 390 name: "bench",
391 kind: FN_DEF, 391 kind: FN,
392 container_name: None, 392 container_name: None,
393 description: None, 393 description: None,
394 docs: None, 394 docs: None,
@@ -431,7 +431,7 @@ fn foo() {}
431 4..8, 431 4..8,
432 ), 432 ),
433 name: "main", 433 name: "main",
434 kind: FN_DEF, 434 kind: FN,
435 container_name: None, 435 container_name: None,
436 description: None, 436 description: None,
437 docs: None, 437 docs: None,
@@ -447,7 +447,7 @@ fn foo() {}
447 full_range: 15..57, 447 full_range: 15..57,
448 focus_range: None, 448 focus_range: None,
449 name: "foo", 449 name: "foo",
450 kind: FN_DEF, 450 kind: FN,
451 container_name: None, 451 container_name: None,
452 description: None, 452 description: None,
453 docs: None, 453 docs: None,
@@ -493,7 +493,7 @@ impl Data {
493 4..8, 493 4..8,
494 ), 494 ),
495 name: "main", 495 name: "main",
496 kind: FN_DEF, 496 kind: FN,
497 container_name: None, 497 container_name: None,
498 description: None, 498 description: None,
499 docs: None, 499 docs: None,
@@ -509,7 +509,7 @@ impl Data {
509 full_range: 44..98, 509 full_range: 44..98,
510 focus_range: None, 510 focus_range: None,
511 name: "foo", 511 name: "foo",
512 kind: FN_DEF, 512 kind: FN,
513 container_name: None, 513 container_name: None,
514 description: None, 514 description: None,
515 docs: None, 515 docs: None,
@@ -570,7 +570,7 @@ mod test_mod {
570 35..44, 570 35..44,
571 ), 571 ),
572 name: "test_foo1", 572 name: "test_foo1",
573 kind: FN_DEF, 573 kind: FN,
574 container_name: None, 574 container_name: None,
575 description: None, 575 description: None,
576 docs: None, 576 docs: None,
@@ -670,7 +670,7 @@ mod root_tests {
670 107..121, 670 107..121,
671 ), 671 ),
672 name: "nested_test_11", 672 name: "nested_test_11",
673 kind: FN_DEF, 673 kind: FN,
674 container_name: None, 674 container_name: None,
675 description: None, 675 description: None,
676 docs: None, 676 docs: None,
@@ -695,7 +695,7 @@ mod root_tests {
695 163..177, 695 163..177,
696 ), 696 ),
697 name: "nested_test_12", 697 name: "nested_test_12",
698 kind: FN_DEF, 698 kind: FN,
699 container_name: None, 699 container_name: None,
700 description: None, 700 description: None,
701 docs: None, 701 docs: None,
@@ -740,7 +740,7 @@ mod root_tests {
740 258..271, 740 258..271,
741 ), 741 ),
742 name: "nested_test_2", 742 name: "nested_test_2",
743 kind: FN_DEF, 743 kind: FN,
744 container_name: None, 744 container_name: None,
745 description: None, 745 description: None,
746 docs: None, 746 docs: None,
@@ -783,7 +783,7 @@ fn test_foo1() {}
783 36..45, 783 36..45,
784 ), 784 ),
785 name: "test_foo1", 785 name: "test_foo1",
786 kind: FN_DEF, 786 kind: FN,
787 container_name: None, 787 container_name: None,
788 description: None, 788 description: None,
789 docs: None, 789 docs: None,
@@ -831,7 +831,7 @@ fn test_foo1() {}
831 58..67, 831 58..67,
832 ), 832 ),
833 name: "test_foo1", 833 name: "test_foo1",
834 kind: FN_DEF, 834 kind: FN,
835 container_name: None, 835 container_name: None,
836 description: None, 836 description: None,
837 docs: None, 837 docs: None,
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index d456d5d36..5198727d9 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -464,7 +464,7 @@ fn highlight_element(
464 let db = sema.db; 464 let db = sema.db;
465 let mut binding_hash = None; 465 let mut binding_hash = None;
466 let highlight: Highlight = match element.kind() { 466 let highlight: Highlight = match element.kind() {
467 FN_DEF => { 467 FN => {
468 bindings_shadow_count.clear(); 468 bindings_shadow_count.clear();
469 return None; 469 return None;
470 } 470 }
@@ -713,7 +713,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
713 TYPE_PARAM => HighlightTag::TypeParam, 713 TYPE_PARAM => HighlightTag::TypeParam,
714 RECORD_FIELD_DEF => HighlightTag::Field, 714 RECORD_FIELD_DEF => HighlightTag::Field,
715 MODULE => HighlightTag::Module, 715 MODULE => HighlightTag::Module,
716 FN_DEF => HighlightTag::Function, 716 FN => HighlightTag::Function,
717 CONST_DEF => HighlightTag::Constant, 717 CONST_DEF => HighlightTag::Constant,
718 STATIC_DEF => HighlightTag::Static, 718 STATIC_DEF => HighlightTag::Static,
719 ENUM_VARIANT => HighlightTag::EnumVariant, 719 ENUM_VARIANT => HighlightTag::EnumVariant,
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs
index f716a3861..07217e808 100644
--- a/crates/ra_ide/src/syntax_tree.rs
+++ b/crates/ra_ide/src/syntax_tree.rs
@@ -116,7 +116,7 @@ mod tests {
116 syn.trim(), 116 syn.trim(),
117 r#" 117 r#"
118[email protected] 118[email protected]
119 FN_DEF@0..11 119 [email protected]
120 [email protected] "fn" 120 [email protected] "fn"
121 [email protected] " " 121 [email protected] " "
122 [email protected] 122 [email protected]
@@ -148,7 +148,7 @@ fn test() {
148 syn.trim(), 148 syn.trim(),
149 r#" 149 r#"
150[email protected] 150[email protected]
151 FN_DEF@0..60 151 [email protected]
152 [email protected] "fn" 152 [email protected] "fn"
153 [email protected] " " 153 [email protected] " "
154 [email protected] 154 [email protected]
@@ -190,7 +190,7 @@ [email protected]
190 assert_eq_text!( 190 assert_eq_text!(
191 syn.trim(), 191 syn.trim(),
192 r#" 192 r#"
193FN_DEF@0..11 193[email protected]
194 [email protected] "fn" 194 [email protected] "fn"
195 [email protected] " " 195 [email protected] " "
196 [email protected] 196 [email protected]
@@ -258,7 +258,7 @@ fn bar() {
258 syn.trim(), 258 syn.trim(),
259 r#" 259 r#"
260[email protected] 260[email protected]
261 FN_DEF@0..12 261 [email protected]
262 [email protected] "fn" 262 [email protected] "fn"
263 [email protected] " " 263 [email protected] " "
264 [email protected] 264 [email protected]
@@ -292,7 +292,7 @@ fn bar() {
292 syn.trim(), 292 syn.trim(),
293 r#" 293 r#"
294[email protected] 294[email protected]
295 FN_DEF@0..12 295 [email protected]
296 [email protected] "fn" 296 [email protected] "fn"
297 [email protected] " " 297 [email protected] " "
298 [email protected] 298 [email protected]
@@ -325,7 +325,7 @@ fn bar() {
325 syn.trim(), 325 syn.trim(),
326 r#" 326 r#"
327[email protected] 327[email protected]
328 FN_DEF@0..12 328 [email protected]
329 [email protected] "fn" 329 [email protected] "fn"
330 [email protected] " " 330 [email protected] " "
331 [email protected] 331 [email protected]
@@ -339,7 +339,7 @@ [email protected]
339 [email protected] "\n" 339 [email protected] "\n"
340 [email protected] "}" 340 [email protected] "}"
341 [email protected] "\n" 341 [email protected] "\n"
342 FN_DEF@13..25 342 [email protected]
343 [email protected] "fn" 343 [email protected] "fn"
344 [email protected] " " 344 [email protected] " "
345 [email protected] 345 [email protected]