From 52fd2c8e4858c548195edceb83c02437d2d28ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 6 Apr 2020 17:21:33 +0300 Subject: Fix unnecessary braces warnings --- crates/ra_ide/src/call_info.rs | 14 ++++---- crates/ra_ide/src/completion/complete_fn_param.rs | 4 +-- crates/ra_ide/src/completion/complete_keyword.rs | 6 ++-- crates/ra_ide/src/display/navigation_target.rs | 42 +++++++++++------------ crates/ra_ide/src/display/structure.rs | 16 ++++----- crates/ra_ide/src/goto_type_definition.rs | 6 ++-- crates/ra_ide/src/runnables.rs | 4 +-- 7 files changed, 46 insertions(+), 46 deletions(-) (limited to 'crates/ra_ide') 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 { syntax.ancestors().find_map(|node| { match_ast! { match node { - ast::CallExpr(it) => { Some(FnCallNode::CallExpr(it)) }, + ast::CallExpr(it) => Some(FnCallNode::CallExpr(it)), ast::MethodCallExpr(it) => { let arg_list = it.arg_list()?; if !syntax.text_range().is_subrange(&arg_list.syntax().text_range()) { @@ -117,8 +117,8 @@ impl FnCallNode { } Some(FnCallNode::MethodCallExpr(it)) }, - ast::MacroCall(it) => { Some(FnCallNode::MacroCallExpr(it)) }, - _ => { None }, + ast::MacroCall(it) => Some(FnCallNode::MacroCallExpr(it)), + _ => None, } } }) @@ -127,10 +127,10 @@ impl FnCallNode { pub(crate) fn with_node_exact(node: &SyntaxNode) -> Option { match_ast! { match node { - ast::CallExpr(it) => { Some(FnCallNode::CallExpr(it)) }, - ast::MethodCallExpr(it) => { Some(FnCallNode::MethodCallExpr(it)) }, - ast::MacroCall(it) => { Some(FnCallNode::MacroCallExpr(it)) }, - _ => { None }, + ast::CallExpr(it) => Some(FnCallNode::CallExpr(it)), + ast::MethodCallExpr(it) => Some(FnCallNode::MethodCallExpr(it)), + ast::MacroCall(it) => Some(FnCallNode::MacroCallExpr(it)), + _ => None, } } } 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) for node in ctx.token.parent().ancestors() { match_ast! { match node { - ast::SourceFile(it) => { process(it, &mut params) }, - ast::ItemList(it) => { process(it, &mut params) }, + ast::SourceFile(it) => process(it, &mut params), + ast::ItemList(it) => process(it, &mut params), _ => (), } } 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 { } let loop_body = match_ast! { match node { - ast::ForExpr(it) => { it.loop_body() }, - ast::WhileExpr(it) => { it.loop_body() }, - ast::LoopExpr(it) => { it.loop_body() }, + ast::ForExpr(it) => it.loop_body(), + ast::WhileExpr(it) => it.loop_body(), + ast::LoopExpr(it) => it.loop_body(), _ => None, } }; 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 match_ast! { match node { - ast::FnDef(it) => { it.doc_comment_text() }, - ast::StructDef(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() }, - ast::TypeAliasDef(it) => { it.doc_comment_text() }, - ast::ConstDef(it) => { it.doc_comment_text() }, - ast::StaticDef(it) => { it.doc_comment_text() }, - ast::RecordFieldDef(it) => { it.doc_comment_text() }, - ast::EnumVariant(it) => { it.doc_comment_text() }, - ast::MacroCall(it) => { it.doc_comment_text() }, + ast::FnDef(it) => it.doc_comment_text(), + ast::StructDef(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(), + ast::TypeAliasDef(it) => it.doc_comment_text(), + ast::ConstDef(it) => it.doc_comment_text(), + ast::StaticDef(it) => it.doc_comment_text(), + ast::RecordFieldDef(it) => it.doc_comment_text(), + ast::EnumVariant(it) => it.doc_comment_text(), + ast::MacroCall(it) => it.doc_comment_text(), _ => None, } } @@ -424,16 +424,16 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> match_ast! { match node { - ast::FnDef(it) => { it.short_label() }, - ast::StructDef(it) => { it.short_label() }, - ast::EnumDef(it) => { it.short_label() }, - ast::TraitDef(it) => { it.short_label() }, - ast::Module(it) => { it.short_label() }, - ast::TypeAliasDef(it) => { it.short_label() }, - ast::ConstDef(it) => { it.short_label() }, - ast::StaticDef(it) => { it.short_label() }, - ast::RecordFieldDef(it) => { it.short_label() }, - ast::EnumVariant(it) => { it.short_label() }, + ast::FnDef(it) => it.short_label(), + ast::StructDef(it) => it.short_label(), + ast::EnumDef(it) => it.short_label(), + ast::TraitDef(it) => it.short_label(), + ast::Module(it) => it.short_label(), + ast::TypeAliasDef(it) => it.short_label(), + ast::ConstDef(it) => it.short_label(), + ast::StaticDef(it) => it.short_label(), + ast::RecordFieldDef(it) => it.short_label(), + ast::EnumVariant(it) => it.short_label(), _ => None, } } 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 { decl_with_detail(it, Some(detail)) }, - ast::StructDef(it) => { decl(it) }, - ast::EnumDef(it) => { decl(it) }, - ast::EnumVariant(it) => { decl(it) }, - ast::TraitDef(it) => { decl(it) }, - ast::Module(it) => { decl(it) }, + ast::StructDef(it) => decl(it), + ast::EnumDef(it) => decl(it), + ast::EnumVariant(it) => decl(it), + ast::TraitDef(it) => decl(it), + ast::Module(it) => decl(it), ast::TypeAliasDef(it) => { let ty = it.type_ref(); decl_with_type_ref(it, ty) }, - ast::RecordFieldDef(it) => { decl_with_ascription(it) }, - ast::ConstDef(it) => { decl_with_ascription(it) }, - ast::StaticDef(it) => { decl_with_ascription(it) }, + ast::RecordFieldDef(it) => decl_with_ascription(it), + ast::ConstDef(it) => decl_with_ascription(it), + ast::StaticDef(it) => decl_with_ascription(it), ast::ImplDef(it) => { let target_type = it.target_type()?; 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( let (ty, node) = sema.ancestors_with_macros(token.parent()).find_map(|node| { let ty = match_ast! { match node { - ast::Expr(expr) => { sema.type_of_expr(&expr)? }, - ast::Pat(pat) => { sema.type_of_pat(&pat)? }, - _ => { return None }, + ast::Expr(expr) => sema.type_of_expr(&expr)?, + ast::Pat(pat) => sema.type_of_pat(&pat)?, + _ => return None, } }; 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 { fn runnable(sema: &Semantics, item: SyntaxNode) -> Option { match_ast! { match item { - ast::FnDef(it) => { runnable_fn(sema, it) }, - ast::Module(it) => { runnable_mod(sema, it) }, + ast::FnDef(it) => runnable_fn(sema, it), + ast::Module(it) => runnable_mod(sema, it), _ => None, } } -- cgit v1.2.3