diff options
author | Aleksey Kladov <[email protected]> | 2020-04-07 08:22:33 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-07 08:22:33 +0100 |
commit | baf9fcc38ebd5a52b22fdf115a7475f9002058f6 (patch) | |
tree | e4dd83fca52933e952d4e08e6f6fa588bfbdc319 /crates/ra_ide/src | |
parent | 27285f93acffbeca45c7656f65d66539a2f7fcb4 (diff) | |
parent | 52fd2c8e4858c548195edceb83c02437d2d28ee5 (diff) |
Merge pull request #3866 from lnicola/fewer-braces
Fix unnecessary braces warnings
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/call_info.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_fn_param.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_keyword.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 42 | ||||
-rw-r--r-- | crates/ra_ide/src/display/structure.rs | 16 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_type_definition.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/runnables.rs | 4 |
7 files changed, 46 insertions, 46 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/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/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/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> { | |||
49 | fn runnable(sema: &Semantics<RootDatabase>, item: SyntaxNode) -> Option<Runnable> { | 49 | fn 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 | } |