diff options
author | Laurențiu Nicola <[email protected]> | 2020-04-06 15:21:33 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-04-06 15:21:33 +0100 |
commit | 52fd2c8e4858c548195edceb83c02437d2d28ee5 (patch) | |
tree | 344f7bd6402f3bd846b437c1a8cfc6165881492d | |
parent | 2603a9e628d304c8cb8fd08979e2f9c9afeac69e (diff) |
Fix unnecessary braces warnings
-rw-r--r-- | crates/ra_hir/src/semantics/source_to_def.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/builtin_derive.rs | 6 | ||||
-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 | ||||
-rw-r--r-- | crates/ra_ide_db/src/search.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_db/src/symbol_index.rs | 16 | ||||
-rw-r--r-- | crates/ra_syntax/src/validation.rs | 12 |
12 files changed, 73 insertions, 73 deletions
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 8843f2835..66724919b 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -208,12 +208,12 @@ impl SourceToDefCtx<'_, '_> { | |||
208 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { | 208 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { |
209 | let res: GenericDefId = match_ast! { | 209 | let res: GenericDefId = match_ast! { |
210 | match (container.value) { | 210 | match (container.value) { |
211 | ast::FnDef(it) => { self.fn_to_def(container.with_value(it))?.into() }, | 211 | ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), |
212 | ast::StructDef(it) => { self.struct_to_def(container.with_value(it))?.into() }, | 212 | ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(), |
213 | ast::EnumDef(it) => { self.enum_to_def(container.with_value(it))?.into() }, | 213 | ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), |
214 | ast::TraitDef(it) => { self.trait_to_def(container.with_value(it))?.into() }, | 214 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), |
215 | ast::TypeAliasDef(it) => { self.type_alias_to_def(container.with_value(it))?.into() }, | 215 | ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(), |
216 | ast::ImplDef(it) => { self.impl_to_def(container.with_value(it))?.into() }, | 216 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), |
217 | _ => continue, | 217 | _ => continue, |
218 | } | 218 | } |
219 | }; | 219 | }; |
@@ -226,9 +226,9 @@ impl SourceToDefCtx<'_, '_> { | |||
226 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { | 226 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { |
227 | let res: DefWithBodyId = match_ast! { | 227 | let res: DefWithBodyId = match_ast! { |
228 | match (container.value) { | 228 | match (container.value) { |
229 | ast::ConstDef(it) => { self.const_to_def(container.with_value(it))?.into() }, | 229 | ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(), |
230 | ast::StaticDef(it) => { self.static_to_def(container.with_value(it))?.into() }, | 230 | ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(), |
231 | ast::FnDef(it) => { self.fn_to_def(container.with_value(it))?.into() }, | 231 | ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), |
232 | _ => continue, | 232 | _ => continue, |
233 | } | 233 | } |
234 | }; | 234 | }; |
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index 79aea5806..bb45b0f1d 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs | |||
@@ -73,9 +73,9 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> { | |||
73 | let node = item.syntax(); | 73 | let node = item.syntax(); |
74 | let (name, params) = match_ast! { | 74 | let (name, params) = match_ast! { |
75 | match node { | 75 | match node { |
76 | ast::StructDef(it) => { (it.name(), it.type_param_list()) }, | 76 | ast::StructDef(it) => (it.name(), it.type_param_list()), |
77 | ast::EnumDef(it) => { (it.name(), it.type_param_list()) }, | 77 | ast::EnumDef(it) => (it.name(), it.type_param_list()), |
78 | ast::UnionDef(it) => { (it.name(), it.type_param_list()) }, | 78 | ast::UnionDef(it) => (it.name(), it.type_param_list()), |
79 | _ => { | 79 | _ => { |
80 | debug!("unexpected node is {:?}", node); | 80 | debug!("unexpected node is {:?}", node); |
81 | return Err(mbe::ExpandError::ConversionError) | 81 | return Err(mbe::ExpandError::ConversionError) |
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 | } |
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index 05a0eed30..1bf014149 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs | |||
@@ -286,7 +286,7 @@ fn reference_access(def: &Definition, name_ref: &ast::NameRef) -> Option<Referen | |||
286 | } | 286 | } |
287 | Some(ReferenceAccess::Read) | 287 | Some(ReferenceAccess::Read) |
288 | }, | 288 | }, |
289 | _ => {None} | 289 | _ => None |
290 | } | 290 | } |
291 | } | 291 | } |
292 | }); | 292 | }); |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 0f46f93c1..d30458d86 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -354,14 +354,14 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { | |||
354 | } | 354 | } |
355 | match_ast! { | 355 | match_ast! { |
356 | match node { | 356 | match node { |
357 | ast::FnDef(it) => { decl(it) }, | 357 | ast::FnDef(it) => decl(it), |
358 | ast::StructDef(it) => { decl(it) }, | 358 | ast::StructDef(it) => decl(it), |
359 | ast::EnumDef(it) => { decl(it) }, | 359 | ast::EnumDef(it) => decl(it), |
360 | ast::TraitDef(it) => { decl(it) }, | 360 | ast::TraitDef(it) => decl(it), |
361 | ast::Module(it) => { decl(it) }, | 361 | ast::Module(it) => decl(it), |
362 | ast::TypeAliasDef(it) => { decl(it) }, | 362 | ast::TypeAliasDef(it) => decl(it), |
363 | ast::ConstDef(it) => { decl(it) }, | 363 | ast::ConstDef(it) => decl(it), |
364 | ast::StaticDef(it) => { decl(it) }, | 364 | ast::StaticDef(it) => decl(it), |
365 | ast::MacroCall(it) => { | 365 | ast::MacroCall(it) => { |
366 | if it.is_macro_rules().is_some() { | 366 | if it.is_macro_rules().is_some() { |
367 | decl(it) | 367 | decl(it) |
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 7915cf8cb..f85b3e61b 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -88,12 +88,12 @@ pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> { | |||
88 | for node in root.descendants() { | 88 | for node in root.descendants() { |
89 | match_ast! { | 89 | match_ast! { |
90 | match node { | 90 | match node { |
91 | ast::Literal(it) => { validate_literal(it, &mut errors) }, | 91 | ast::Literal(it) => validate_literal(it, &mut errors), |
92 | ast::BlockExpr(it) => { block::validate_block_expr(it, &mut errors) }, | 92 | ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors), |
93 | ast::FieldExpr(it) => { validate_numeric_name(it.name_ref(), &mut errors) }, | 93 | ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors), |
94 | ast::RecordField(it) => { validate_numeric_name(it.name_ref(), &mut errors) }, | 94 | ast::RecordField(it) => validate_numeric_name(it.name_ref(), &mut errors), |
95 | ast::Visibility(it) => { validate_visibility(it, &mut errors) }, | 95 | ast::Visibility(it) => validate_visibility(it, &mut errors), |
96 | ast::RangeExpr(it) => { validate_range_expr(it, &mut errors) }, | 96 | ast::RangeExpr(it) => validate_range_expr(it, &mut errors), |
97 | _ => (), | 97 | _ => (), |
98 | } | 98 | } |
99 | } | 99 | } |