aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-04-07 16:59:09 +0100
committerBenjamin Coenen <[email protected]>2020-04-07 16:59:09 +0100
commit18a5e164838e1dc2abcc6b79d4fc2f96ffd2507c (patch)
treebc80b5c49c3b7ba31c7fe967bb34fe14bac9d5ed /crates/ra_ide
parentab864ed259c10ff51f7c9c3421d098eeea7b0245 (diff)
parent33c364b545350134b945fbca834194fd1a28fe08 (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/call_info.rs14
-rw-r--r--crates/ra_ide/src/completion.rs8
-rw-r--r--crates/ra_ide/src/completion/complete_fn_param.rs4
-rw-r--r--crates/ra_ide/src/completion/complete_keyword.rs6
-rw-r--r--crates/ra_ide/src/completion/complete_qualified_path.rs (renamed from crates/ra_ide/src/completion/complete_path.rs)2
-rw-r--r--crates/ra_ide/src/completion/complete_record.rs11
-rw-r--r--crates/ra_ide/src/completion/complete_unqualified_path.rs (renamed from crates/ra_ide/src/completion/complete_scope.rs)2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs4
-rw-r--r--crates/ra_ide/src/completion/presentation.rs43
-rw-r--r--crates/ra_ide/src/diagnostics.rs10
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs42
-rw-r--r--crates/ra_ide/src/display/structure.rs16
-rw-r--r--crates/ra_ide/src/goto_type_definition.rs6
-rw-r--r--crates/ra_ide/src/lib.rs5
-rw-r--r--crates/ra_ide/src/marks.rs1
-rw-r--r--crates/ra_ide/src/runnables.rs4
16 files changed, 118 insertions, 60 deletions
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs
index 39d09a07f..ca57eceff 100644
--- a/crates/ra_ide/src/call_info.rs
+++ b/crates/ra_ide/src/call_info.rs
@@ -109,7 +109,7 @@ impl FnCallNode {
109 syntax.ancestors().find_map(|node| { 109 syntax.ancestors().find_map(|node| {
110 match_ast! { 110 match_ast! {
111 match node { 111 match node {
112 ast::CallExpr(it) => { Some(FnCallNode::CallExpr(it)) }, 112 ast::CallExpr(it) => Some(FnCallNode::CallExpr(it)),
113 ast::MethodCallExpr(it) => { 113 ast::MethodCallExpr(it) => {
114 let arg_list = it.arg_list()?; 114 let arg_list = it.arg_list()?;
115 if !syntax.text_range().is_subrange(&arg_list.syntax().text_range()) { 115 if !syntax.text_range().is_subrange(&arg_list.syntax().text_range()) {
@@ -117,8 +117,8 @@ impl FnCallNode {
117 } 117 }
118 Some(FnCallNode::MethodCallExpr(it)) 118 Some(FnCallNode::MethodCallExpr(it))
119 }, 119 },
120 ast::MacroCall(it) => { Some(FnCallNode::MacroCallExpr(it)) }, 120 ast::MacroCall(it) => Some(FnCallNode::MacroCallExpr(it)),
121 _ => { None }, 121 _ => None,
122 } 122 }
123 } 123 }
124 }) 124 })
@@ -127,10 +127,10 @@ impl FnCallNode {
127 pub(crate) fn with_node_exact(node: &SyntaxNode) -> Option<FnCallNode> { 127 pub(crate) fn with_node_exact(node: &SyntaxNode) -> Option<FnCallNode> {
128 match_ast! { 128 match_ast! {
129 match node { 129 match node {
130 ast::CallExpr(it) => { Some(FnCallNode::CallExpr(it)) }, 130 ast::CallExpr(it) => Some(FnCallNode::CallExpr(it)),
131 ast::MethodCallExpr(it) => { Some(FnCallNode::MethodCallExpr(it)) }, 131 ast::MethodCallExpr(it) => Some(FnCallNode::MethodCallExpr(it)),
132 ast::MacroCall(it) => { Some(FnCallNode::MacroCallExpr(it)) }, 132 ast::MacroCall(it) => Some(FnCallNode::MacroCallExpr(it)),
133 _ => { None }, 133 _ => None,
134 } 134 }
135 } 135 }
136 } 136 }
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs
index 93157bbba..4a1a2a04a 100644
--- a/crates/ra_ide/src/completion.rs
+++ b/crates/ra_ide/src/completion.rs
@@ -10,8 +10,8 @@ mod complete_pattern;
10mod complete_fn_param; 10mod complete_fn_param;
11mod complete_keyword; 11mod complete_keyword;
12mod complete_snippet; 12mod complete_snippet;
13mod complete_path; 13mod complete_qualified_path;
14mod complete_scope; 14mod complete_unqualified_path;
15mod complete_postfix; 15mod complete_postfix;
16mod complete_macro_in_item_position; 16mod complete_macro_in_item_position;
17mod complete_trait_impl; 17mod complete_trait_impl;
@@ -85,8 +85,8 @@ pub(crate) fn completions(
85 complete_keyword::complete_use_tree_keyword(&mut acc, &ctx); 85 complete_keyword::complete_use_tree_keyword(&mut acc, &ctx);
86 complete_snippet::complete_expr_snippet(&mut acc, &ctx); 86 complete_snippet::complete_expr_snippet(&mut acc, &ctx);
87 complete_snippet::complete_item_snippet(&mut acc, &ctx); 87 complete_snippet::complete_item_snippet(&mut acc, &ctx);
88 complete_path::complete_path(&mut acc, &ctx); 88 complete_qualified_path::complete_qualified_path(&mut acc, &ctx);
89 complete_scope::complete_scope(&mut acc, &ctx); 89 complete_unqualified_path::complete_unqualified_path(&mut acc, &ctx);
90 complete_dot::complete_dot(&mut acc, &ctx); 90 complete_dot::complete_dot(&mut acc, &ctx);
91 complete_record::complete_record(&mut acc, &ctx); 91 complete_record::complete_record(&mut acc, &ctx);
92 complete_pattern::complete_pattern(&mut acc, &ctx); 92 complete_pattern::complete_pattern(&mut acc, &ctx);
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs
index 9226ac055..62ae5ccb4 100644
--- a/crates/ra_ide/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide/src/completion/complete_fn_param.rs
@@ -18,8 +18,8 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
18 for node in ctx.token.parent().ancestors() { 18 for node in ctx.token.parent().ancestors() {
19 match_ast! { 19 match_ast! {
20 match node { 20 match node {
21 ast::SourceFile(it) => { process(it, &mut params) }, 21 ast::SourceFile(it) => process(it, &mut params),
22 ast::ItemList(it) => { process(it, &mut params) }, 22 ast::ItemList(it) => process(it, &mut params),
23 _ => (), 23 _ => (),
24 } 24 }
25 } 25 }
diff --git a/crates/ra_ide/src/completion/complete_keyword.rs b/crates/ra_ide/src/completion/complete_keyword.rs
index 1e053ea4a..38f9c34e7 100644
--- a/crates/ra_ide/src/completion/complete_keyword.rs
+++ b/crates/ra_ide/src/completion/complete_keyword.rs
@@ -86,9 +86,9 @@ fn is_in_loop_body(leaf: &SyntaxToken) -> bool {
86 } 86 }
87 let loop_body = match_ast! { 87 let loop_body = match_ast! {
88 match node { 88 match node {
89 ast::ForExpr(it) => { it.loop_body() }, 89 ast::ForExpr(it) => it.loop_body(),
90 ast::WhileExpr(it) => { it.loop_body() }, 90 ast::WhileExpr(it) => it.loop_body(),
91 ast::LoopExpr(it) => { it.loop_body() }, 91 ast::LoopExpr(it) => it.loop_body(),
92 _ => None, 92 _ => None,
93 } 93 }
94 }; 94 };
diff --git a/crates/ra_ide/src/completion/complete_path.rs b/crates/ra_ide/src/completion/complete_qualified_path.rs
index 3ed2ae2b6..d98523406 100644
--- a/crates/ra_ide/src/completion/complete_path.rs
+++ b/crates/ra_ide/src/completion/complete_qualified_path.rs
@@ -6,7 +6,7 @@ use test_utils::tested_by;
6 6
7use crate::completion::{CompletionContext, Completions}; 7use crate::completion::{CompletionContext, Completions};
8 8
9pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { 9pub(super) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionContext) {
10 let path = match &ctx.path_prefix { 10 let path = match &ctx.path_prefix {
11 Some(path) => path.clone(), 11 Some(path) => path.clone(),
12 _ => return, 12 _ => return,
diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs
index 01dd8c6db..79f5c8c8f 100644
--- a/crates/ra_ide/src/completion/complete_record.rs
+++ b/crates/ra_ide/src/completion/complete_record.rs
@@ -1,12 +1,13 @@
1//! Complete fields in record literals and patterns. 1//! Complete fields in record literals and patterns.
2use crate::completion::{CompletionContext, Completions};
3use ra_syntax::{ast, ast::NameOwner, SmolStr}; 2use ra_syntax::{ast, ast::NameOwner, SmolStr};
4 3
4use crate::completion::{CompletionContext, Completions};
5
5pub(super) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 6pub(super) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
6 let (ty, variant, already_present_fields) = 7 let (ty, variant, already_present_fields) =
7 match (ctx.record_lit_pat.as_ref(), ctx.record_lit_syntax.as_ref()) { 8 match (ctx.record_lit_pat.as_ref(), ctx.record_lit_syntax.as_ref()) {
8 (None, None) => return None, 9 (None, None) => return None,
9 (Some(_), Some(_)) => panic!("A record cannot be both a literal and a pattern"), 10 (Some(_), Some(_)) => unreachable!("A record cannot be both a literal and a pattern"),
10 (Some(record_pat), _) => ( 11 (Some(record_pat), _) => (
11 ctx.sema.type_of_pat(&record_pat.clone().into())?, 12 ctx.sema.type_of_pat(&record_pat.clone().into())?,
12 ctx.sema.resolve_record_pattern(record_pat)?, 13 ctx.sema.resolve_record_pattern(record_pat)?,
@@ -59,9 +60,10 @@ fn pattern_ascribed_fields(record_pat: &ast::RecordPat) -> Vec<SmolStr> {
59#[cfg(test)] 60#[cfg(test)]
60mod tests { 61mod tests {
61 mod record_lit_tests { 62 mod record_lit_tests {
62 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
63 use insta::assert_debug_snapshot; 63 use insta::assert_debug_snapshot;
64 64
65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
66
65 fn complete(code: &str) -> Vec<CompletionItem> { 67 fn complete(code: &str) -> Vec<CompletionItem> {
66 do_completion(code, CompletionKind::Reference) 68 do_completion(code, CompletionKind::Reference)
67 } 69 }
@@ -204,9 +206,10 @@ mod tests {
204 } 206 }
205 207
206 mod record_pat_tests { 208 mod record_pat_tests {
207 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
208 use insta::assert_debug_snapshot; 209 use insta::assert_debug_snapshot;
209 210
211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
212
210 fn complete(code: &str) -> Vec<CompletionItem> { 213 fn complete(code: &str) -> Vec<CompletionItem> {
211 do_completion(code, CompletionKind::Reference) 214 do_completion(code, CompletionKind::Reference)
212 } 215 }
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs
index 665597e4c..efde9bf73 100644
--- a/crates/ra_ide/src/completion/complete_scope.rs
+++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs
@@ -2,7 +2,7 @@
2 2
3use crate::completion::{CompletionContext, Completions}; 3use crate::completion::{CompletionContext, Completions};
4 4
5pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { 5pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) {
6 if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const) { 6 if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const) {
7 return; 7 return;
8 } 8 }
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index b8213d62f..f833d2a9a 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -50,6 +50,8 @@ pub(crate) struct CompletionContext<'a> {
50 pub(super) dot_receiver_is_ambiguous_float_literal: bool, 50 pub(super) dot_receiver_is_ambiguous_float_literal: bool,
51 /// If this is a call (method or function) in particular, i.e. the () are already there. 51 /// If this is a call (method or function) in particular, i.e. the () are already there.
52 pub(super) is_call: bool, 52 pub(super) is_call: bool,
53 /// If this is a macro call, i.e. the () are already there.
54 pub(super) is_macro_call: bool,
53 pub(super) is_path_type: bool, 55 pub(super) is_path_type: bool,
54 pub(super) has_type_args: bool, 56 pub(super) has_type_args: bool,
55} 57}
@@ -102,6 +104,7 @@ impl<'a> CompletionContext<'a> {
102 is_new_item: false, 104 is_new_item: false,
103 dot_receiver: None, 105 dot_receiver: None,
104 is_call: false, 106 is_call: false,
107 is_macro_call: false,
105 is_path_type: false, 108 is_path_type: false,
106 has_type_args: false, 109 has_type_args: false,
107 dot_receiver_is_ambiguous_float_literal: false, 110 dot_receiver_is_ambiguous_float_literal: false,
@@ -269,6 +272,7 @@ impl<'a> CompletionContext<'a> {
269 .and_then(ast::PathExpr::cast) 272 .and_then(ast::PathExpr::cast)
270 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast)) 273 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast))
271 .is_some(); 274 .is_some();
275 self.is_macro_call = path.syntax().parent().and_then(ast::MacroCall::cast).is_some();
272 276
273 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); 277 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
274 self.has_type_args = segment.type_arg_list().is_some(); 278 self.has_type_args = segment.type_arg_list().is_some();
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index cdfd7bc32..55f75b15a 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -174,7 +174,8 @@ impl Completions {
174 .set_deprecated(is_deprecated(macro_, ctx.db)) 174 .set_deprecated(is_deprecated(macro_, ctx.db))
175 .detail(detail); 175 .detail(detail);
176 176
177 builder = if ctx.use_item_syntax.is_some() { 177 builder = if ctx.use_item_syntax.is_some() || ctx.is_macro_call {
178 tested_by!(dont_insert_macro_call_parens_unncessary);
178 builder.insert_text(name) 179 builder.insert_text(name)
179 } else { 180 } else {
180 let macro_braces_to_insert = 181 let macro_braces_to_insert =
@@ -960,7 +961,8 @@ mod tests {
960 } 961 }
961 962
962 #[test] 963 #[test]
963 fn dont_insert_macro_call_braces_in_use() { 964 fn dont_insert_macro_call_parens_unncessary() {
965 covers!(dont_insert_macro_call_parens_unncessary);
964 assert_debug_snapshot!( 966 assert_debug_snapshot!(
965 do_reference_completion( 967 do_reference_completion(
966 r" 968 r"
@@ -986,6 +988,41 @@ mod tests {
986 }, 988 },
987 ] 989 ]
988 "### 990 "###
989 ) 991 );
992
993 assert_debug_snapshot!(
994 do_reference_completion(
995 r"
996 //- /main.rs
997 macro_rules frobnicate {
998 () => ()
999 }
1000 fn main() {
1001 frob<|>!();
1002 }
1003 "
1004 ),
1005 @r###"
1006 [
1007 CompletionItem {
1008 label: "frobnicate!",
1009 source_range: [56; 60),
1010 delete: [56; 60),
1011 insert: "frobnicate",
1012 kind: Macro,
1013 detail: "macro_rules! frobnicate",
1014 },
1015 CompletionItem {
1016 label: "main()",
1017 source_range: [56; 60),
1018 delete: [56; 60),
1019 insert: "main()$0",
1020 kind: Function,
1021 lookup: "main",
1022 detail: "fn main()",
1023 },
1024 ]
1025 "###
1026 );
990 } 1027 }
991} 1028}
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index c1d7ddaf2..901ad104c 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -101,6 +101,14 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
101 fix, 101 fix,
102 }) 102 })
103 }) 103 })
104 .on::<hir::diagnostics::MissingMatchArms, _>(|d| {
105 res.borrow_mut().push(Diagnostic {
106 range: d.highlight_range(),
107 message: d.message(),
108 severity: Severity::Error,
109 fix: None,
110 })
111 })
104 .on::<hir::diagnostics::MissingOkInTailExpr, _>(|d| { 112 .on::<hir::diagnostics::MissingOkInTailExpr, _>(|d| {
105 let node = d.ast(db); 113 let node = d.ast(db);
106 let replacement = format!("Ok({})", node.syntax()); 114 let replacement = format!("Ok({})", node.syntax());
@@ -291,7 +299,7 @@ mod tests {
291 fn check_no_diagnostic(content: &str) { 299 fn check_no_diagnostic(content: &str) {
292 let (analysis, file_id) = single_file(content); 300 let (analysis, file_id) = single_file(content);
293 let diagnostics = analysis.diagnostics(file_id).unwrap(); 301 let diagnostics = analysis.diagnostics(file_id).unwrap();
294 assert_eq!(diagnostics.len(), 0); 302 assert_eq!(diagnostics.len(), 0, "expected no diagnostic, found one");
295 } 303 }
296 304
297 #[test] 305 #[test]
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index d57451cc8..e61846995 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -399,17 +399,17 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
399 399
400 match_ast! { 400 match_ast! {
401 match node { 401 match node {
402 ast::FnDef(it) => { it.doc_comment_text() }, 402 ast::FnDef(it) => it.doc_comment_text(),
403 ast::StructDef(it) => { it.doc_comment_text() }, 403 ast::StructDef(it) => it.doc_comment_text(),
404 ast::EnumDef(it) => { it.doc_comment_text() }, 404 ast::EnumDef(it) => it.doc_comment_text(),
405 ast::TraitDef(it) => { it.doc_comment_text() }, 405 ast::TraitDef(it) => it.doc_comment_text(),
406 ast::Module(it) => { it.doc_comment_text() }, 406 ast::Module(it) => it.doc_comment_text(),
407 ast::TypeAliasDef(it) => { it.doc_comment_text() }, 407 ast::TypeAliasDef(it) => it.doc_comment_text(),
408 ast::ConstDef(it) => { it.doc_comment_text() }, 408 ast::ConstDef(it) => it.doc_comment_text(),
409 ast::StaticDef(it) => { it.doc_comment_text() }, 409 ast::StaticDef(it) => it.doc_comment_text(),
410 ast::RecordFieldDef(it) => { it.doc_comment_text() }, 410 ast::RecordFieldDef(it) => it.doc_comment_text(),
411 ast::EnumVariant(it) => { it.doc_comment_text() }, 411 ast::EnumVariant(it) => it.doc_comment_text(),
412 ast::MacroCall(it) => { it.doc_comment_text() }, 412 ast::MacroCall(it) => it.doc_comment_text(),
413 _ => None, 413 _ => None,
414 } 414 }
415 } 415 }
@@ -424,16 +424,16 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
424 424
425 match_ast! { 425 match_ast! {
426 match node { 426 match node {
427 ast::FnDef(it) => { it.short_label() }, 427 ast::FnDef(it) => it.short_label(),
428 ast::StructDef(it) => { it.short_label() }, 428 ast::StructDef(it) => it.short_label(),
429 ast::EnumDef(it) => { it.short_label() }, 429 ast::EnumDef(it) => it.short_label(),
430 ast::TraitDef(it) => { it.short_label() }, 430 ast::TraitDef(it) => it.short_label(),
431 ast::Module(it) => { it.short_label() }, 431 ast::Module(it) => it.short_label(),
432 ast::TypeAliasDef(it) => { it.short_label() }, 432 ast::TypeAliasDef(it) => it.short_label(),
433 ast::ConstDef(it) => { it.short_label() }, 433 ast::ConstDef(it) => it.short_label(),
434 ast::StaticDef(it) => { it.short_label() }, 434 ast::StaticDef(it) => it.short_label(),
435 ast::RecordFieldDef(it) => { it.short_label() }, 435 ast::RecordFieldDef(it) => it.short_label(),
436 ast::EnumVariant(it) => { it.short_label() }, 436 ast::EnumVariant(it) => it.short_label(),
437 _ => None, 437 _ => None,
438 } 438 }
439 } 439 }
diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs
index 5774e9a8b..7a774785c 100644
--- a/crates/ra_ide/src/display/structure.rs
+++ b/crates/ra_ide/src/display/structure.rs
@@ -117,18 +117,18 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
117 117
118 decl_with_detail(it, Some(detail)) 118 decl_with_detail(it, Some(detail))
119 }, 119 },
120 ast::StructDef(it) => { decl(it) }, 120 ast::StructDef(it) => decl(it),
121 ast::EnumDef(it) => { decl(it) }, 121 ast::EnumDef(it) => decl(it),
122 ast::EnumVariant(it) => { decl(it) }, 122 ast::EnumVariant(it) => decl(it),
123 ast::TraitDef(it) => { decl(it) }, 123 ast::TraitDef(it) => decl(it),
124 ast::Module(it) => { decl(it) }, 124 ast::Module(it) => decl(it),
125 ast::TypeAliasDef(it) => { 125 ast::TypeAliasDef(it) => {
126 let ty = it.type_ref(); 126 let ty = it.type_ref();
127 decl_with_type_ref(it, ty) 127 decl_with_type_ref(it, ty)
128 }, 128 },
129 ast::RecordFieldDef(it) => { decl_with_ascription(it) }, 129 ast::RecordFieldDef(it) => decl_with_ascription(it),
130 ast::ConstDef(it) => { decl_with_ascription(it) }, 130 ast::ConstDef(it) => decl_with_ascription(it),
131 ast::StaticDef(it) => { decl_with_ascription(it) }, 131 ast::StaticDef(it) => decl_with_ascription(it),
132 ast::ImplDef(it) => { 132 ast::ImplDef(it) => {
133 let target_type = it.target_type()?; 133 let target_type = it.target_type()?;
134 let target_trait = it.target_trait(); 134 let target_trait = it.target_trait();
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs
index 869a4708b..bd2688df1 100644
--- a/crates/ra_ide/src/goto_type_definition.rs
+++ b/crates/ra_ide/src/goto_type_definition.rs
@@ -18,9 +18,9 @@ pub(crate) fn goto_type_definition(
18 let (ty, node) = sema.ancestors_with_macros(token.parent()).find_map(|node| { 18 let (ty, node) = sema.ancestors_with_macros(token.parent()).find_map(|node| {
19 let ty = match_ast! { 19 let ty = match_ast! {
20 match node { 20 match node {
21 ast::Expr(expr) => { sema.type_of_expr(&expr)? }, 21 ast::Expr(expr) => sema.type_of_expr(&expr)?,
22 ast::Pat(pat) => { sema.type_of_pat(&pat)? }, 22 ast::Pat(pat) => sema.type_of_pat(&pat)?,
23 _ => { return None }, 23 _ => return None,
24 } 24 }
25 }; 25 };
26 26
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 285381086..5599f143f 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -10,6 +10,11 @@
10// For proving that RootDatabase is RefUnwindSafe. 10// For proving that RootDatabase is RefUnwindSafe.
11#![recursion_limit = "128"] 11#![recursion_limit = "128"]
12 12
13#[allow(unused)]
14macro_rules! eprintln {
15 ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
16}
17
13pub mod mock_analysis; 18pub mod mock_analysis;
14mod source_change; 19mod source_change;
15 20
diff --git a/crates/ra_ide/src/marks.rs b/crates/ra_ide/src/marks.rs
index 1236cb773..5e1f135c5 100644
--- a/crates/ra_ide/src/marks.rs
+++ b/crates/ra_ide/src/marks.rs
@@ -7,4 +7,5 @@ test_utils::marks!(
7 dont_complete_current_use 7 dont_complete_current_use
8 test_resolve_parent_module_on_module_decl 8 test_resolve_parent_module_on_module_decl
9 search_filters_by_range 9 search_filters_by_range
10 dont_insert_macro_call_parens_unncessary
10); 11);
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index 74877e90f..9433f3a24 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -49,8 +49,8 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
49fn runnable(sema: &Semantics<RootDatabase>, item: SyntaxNode) -> Option<Runnable> { 49fn runnable(sema: &Semantics<RootDatabase>, item: SyntaxNode) -> Option<Runnable> {
50 match_ast! { 50 match_ast! {
51 match item { 51 match item {
52 ast::FnDef(it) => { runnable_fn(sema, it) }, 52 ast::FnDef(it) => runnable_fn(sema, it),
53 ast::Module(it) => { runnable_mod(sema, it) }, 53 ast::Module(it) => runnable_mod(sema, it),
54 _ => None, 54 _ => None,
55 } 55 }
56 } 56 }