diff --git a/crates/hir_ty/src/consteval.rs b/crates/hir_ty/src/consteval.rs index 0139c5d589..958673600b 100644 --- a/crates/hir_ty/src/consteval.rs +++ b/crates/hir_ty/src/consteval.rs @@ -235,7 +235,7 @@ pub fn eval_const(expr: &Expr, ctx: &mut ConstEvalCtx<'_>) -> Result Err(ConstEvalError::TypeError), - _ => return Err(ConstEvalError::NotSupported("bin op on this operators")), + _ => Err(ConstEvalError::NotSupported("bin op on this operators")), } } Expr::Block { statements, tail, .. } => { diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 00c0de7f93..2d493b154f 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -278,7 +278,7 @@ impl InherentImpls { impls.collect_def_map(db, &crate_def_map); impls.shrink_to_fit(); - return Arc::new(impls); + Arc::new(impls) } pub(crate) fn inherent_impls_in_block_query( @@ -291,7 +291,7 @@ impl InherentImpls { impls.shrink_to_fit(); return Some(Arc::new(impls)); } - return None; + None } fn shrink_to_fit(&mut self) { diff --git a/crates/ide_assists/src/handlers/extract_module.rs b/crates/ide_assists/src/handlers/extract_module.rs index 169bc9ed4d..ffe4c74e0a 100644 --- a/crates/ide_assists/src/handlers/extract_module.rs +++ b/crates/ide_assists/src/handlers/extract_module.rs @@ -333,7 +333,7 @@ impl Module { } }); - return (refs, adt_fields); + (refs, adt_fields) } fn expand_and_group_usages_file_wise( @@ -563,7 +563,7 @@ impl Module { } }); } - return use_opt; + use_opt }); let mut use_tree_str_opt: Option> = None; @@ -646,7 +646,7 @@ impl Module { return Some(item); } - return None; + None } fn process_use_stmt_for_import_resolve( @@ -842,7 +842,7 @@ fn does_source_exists_outside_sel_in_same_mod( _ => {} } - return source_exists_outside_sel_in_same_mod; + source_exists_outside_sel_in_same_mod } fn get_replacements_for_visibilty_change( @@ -890,7 +890,7 @@ fn get_replacements_for_visibilty_change( } }); - return (body_items, replacements, record_field_parents, impls); + (body_items, replacements, record_field_parents, impls) } fn get_use_tree_paths_from_path( @@ -943,15 +943,13 @@ fn compare_hir_and_ast_module( return None; } - return Some(()); + Some(()) } fn indent_range_before_given_node(node: &SyntaxNode) -> Option { - let x = node.siblings_with_tokens(syntax::Direction::Prev).find(|x| { - return x.kind() == WHITESPACE; - })?; - - return Some(x.text_range()); + node.siblings_with_tokens(syntax::Direction::Prev) + .find(|x| x.kind() == WHITESPACE) + .map(|x| x.text_range()) } #[cfg(test)] diff --git a/crates/ide_completion/src/completions/attribute/derive.rs b/crates/ide_completion/src/completions/attribute/derive.rs index 1edc92d5d6..3c0e43ceac 100644 --- a/crates/ide_completion/src/completions/attribute/derive.rs +++ b/crates/ide_completion/src/completions/attribute/derive.rs @@ -46,7 +46,6 @@ pub(crate) fn complete_derive(acc: &mut Completions, ctx: &CompletionContext) { acc.add_resolution(ctx, name, def); } } - return; } None if is_absolute_path => acc.add_crate_roots(ctx), // only show modules in a fresh UseTree diff --git a/crates/ide_completion/src/completions/attribute/repr.rs b/crates/ide_completion/src/completions/attribute/repr.rs index 805038091c..1dcec5f493 100644 --- a/crates/ide_completion/src/completions/attribute/repr.rs +++ b/crates/ide_completion/src/completions/attribute/repr.rs @@ -14,7 +14,7 @@ pub(super) fn complete_repr(acc: &mut Completions, ctx: &CompletionContext, inpu ast::Expr::PathExpr(path) => path.path()?.as_single_name_ref(), ast::Expr::CallExpr(call) => match call.expr()? { ast::Expr::PathExpr(path) => path.path()?.as_single_name_ref(), - _ => return None, + _ => None, }, _ => None, }) diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 7bfac4daad..b62a830803 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -167,7 +167,7 @@ impl GlobalState { self.handle_event(event)? } - return Err("client exited without proper shutdown sequence".into()); + Err("client exited without proper shutdown sequence".into()) } fn next_event(&self, inbox: &Receiver) -> Option {