From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/base_db/src/fixture.rs | 2 +- crates/hir/src/lib.rs | 8 ++++---- crates/hir/src/semantics.rs | 4 ++-- crates/hir/src/source_analyzer.rs | 6 +++--- crates/hir_def/src/body/lower.rs | 6 +++--- crates/hir_def/src/body/scope.rs | 2 +- crates/hir_def/src/generics.rs | 4 ++-- crates/hir_def/src/item_tree/lower.rs | 6 +++--- crates/hir_def/src/nameres/collector.rs | 12 ++++++------ crates/hir_def/src/nameres/path_resolution.rs | 12 ++++++------ crates/hir_def/src/path/lower.rs | 4 ++-- crates/hir_def/src/resolver.rs | 10 +++++----- crates/hir_def/src/type_ref.rs | 16 ++++++++-------- crates/hir_expand/src/builtin_macro.rs | 6 +++--- crates/hir_expand/src/input.rs | 2 +- crates/hir_expand/src/proc_macro.rs | 2 +- .../src/diagnostics/match_check/deconstruct_pat.rs | 2 +- .../hir_ty/src/diagnostics/match_check/usefulness.rs | 6 +++--- crates/hir_ty/src/infer.rs | 2 +- crates/hir_ty/src/infer/coerce.rs | 2 +- crates/hir_ty/src/infer/expr.rs | 12 ++++++------ crates/hir_ty/src/infer/pat.rs | 2 +- crates/hir_ty/src/infer/path.rs | 6 +++--- crates/hir_ty/src/interner.rs | 6 +++--- crates/hir_ty/src/lower.rs | 6 +++--- crates/hir_ty/src/method_resolution.rs | 14 +++++++------- crates/ide/src/diagnostics.rs | 6 +++--- crates/ide/src/diagnostics/fixes/create_field.rs | 2 +- .../ide/src/diagnostics/fixes/fill_missing_fields.rs | 4 ++-- crates/ide/src/doc_links.rs | 20 ++++++++++---------- crates/ide/src/extend_selection.rs | 2 +- crates/ide/src/goto_definition.rs | 2 +- crates/ide/src/hover.rs | 8 ++++---- crates/ide/src/inlay_hints.rs | 6 +++--- crates/ide/src/join_lines.rs | 2 +- crates/ide/src/lib.rs | 12 ++++++------ crates/ide/src/references.rs | 2 +- crates/ide/src/references/rename.rs | 8 ++++---- crates/ide/src/runnables.rs | 8 ++++---- crates/ide/src/syntax_highlighting.rs | 4 ++-- crates/ide/src/syntax_highlighting/highlight.rs | 4 ++-- crates/ide/src/syntax_highlighting/html.rs | 2 +- crates/ide/src/syntax_highlighting/inject.rs | 4 ++-- crates/ide/src/typing/on_enter.rs | 6 +++--- .../src/handlers/convert_comment_block.rs | 4 ++-- crates/ide_assists/src/handlers/early_return.rs | 4 ++-- crates/ide_assists/src/handlers/extract_function.rs | 8 ++++---- crates/ide_assists/src/handlers/fill_match_arms.rs | 4 ++-- crates/ide_assists/src/handlers/fix_visibility.rs | 2 +- .../src/handlers/generate_enum_is_method.rs | 2 +- .../src/handlers/generate_enum_projection_method.rs | 2 +- crates/ide_assists/src/handlers/generate_function.rs | 8 ++++---- crates/ide_assists/src/handlers/generate_getter.rs | 2 +- crates/ide_assists/src/handlers/generate_new.rs | 2 +- crates/ide_assists/src/handlers/generate_setter.rs | 2 +- crates/ide_assists/src/handlers/remove_dbg.rs | 2 +- crates/ide_assists/src/handlers/reorder_fields.rs | 2 +- .../src/handlers/replace_derive_with_manual_impl.rs | 2 +- .../src/handlers/replace_if_let_with_match.rs | 2 +- .../src/handlers/wrap_return_type_in_result.rs | 2 +- crates/ide_assists/src/tests.rs | 2 +- crates/ide_assists/src/utils.rs | 2 +- crates/ide_assists/src/utils/suggest_name.rs | 2 +- crates/ide_completion/src/completions/dot.rs | 2 +- crates/ide_completion/src/completions/postfix.rs | 20 ++++++++++---------- .../src/completions/postfix/format_like.rs | 2 +- .../ide_completion/src/completions/qualified_path.rs | 2 +- crates/ide_completion/src/context.rs | 2 +- crates/ide_completion/src/patterns.rs | 6 +++--- crates/ide_completion/src/render.rs | 2 +- crates/ide_completion/src/render/pattern.rs | 6 +++--- crates/ide_db/src/call_info.rs | 2 +- crates/ide_db/src/helpers/import_assets.rs | 4 ++-- crates/ide_db/src/helpers/merge_imports.rs | 2 +- crates/ide_db/src/search.rs | 14 +++++++------- crates/ide_ssr/src/matching.rs | 6 +++--- crates/ide_ssr/src/replacing.rs | 10 +++++----- crates/ide_ssr/src/resolving.rs | 2 +- crates/ide_ssr/src/search.rs | 2 +- crates/ide_ssr/src/tests.rs | 2 +- crates/mbe/src/expander/matcher.rs | 20 ++++++++++---------- crates/mbe/src/expander/transcriber.rs | 8 ++++---- crates/mbe/src/lib.rs | 6 +++--- crates/mbe/src/parser.rs | 14 +++++++------- crates/mbe/src/subtree_source.rs | 6 +++--- crates/mbe/src/syntax_bridge.rs | 2 +- crates/mbe/src/tests/expand.rs | 2 +- crates/mbe/src/tt_iter.rs | 2 +- crates/proc_macro_api/src/msg.rs | 2 +- crates/project_model/src/build_data.rs | 2 +- crates/project_model/src/cargo_workspace.rs | 2 +- crates/project_model/src/sysroot.rs | 4 ++-- crates/project_model/src/workspace.rs | 12 ++++++------ crates/rust-analyzer/src/cargo_target_spec.rs | 2 +- crates/rust-analyzer/src/cli/load_cargo.rs | 2 +- crates/rust-analyzer/src/diagnostics.rs | 2 +- crates/rust-analyzer/src/diagnostics/to_proto.rs | 6 +++--- crates/rust-analyzer/src/global_state.rs | 10 +++++----- crates/rust-analyzer/src/handlers.rs | 8 ++++---- crates/rust-analyzer/src/lsp_utils.rs | 2 +- crates/rust-analyzer/src/main_loop.rs | 2 +- crates/rust-analyzer/src/to_proto.rs | 10 +++++----- crates/rust-analyzer/tests/slow-tests/main.rs | 6 +++--- crates/rust-analyzer/tests/slow-tests/support.rs | 2 +- crates/syntax/src/ast/edit.rs | 2 +- crates/syntax/src/ast/token_ext.rs | 2 +- crates/syntax/src/parsing.rs | 4 ++-- crates/syntax/src/parsing/lexer.rs | 2 +- crates/syntax/src/parsing/reparsing.rs | 6 +++--- crates/syntax/src/tests.rs | 4 ++-- crates/vfs/src/file_set.rs | 2 +- xtask/src/codegen/gen_lint_completions.rs | 2 +- xtask/src/codegen/gen_syntax.rs | 6 +++--- xtask/src/metrics.rs | 2 +- 114 files changed, 285 insertions(+), 285 deletions(-) diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index 69ceba735..da4afb5eb 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs @@ -190,7 +190,7 @@ impl From for FileMeta { edition: f .edition .as_ref() - .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()), + .map_or(Edition::Edition2018, |v| Edition::from_str(v).unwrap()), env: f.env.into_iter().collect(), introduce_new_source_root: f.introduce_new_source_root, } diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 2468c0dc6..f6eb23262 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1112,7 +1112,7 @@ impl Function { .collect(); sink.push(MissingFields { file: source_ptr.file_id, - field_list_parent: AstPtr::new(&record_expr), + field_list_parent: AstPtr::new(record_expr), field_list_parent_path: record_expr .path() .map(|path| AstPtr::new(&path)), @@ -2531,13 +2531,13 @@ impl Type { match ty.kind(&Interner) { TyKind::Adt(_, substs) => { cb(type_.derived(ty.clone())); - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::AssociatedType(_, substs) => { if let Some(_) = ty.associated_type_parent_trait(db) { cb(type_.derived(ty.clone())); } - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::OpaqueType(_, subst) => { if let Some(bounds) = ty.impl_trait_bounds(db) { @@ -2577,7 +2577,7 @@ impl Type { TyKind::FnDef(_, substs) | TyKind::Tuple(_, substs) | TyKind::Closure(.., substs) => { - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::Function(hir_ty::FnPointer { substitution, .. }) => { walk_substs(db, type_, &substitution.0, cb); diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index d522d5245..613266e07 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -192,7 +192,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { node: &SyntaxNode, offset: TextSize, ) -> Option { - if let Some(it) = find_node_at_offset(&node, offset) { + if let Some(it) = find_node_at_offset(node, offset) { return Some(it); } @@ -744,7 +744,7 @@ impl<'db> SemanticsImpl<'db> { return None; } - let func = self.resolve_method_call(&method_call_expr).map(Function::from)?; + let func = self.resolve_method_call(method_call_expr).map(Function::from)?; let res = match func.self_param(self.db)?.access(self.db) { Access::Shared | Access::Exclusive => true, Access::Owned => false, diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 37a050415..c9744d81d 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -222,7 +222,7 @@ impl SourceAnalyzer { Pat::Path(path) => path, _ => return None, }; - let res = resolve_hir_path(db, &self.resolver, &path)?; + let res = resolve_hir_path(db, &self.resolver, path)?; match res { PathResolution::Def(def) => Some(def), _ => None, @@ -329,7 +329,7 @@ impl SourceAnalyzer { let (variant, missing_fields, _exhaustive) = record_literal_missing_fields(db, infer, expr_id, &body[expr_id])?; - let res = self.missing_fields(db, krate, &substs, variant, missing_fields); + let res = self.missing_fields(db, krate, substs, variant, missing_fields); Some(res) } @@ -347,7 +347,7 @@ impl SourceAnalyzer { let (variant, missing_fields, _exhaustive) = record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; - let res = self.missing_fields(db, krate, &substs, variant, missing_fields); + let res = self.missing_fields(db, krate, substs, variant, missing_fields); Some(res) } diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index da1fdac33..a8bd36a0a 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -1002,16 +1002,16 @@ impl From for Literal { if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) { return Literal::Float(Default::default(), builtin); } else if let builtin @ Some(_) = - lit.suffix().and_then(|it| BuiltinInt::from_suffix(&it)) + lit.suffix().and_then(|it| BuiltinInt::from_suffix(it)) { Literal::Int(lit.value().unwrap_or(0) as i128, builtin) } else { - let builtin = lit.suffix().and_then(|it| BuiltinUint::from_suffix(&it)); + let builtin = lit.suffix().and_then(|it| BuiltinUint::from_suffix(it)); Literal::Uint(lit.value().unwrap_or(0), builtin) } } LiteralKind::FloatNumber(lit) => { - let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it)); + let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(it)); Literal::Float(Default::default(), ty) } LiteralKind::ByteString(bs) => { diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs index 6764de3a7..58a1fc81c 100644 --- a/crates/hir_def/src/body/scope.rs +++ b/crates/hir_def/src/body/scope.rs @@ -198,7 +198,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope } Expr::Lambda { args, body: body_expr, .. } => { let scope = scopes.new_scope(scope); - scopes.add_params_bindings(body, scope, &args); + scopes.add_params_bindings(body, scope, args); compute_expr_scopes(*body_expr, body, scopes, scope); } Expr::Match { expr, arms } => { diff --git a/crates/hir_def/src/generics.rs b/crates/hir_def/src/generics.rs index 44d22b918..6933f6e3c 100644 --- a/crates/hir_def/src/generics.rs +++ b/crates/hir_def/src/generics.rs @@ -280,7 +280,7 @@ impl GenericParams { sm.type_params.insert(param_id, Either::Right(type_param.clone())); let type_ref = TypeRef::Path(name.into()); - self.fill_bounds(&lower_ctx, &type_param, Either::Left(type_ref)); + self.fill_bounds(lower_ctx, &type_param, Either::Left(type_ref)); } for lifetime_param in params.lifetime_params() { let name = @@ -289,7 +289,7 @@ impl GenericParams { let param_id = self.lifetimes.alloc(param); sm.lifetime_params.insert(param_id, lifetime_param.clone()); let lifetime_ref = LifetimeRef::new_name(name); - self.fill_bounds(&lower_ctx, &lifetime_param, Either::Right(lifetime_ref)); + self.fill_bounds(lower_ctx, &lifetime_param, Either::Right(lifetime_ref)); } for const_param in params.const_params() { let name = const_param.name().map_or_else(Name::missing, |it| it.as_name()); diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index cfda7cb32..3f90bda74 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs @@ -823,7 +823,7 @@ fn is_intrinsic_fn_unsafe(name: &Name) -> bool { known::type_name, known::variant_count, ] - .contains(&name) + .contains(name) } fn lower_abi(abi: ast::Abi) -> Interned { @@ -855,7 +855,7 @@ impl UseTreeLowering<'_> { // E.g. `use something::{inner}` (prefix is `None`, path is `something`) // or `use something::{path::{inner::{innerer}}}` (prefix is `something::path`, path is `inner`) Some(path) => { - match ModPath::from_src(self.db, path, &self.hygiene) { + match ModPath::from_src(self.db, path, self.hygiene) { Some(it) => Some(it), None => return None, // FIXME: report errors somewhere } @@ -874,7 +874,7 @@ impl UseTreeLowering<'_> { } else { let is_glob = tree.star_token().is_some(); let path = match tree.path() { - Some(path) => Some(ModPath::from_src(self.db, path, &self.hygiene)?), + Some(path) => Some(ModPath::from_src(self.db, path, self.hygiene)?), None => None, }; let alias = tree.rename().map(|a| { diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 93f30f23d..6fab58f15 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -500,7 +500,7 @@ impl DefCollector<'_> { let (per_ns, _) = self.def_map.resolve_path( self.db, self.def_map.root, - &path, + path, BuiltinShadowMode::Other, ); @@ -722,7 +722,7 @@ impl DefCollector<'_> { if import.is_extern_crate { let res = self.def_map.resolve_name_in_extern_prelude( self.db, - &import + import .path .as_ident() .expect("extern crate should have been desugared to one-element path"), @@ -1351,7 +1351,7 @@ impl ModCollector<'_, '_> { let imports = Import::from_use( self.def_collector.db, krate, - &self.item_tree, + self.item_tree, ItemTreeId::new(self.file_id, import_id), ); self.def_collector.unresolved_imports.extend(imports.into_iter().map( @@ -1368,7 +1368,7 @@ impl ModCollector<'_, '_> { import: Import::from_extern_crate( self.def_collector.db, krate, - &self.item_tree, + self.item_tree, ItemTreeId::new(self.file_id, import_id), ), status: PartialResolvedImport::Unresolved, @@ -1889,7 +1889,7 @@ impl ModCollector<'_, '_> { self.def_collector.def_map.with_ancestor_maps( self.def_collector.db, self.module_id, - &mut |map, module| map[module].scope.get_legacy_macro(&name), + &mut |map, module| map[module].scope.get_legacy_macro(name), ) }) }, @@ -1993,7 +1993,7 @@ mod tests { } fn do_resolve(code: &str) -> DefMap { - let (db, _file_id) = TestDB::with_single_file(&code); + let (db, _file_id) = TestDB::with_single_file(code); let krate = db.test_crate(); let edition = db.crate_graph()[krate].edition; diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index c984148c3..629bc7952 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs @@ -93,7 +93,7 @@ impl DefMap { let mut vis = match visibility { RawVisibility::Module(path) => { let (result, remaining) = - self.resolve_path(db, original_module, &path, BuiltinShadowMode::Module); + self.resolve_path(db, original_module, path, BuiltinShadowMode::Module); if remaining.is_some() { return None; } @@ -205,7 +205,7 @@ impl DefMap { None => return ResolvePathResult::empty(ReachedFixedPoint::Yes), }; log::debug!("resolving {:?} in crate root (+ extern prelude)", segment); - self.resolve_name_in_crate_root_or_extern_prelude(db, &segment) + self.resolve_name_in_crate_root_or_extern_prelude(db, segment) } PathKind::Plain => { let (_, segment) = match segments.next() { @@ -222,7 +222,7 @@ impl DefMap { if path.segments().len() == 1 { shadow } else { BuiltinShadowMode::Module }; log::debug!("resolving {:?} in module", segment); - self.resolve_name_in_module(db, original_module, &segment, prefer_module) + self.resolve_name_in_module(db, original_module, segment, prefer_module) } PathKind::Super(lvl) => { let mut module = original_module; @@ -269,7 +269,7 @@ impl DefMap { Some((_, segment)) => segment, None => return ResolvePathResult::empty(ReachedFixedPoint::Yes), }; - if let Some(def) = self.extern_prelude.get(&segment) { + if let Some(def) = self.extern_prelude.get(segment) { log::debug!("absolute path {:?} resolved to crate {:?}", path, def); PerNs::types(*def, Visibility::Public) } else { @@ -319,13 +319,13 @@ impl DefMap { }; // Since it is a qualified path here, it should not contains legacy macros - module_data.scope.get(&segment) + module_data.scope.get(segment) } ModuleDefId::AdtId(AdtId::EnumId(e)) => { // enum variant cov_mark::hit!(can_import_enum_variant); let enum_data = db.enum_data(e); - match enum_data.variant(&segment) { + match enum_data.variant(segment) { Some(local_id) => { let variant = EnumVariantId { parent: e, local_id }; match &*enum_data.variants[local_id].variant_data { diff --git a/crates/hir_def/src/path/lower.rs b/crates/hir_def/src/path/lower.rs index f6220aa92..27345d07c 100644 --- a/crates/hir_def/src/path/lower.rs +++ b/crates/hir_def/src/path/lower.rs @@ -208,13 +208,13 @@ fn lower_generic_args_from_fn_path( let params = params?; let mut param_types = Vec::new(); for param in params.params() { - let type_ref = TypeRef::from_ast_opt(&ctx, param.ty()); + let type_ref = TypeRef::from_ast_opt(ctx, param.ty()); param_types.push(type_ref); } let arg = GenericArg::Type(TypeRef::Tuple(param_types)); args.push(arg); if let Some(ret_type) = ret_type { - let type_ref = TypeRef::from_ast_opt(&ctx, ret_type.ty()); + let type_ref = TypeRef::from_ast_opt(ctx, ret_type.ty()); bindings.push(AssociatedTypeBinding { name: name![Output], type_ref: Some(type_ref), diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs index fb8a6f260..d4681fa3e 100644 --- a/crates/hir_def/src/resolver.rs +++ b/crates/hir_def/src/resolver.rs @@ -133,7 +133,7 @@ impl Resolver { Some(it) => it, None => return PerNs::none(), }; - let (module_res, segment_index) = item_map.resolve_path(db, module, &path, shadow); + let (module_res, segment_index) = item_map.resolve_path(db, module, path, shadow); if segment_index.is_some() { return PerNs::none(); } @@ -150,7 +150,7 @@ impl Resolver { path: &ModPath, ) -> Option { let (item_map, module) = self.module_scope()?; - let (module_res, ..) = item_map.resolve_path(db, module, &path, BuiltinShadowMode::Module); + let (module_res, ..) = item_map.resolve_path(db, module, path, BuiltinShadowMode::Module); match module_res.take_types()? { ModuleDefId::TraitId(it) => Some(it), _ => None, @@ -325,7 +325,7 @@ impl Resolver { path: &ModPath, ) -> Option { let (item_map, module) = self.module_scope()?; - item_map.resolve_path(db, module, &path, BuiltinShadowMode::Other).0.take_macros() + item_map.resolve_path(db, module, path, BuiltinShadowMode::Other).0.take_macros() } pub fn process_all_names(&self, db: &dyn DefDatabase, f: &mut dyn FnMut(Name, ScopeDef)) { @@ -561,7 +561,7 @@ impl ModuleItemMap { path: &ModPath, ) -> Option { let (module_def, idx) = - self.def_map.resolve_path_locally(db, self.module_id, &path, BuiltinShadowMode::Other); + self.def_map.resolve_path_locally(db, self.module_id, path, BuiltinShadowMode::Other); match idx { None => { let value = to_value_ns(module_def)?; @@ -591,7 +591,7 @@ impl ModuleItemMap { path: &ModPath, ) -> Option<(TypeNs, Option)> { let (module_def, idx) = - self.def_map.resolve_path_locally(db, self.module_id, &path, BuiltinShadowMode::Other); + self.def_map.resolve_path_locally(db, self.module_id, path, BuiltinShadowMode::Other); let res = to_type_ns(module_def)?; Some((res, idx)) } diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs index cbde6b940..ffe499973 100644 --- a/crates/hir_def/src/type_ref.rs +++ b/crates/hir_def/src/type_ref.rs @@ -128,7 +128,7 @@ impl TypeRef { /// Converts an `ast::TypeRef` to a `hir::TypeRef`. pub fn from_ast(ctx: &LowerCtx, node: ast::Type) -> Self { match node { - ast::Type::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), + ast::Type::ParenType(inner) => TypeRef::from_ast_opt(ctx, inner.ty()), ast::Type::TupleType(inner) => { TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) } @@ -142,7 +142,7 @@ impl TypeRef { .unwrap_or(TypeRef::Error) } ast::Type::PtrType(inner) => { - let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); + let inner_ty = TypeRef::from_ast_opt(ctx, inner.ty()); let mutability = Mutability::from_mutable(inner.mut_token().is_some()); TypeRef::RawPtr(Box::new(inner_ty), mutability) } @@ -156,13 +156,13 @@ impl TypeRef { .map(ConstScalar::usize_from_literal_expr) .unwrap_or(ConstScalar::Unknown); - TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())), len) + TypeRef::Array(Box::new(TypeRef::from_ast_opt(ctx, inner.ty())), len) } ast::Type::SliceType(inner) => { - TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) + TypeRef::Slice(Box::new(TypeRef::from_ast_opt(ctx, inner.ty()))) } ast::Type::RefType(inner) => { - let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); + let inner_ty = TypeRef::from_ast_opt(ctx, inner.ty()); let lifetime = inner.lifetime().map(|lt| LifetimeRef::new(<)); let mutability = Mutability::from_mutable(inner.mut_token().is_some()); TypeRef::Reference(Box::new(inner_ty), lifetime, mutability) @@ -180,7 +180,7 @@ impl TypeRef { is_varargs = param.dotdotdot_token().is_some(); } - pl.params().map(|p| p.ty()).map(|it| TypeRef::from_ast_opt(&ctx, it)).collect() + pl.params().map(|p| p.ty()).map(|it| TypeRef::from_ast_opt(ctx, it)).collect() } else { Vec::new() }; @@ -188,7 +188,7 @@ impl TypeRef { TypeRef::Fn(params, is_varargs) } // for types are close enough for our purposes to the inner type for now... - ast::Type::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), + ast::Type::ForType(inner) => TypeRef::from_ast_opt(ctx, inner.ty()), ast::Type::ImplTraitType(inner) => { TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) } @@ -229,7 +229,7 @@ impl TypeRef { TypeRef::RawPtr(type_ref, _) | TypeRef::Reference(type_ref, ..) | TypeRef::Array(type_ref, _) - | TypeRef::Slice(type_ref) => go(&type_ref, f), + | TypeRef::Slice(type_ref) => go(type_ref, f), TypeRef::ImplTrait(bounds) | TypeRef::DynTrait(bounds) => { for bound in bounds { match bound.as_ref() { diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 0b310ba2f..51572226e 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs @@ -354,7 +354,7 @@ fn concat_expand( // concat works with string and char literals, so remove any quotes. // It also works with integer, float and boolean literals, so just use the rest // as-is. - let component = unquote_str(&it).unwrap_or_else(|| it.text.to_string()); + let component = unquote_str(it).unwrap_or_else(|| it.text.to_string()); text.push_str(&component); } // handle boolean literals @@ -417,7 +417,7 @@ fn parse_string(tt: &tt::Subtree) -> Result { tt.token_trees .get(0) .and_then(|tt| match tt { - tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(&it), + tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it), _ => None, }) .ok_or_else(|| mbe::ExpandError::ConversionError) @@ -561,7 +561,7 @@ mod tests { use syntax::ast::NameOwner; fn expand_builtin_macro(ra_fixture: &str) -> String { - let (db, file_id) = TestDB::with_single_file(&ra_fixture); + let (db, file_id) = TestDB::with_single_file(ra_fixture); let parsed = db.parse(file_id); let mut macro_rules: Vec<_> = parsed.syntax_node().descendants().filter_map(ast::MacroRules::cast).collect(); diff --git a/crates/hir_expand/src/input.rs b/crates/hir_expand/src/input.rs index 82dc7f326..bc3ecc593 100644 --- a/crates/hir_expand/src/input.rs +++ b/crates/hir_expand/src/input.rs @@ -78,7 +78,7 @@ mod tests { use super::*; fn test_remove_derives_up_to(attr: usize, ra_fixture: &str, expect: Expect) { - let (db, file_id) = TestDB::with_single_file(&ra_fixture); + let (db, file_id) = TestDB::with_single_file(ra_fixture); let parsed = db.parse(file_id); let mut items: Vec<_> = diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs index dbe1b446e..3ad2d3bf7 100644 --- a/crates/hir_expand/src/proc_macro.rs +++ b/crates/hir_expand/src/proc_macro.rs @@ -51,7 +51,7 @@ impl ProcMacroExpander { // Proc macros have access to the environment variables of the invoking crate. let env = &krate_graph[calling_crate].env; - proc_macro.expander.expand(&tt, attr_arg, &env).map_err(mbe::ExpandError::from) + proc_macro.expander.expand(tt, attr_arg, env).map_err(mbe::ExpandError::from) } None => Err(mbe::ExpandError::UnresolvedProcMacro), } diff --git a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs index 222141bd6..088d2791e 100644 --- a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs +++ b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs @@ -528,7 +528,7 @@ impl SplitWildcard { smallvec![NonExhaustive] } TyKind::Never => SmallVec::new(), - _ if cx.is_uninhabited(&pcx.ty) => SmallVec::new(), + _ if cx.is_uninhabited(pcx.ty) => SmallVec::new(), TyKind::Adt(..) | TyKind::Tuple(..) | TyKind::Ref(..) => smallvec![Single], // This type is one for which we cannot list constructors, like `str` or `f64`. _ => smallvec![NonExhaustive], diff --git a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs index bd76a606c..f5ac71444 100644 --- a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs +++ b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs @@ -645,7 +645,7 @@ impl SubPatSet { (Seq { subpats: s_set }, Seq { subpats: mut o_set }) => { s_set.retain(|i, s_sub_set| { // Missing entries count as full. - let o_sub_set = o_set.remove(&i).unwrap_or(Full); + let o_sub_set = o_set.remove(i).unwrap_or(Full); s_sub_set.union(o_sub_set); // We drop full entries. !s_sub_set.is_full() @@ -656,7 +656,7 @@ impl SubPatSet { (Alt { subpats: s_set, .. }, Alt { subpats: mut o_set, .. }) => { s_set.retain(|i, s_sub_set| { // Missing entries count as empty. - let o_sub_set = o_set.remove(&i).unwrap_or(Empty); + let o_sub_set = o_set.remove(i).unwrap_or(Empty); s_sub_set.union(o_sub_set); // We drop empty entries. !s_sub_set.is_empty() @@ -898,7 +898,7 @@ impl Usefulness { } else { witnesses .into_iter() - .map(|witness| witness.apply_constructor(pcx, &ctor, ctor_wild_subpatterns)) + .map(|witness| witness.apply_constructor(pcx, ctor, ctor_wild_subpatterns)) .collect() }; WithWitnesses(new_witnesses) diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index f023c1fb7..9590c2e47 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs @@ -782,7 +782,7 @@ impl Expectation { fn adjust_for_branches(&self, table: &mut unify::InferenceTable) -> Expectation { match self { Expectation::HasType(ety) => { - let ety = table.resolve_ty_shallow(&ety); + let ety = table.resolve_ty_shallow(ety); if !ety.is_ty_var() { Expectation::HasType(ety) } else { diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 03b97e7db..8647d7437 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -109,7 +109,7 @@ impl<'a> InferenceContext<'a> { } // Consider coercing the subtype to a DST - if let Ok(ret) = self.try_coerce_unsized(&from_ty, &to_ty) { + if let Ok(ret) = self.try_coerce_unsized(&from_ty, to_ty) { return Ok(ret); } diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index e34f194ff..4805c0a00 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -54,7 +54,7 @@ impl<'a> InferenceContext<'a> { /// Infer type of expression with possibly implicit coerce to the expected type. /// Return the type after possible coercion. pub(super) fn infer_expr_coerce(&mut self, expr: ExprId, expected: &Expectation) -> Ty { - let ty = self.infer_expr_inner(expr, &expected); + let ty = self.infer_expr_inner(expr, expected); let ty = if let Some(target) = expected.only_has_type(&mut self.table) { if !self.coerce(&ty, &target) { self.result @@ -135,11 +135,11 @@ impl<'a> InferenceContext<'a> { let mut both_arms_diverge = Diverges::Always; let mut result_ty = self.table.new_type_var(); - let then_ty = self.infer_expr_inner(*then_branch, &expected); + let then_ty = self.infer_expr_inner(*then_branch, expected); both_arms_diverge &= mem::replace(&mut self.diverges, Diverges::Maybe); result_ty = self.coerce_merge_branch(Some(*then_branch), &result_ty, &then_ty); let else_ty = match else_branch { - Some(else_branch) => self.infer_expr_inner(*else_branch, &expected), + Some(else_branch) => self.infer_expr_inner(*else_branch, expected), None => TyBuilder::unit(), }; both_arms_diverge &= self.diverges; @@ -330,8 +330,8 @@ impl<'a> InferenceContext<'a> { .infer_method_call( tgt_expr, *receiver, - &args, - &method_name, + args, + method_name, generic_args.as_deref(), ), Expr::Match { expr, arms } => { @@ -993,7 +993,7 @@ impl<'a> InferenceContext<'a> { } fn register_obligations_for_call(&mut self, callable_ty: &Ty) { - let callable_ty = self.resolve_ty_shallow(&callable_ty); + let callable_ty = self.resolve_ty_shallow(callable_ty); if let TyKind::FnDef(fn_def, parameters) = callable_ty.kind(&Interner) { let def: CallableDefId = from_chalk(self.db, *fn_def); let generic_predicates = self.db.generic_predicates(def.into()); diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 25dff7e49..8f5db1f40 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -192,7 +192,7 @@ impl<'a> InferenceContext<'a> { Pat::Path(path) => { // FIXME use correct resolver for the surrounding expression let resolver = self.resolver.clone(); - self.infer_path(&resolver, &path, pat.into()).unwrap_or(self.err_ty()) + self.infer_path(&resolver, path, pat.into()).unwrap_or(self.err_ty()) } Pat::Bind { mode, name: _, subpat } => { let mode = if mode == &BindingAnnotation::Unannotated { diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 14c99eafd..056cdb5d5 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs @@ -43,11 +43,11 @@ impl<'a> InferenceContext<'a> { } let ty = self.make_ty(type_ref); let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); - let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); + let ctx = crate::lower::TyLoweringContext::new(self.db, resolver); let (ty, _) = ctx.lower_ty_relative_path(ty, None, remaining_segments_for_ty); self.resolve_ty_assoc_item( ty, - &path.segments().last().expect("path had at least one segment").name, + path.segments().last().expect("path had at least one segment").name, id, )? } else { @@ -154,7 +154,7 @@ impl<'a> InferenceContext<'a> { let segment = remaining_segments.last().expect("there should be at least one segment here"); - self.resolve_ty_assoc_item(ty, &segment.name, id) + self.resolve_ty_assoc_item(ty, segment.name, id) } } } diff --git a/crates/hir_ty/src/interner.rs b/crates/hir_ty/src/interner.rs index 29ffdd9b7..5fef878e8 100644 --- a/crates/hir_ty/src/interner.rs +++ b/crates/hir_ty/src/interner.rs @@ -331,7 +331,7 @@ impl chalk_ir::interner::Interner for Interner { &self, clauses: &'a Self::InternedProgramClauses, ) -> &'a [chalk_ir::ProgramClause] { - &clauses + clauses } fn intern_quantified_where_clauses( @@ -373,7 +373,7 @@ impl chalk_ir::interner::Interner for Interner { &self, canonical_var_kinds: &'a Self::InternedCanonicalVarKinds, ) -> &'a [chalk_ir::CanonicalVarKind] { - &canonical_var_kinds + canonical_var_kinds } fn intern_constraints( @@ -413,7 +413,7 @@ impl chalk_ir::interner::Interner for Interner { &self, variances: &'a Self::InternedVariances, ) -> &'a [chalk_ir::Variance] { - &variances + variances } } diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index c83933c73..0b8f21e5d 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -238,7 +238,7 @@ impl<'a> TyLoweringContext<'a> { // away instead of two. let actual_opaque_type_data = self .with_debruijn(DebruijnIndex::INNERMOST, |ctx| { - ctx.lower_impl_trait(&bounds) + ctx.lower_impl_trait(bounds) }); self.opaque_type_data.borrow_mut()[idx as usize] = actual_opaque_type_data; @@ -421,7 +421,7 @@ impl<'a> TyLoweringContext<'a> { let found = self .db .trait_data(trait_ref.hir_trait_id()) - .associated_type_by_name(&segment.name); + .associated_type_by_name(segment.name); match found { Some(associated_ty) => { // FIXME handle type parameters on the segment @@ -505,7 +505,7 @@ impl<'a> TyLoweringContext<'a> { pub(crate) fn lower_path(&self, path: &Path) -> (Ty, Option) { // Resolve the path (in type namespace) if let Some(type_ref) = path.type_anchor() { - let (ty, res) = self.lower_ty_ext(&type_ref); + let (ty, res) = self.lower_ty_ext(type_ref); return self.lower_ty_relative_path(ty, res, path.segments()); } let (resolution, remaining_index) = diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index a23527f7d..8c00a6369 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -372,7 +372,7 @@ pub(crate) fn lookup_method( db, env, krate, - &traits_in_scope, + traits_in_scope, visible_from_module, Some(name), LookupMode::MethodCall, @@ -484,7 +484,7 @@ fn iterate_method_candidates_impl( LookupMode::Path => { // No autoderef for path lookups iterate_method_candidates_for_self_ty( - &ty, + ty, db, env, krate, @@ -513,7 +513,7 @@ fn iterate_method_candidates_with_autoref( db, env.clone(), krate, - &traits_in_scope, + traits_in_scope, visible_from_module, name, &mut callback, @@ -531,7 +531,7 @@ fn iterate_method_candidates_with_autoref( db, env.clone(), krate, - &traits_in_scope, + traits_in_scope, visible_from_module, name, &mut callback, @@ -549,7 +549,7 @@ fn iterate_method_candidates_with_autoref( db, env, krate, - &traits_in_scope, + traits_in_scope, visible_from_module, name, &mut callback, @@ -593,7 +593,7 @@ fn iterate_method_candidates_by_receiver( db, env.clone(), krate, - &traits_in_scope, + traits_in_scope, name, Some(receiver_ty), &mut callback, @@ -870,7 +870,7 @@ fn transform_receiver_ty( .fill_with_unknown() .build(), AssocContainerId::ImplId(impl_id) => { - let impl_substs = inherent_impl_substs(db, env, impl_id, &self_ty)?; + let impl_substs = inherent_impl_substs(db, env, impl_id, self_ty)?; TyBuilder::subst_for_def(db, function_id) .use_parent_substs(&impl_substs) .fill_with_unknown() diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 4193aabf5..31d5cfedc 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -208,7 +208,7 @@ pub(crate) fn diagnostics( match sema.to_module_def(file_id) { Some(m) => m.diagnostics(db, &mut sink, internal_diagnostics), None => { - sink.push(UnlinkedFile { file_id, node: SyntaxNodePtr::new(&parse.tree().syntax()) }); + sink.push(UnlinkedFile { file_id, node: SyntaxNodePtr::new(parse.tree().syntax()) }); } } @@ -222,7 +222,7 @@ fn diagnostic_with_fix( resolve: &AssistResolveStrategy, ) -> Diagnostic { Diagnostic::error(sema.diagnostics_display_range(d.display_source()).range, d.message()) - .with_fixes(d.fixes(&sema, resolve)) + .with_fixes(d.fixes(sema, resolve)) .with_code(Some(d.code())) } @@ -232,7 +232,7 @@ fn warning_with_fix( resolve: &AssistResolveStrategy, ) -> Diagnostic { Diagnostic::hint(sema.diagnostics_display_range(d.display_source()).range, d.message()) - .with_fixes(d.fixes(&sema, resolve)) + .with_fixes(d.fixes(sema, resolve)) .with_code(Some(d.code())) } diff --git a/crates/ide/src/diagnostics/fixes/create_field.rs b/crates/ide/src/diagnostics/fixes/create_field.rs index a5f457dce..f6e45967a 100644 --- a/crates/ide/src/diagnostics/fixes/create_field.rs +++ b/crates/ide/src/diagnostics/fixes/create_field.rs @@ -18,7 +18,7 @@ impl DiagnosticWithFixes for NoSuchField { ) -> Option> { let root = sema.db.parse_or_expand(self.file)?; missing_record_expr_field_fixes( - &sema, + sema, self.file.original_file(sema.db), &self.field.to_node(&root), ) diff --git a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs index b5dd64c08..c76f6008a 100644 --- a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs +++ b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs @@ -37,7 +37,7 @@ impl DiagnosticWithFixes for MissingFields { let edit = { let mut builder = TextEdit::builder(); - algo::diff(&old_field_list.syntax(), &new_field_list.syntax()) + algo::diff(old_field_list.syntax(), new_field_list.syntax()) .into_text_edit(&mut builder); builder.finish() }; @@ -45,7 +45,7 @@ impl DiagnosticWithFixes for MissingFields { "fill_missing_fields", "Fill struct fields", SourceChange::from_text_edit(self.file.original_file(sema.db), edit), - sema.original_range(&field_list_parent.syntax()).range, + sema.original_range(field_list_parent.syntax()).range, )]) } } diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index ec3828ab2..774952d96 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -151,18 +151,18 @@ pub(crate) fn resolve_doc_path_for_def( ) -> Option { match def { Definition::ModuleDef(def) => match def { - hir::ModuleDef::Module(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Function(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Adt(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Variant(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Const(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Static(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::Trait(it) => it.resolve_doc_path(db, &link, ns), - hir::ModuleDef::TypeAlias(it) => it.resolve_doc_path(db, &link, ns), + hir::ModuleDef::Module(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Function(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Adt(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Variant(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Const(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Static(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::Trait(it) => it.resolve_doc_path(db, link, ns), + hir::ModuleDef::TypeAlias(it) => it.resolve_doc_path(db, link, ns), hir::ModuleDef::BuiltinType(_) => None, }, - Definition::Macro(it) => it.resolve_doc_path(db, &link, ns), - Definition::Field(it) => it.resolve_doc_path(db, &link, ns), + Definition::Macro(it) => it.resolve_doc_path(db, link, ns), + Definition::Field(it) => it.resolve_doc_path(db, link, ns), Definition::SelfType(_) | Definition::Local(_) | Definition::GenericParam(_) diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index 7032889ac..c7ec87edf 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs @@ -328,7 +328,7 @@ mod tests { use super::*; fn do_check(before: &str, afters: &[&str]) { - let (analysis, position) = fixture::position(&before); + let (analysis, position) = fixture::position(before); let before = analysis.file_text(position.file_id).unwrap(); let range = TextRange::empty(position.offset); let mut frange = FileRange { file_id: position.file_id, range }; diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 2d36c34e9..27a292d83 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -57,7 +57,7 @@ pub(crate) fn goto_definition( }, ast::Name(name) => { let def = NameClass::classify(&sema, &name)?.referenced_or_defined(sema.db); - try_find_trait_item_definition(&sema.db, &def) + try_find_trait_item_definition(sema.db, &def) .or_else(|| def.try_to_nav(sema.db)) }, ast::Lifetime(lt) => if let Some(name_class) = NameClass::classify_lifetime(&sema, <) { diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 1c6d36939..b4b3b45b5 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -288,7 +288,7 @@ fn runnable_action( ) -> Option { match def { Definition::ModuleDef(it) => match it { - ModuleDef::Module(it) => runnable_mod(&sema, it).map(|it| HoverAction::Runnable(it)), + ModuleDef::Module(it) => runnable_mod(sema, it).map(|it| HoverAction::Runnable(it)), ModuleDef::Function(func) => { let src = func.source(sema.db)?; if src.file_id != file_id.into() { @@ -297,7 +297,7 @@ fn runnable_action( return None; } - runnable_fn(&sema, func).map(HoverAction::Runnable) + runnable_fn(sema, func).map(HoverAction::Runnable) } _ => None, }, @@ -432,7 +432,7 @@ fn hover_for_definition( return match def { Definition::Macro(it) => match &it.source(db)?.value { Either::Left(mac) => { - let label = macro_label(&mac); + let label = macro_label(mac); from_def_source_labeled(db, it, Some(label), mod_path) } Either::Right(_) => { @@ -516,7 +516,7 @@ fn hover_for_keyword( if !token.kind().is_keyword() { return None; } - let famous_defs = FamousDefs(&sema, sema.scope(&token.parent()?).krate()); + let famous_defs = FamousDefs(sema, sema.scope(&token.parent()?).krate()); // std exposes {}_keyword modules with docstrings on the root to document keywords let keyword_mod = format!("{}_keyword", token.text()); let doc_owner = find_std_module(&famous_defs, &keyword_mod)?; diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 821c61403..9cd33d0e4 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -96,7 +96,7 @@ fn get_chaining_hints( } let krate = sema.scope(expr.syntax()).module().map(|it| it.krate()); - let famous_defs = FamousDefs(&sema, krate); + let famous_defs = FamousDefs(sema, krate); let mut tokens = expr .syntax() @@ -165,7 +165,7 @@ fn get_param_name_hints( }; Some((param_name, arg)) }) - .filter(|(param_name, arg)| !should_hide_param_name_hint(sema, &callable, param_name, &arg)) + .filter(|(param_name, arg)| !should_hide_param_name_hint(sema, &callable, param_name, arg)) .map(|(param_name, arg)| InlayHint { range: arg.syntax().text_range(), kind: InlayKind::ParameterHint, @@ -187,7 +187,7 @@ fn get_bind_pat_hints( } let krate = sema.scope(pat.syntax()).module().map(|it| it.krate()); - let famous_defs = FamousDefs(&sema, krate); + let famous_defs = FamousDefs(sema, krate); let ty = sema.type_of_pat(&pat.clone().into())?; diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs index c67ccd1a9..93d3760bf 100644 --- a/crates/ide/src/join_lines.rs +++ b/crates/ide/src/join_lines.rs @@ -60,7 +60,7 @@ fn remove_newlines(edit: &mut TextEditBuilder, token: &SyntaxToken, range: TextR let pos: TextSize = (pos as u32).into(); let offset = token.text_range().start() + range.start() + pos; if !edit.invalidates_offset(offset) { - remove_newline(edit, &token, offset); + remove_newline(edit, token, offset); } } } diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 97c9e5d2b..0511efae3 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -282,20 +282,20 @@ impl Analysis { file_id: FileId, text_range: Option, ) -> Cancellable { - self.with_db(|db| syntax_tree::syntax_tree(&db, file_id, text_range)) + self.with_db(|db| syntax_tree::syntax_tree(db, file_id, text_range)) } pub fn view_hir(&self, position: FilePosition) -> Cancellable { - self.with_db(|db| view_hir::view_hir(&db, position)) + self.with_db(|db| view_hir::view_hir(db, position)) } pub fn view_item_tree(&self, file_id: FileId) -> Cancellable { - self.with_db(|db| view_item_tree::view_item_tree(&db, file_id)) + self.with_db(|db| view_item_tree::view_item_tree(db, file_id)) } /// Renders the crate graph to GraphViz "dot" syntax. pub fn view_crate_graph(&self) -> Cancellable> { - self.with_db(|db| view_crate_graph::view_crate_graph(&db)) + self.with_db(|db| view_crate_graph::view_crate_graph(db)) } pub fn expand_macro(&self, position: FilePosition) -> Cancellable> { @@ -315,7 +315,7 @@ impl Analysis { /// up minor stuff like continuing the comment. /// The edit will be a snippet (with `$0`). pub fn on_enter(&self, position: FilePosition) -> Cancellable> { - self.with_db(|db| typing::on_enter(&db, position)) + self.with_db(|db| typing::on_enter(db, position)) } /// Returns an edit which should be applied after a character was typed. @@ -331,7 +331,7 @@ impl Analysis { if !typing::TRIGGER_CHARS.contains(char_typed) { return Ok(None); } - self.with_db(|db| typing::on_char_typed(&db, position, char_typed)) + self.with_db(|db| typing::on_char_typed(db, position, char_typed)) } /// Returns a tree representation of symbols in the file. Useful to draw a diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index f8b64a669..a0fdead2c 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -62,7 +62,7 @@ pub(crate) fn find_all_refs( if let Some(name) = get_name_of_item_declaration(&syntax, position) { (NameClass::classify(sema, &name)?.referenced_or_defined(sema.db), true) } else { - (find_def(&sema, &syntax, position)?, false) + (find_def(sema, &syntax, position)?, false) }; let mut usages = def.usages(sema).set_scope(search_scope).include_self_refs().all(); diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 7dfc5043e..02b171bda 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs @@ -64,7 +64,7 @@ pub(crate) fn prepare_rename( } }; let name_like = sema - .find_node_at_offset_with_descend(&syntax, position.offset) + .find_node_at_offset_with_descend(syntax, position.offset) .ok_or_else(|| format_err!("No references found at position"))?; let node = match &name_like { ast::NameLike::Name(it) => it.syntax(), @@ -104,7 +104,7 @@ pub(crate) fn rename_with_semantics( let def = find_definition(sema, syntax, position)?; match def { - Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(&sema, module, new_name), + Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(sema, module, new_name), Definition::SelfType(_) => bail!("Cannot rename `Self`"), Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"), def => rename_reference(sema, def, new_name), @@ -323,7 +323,7 @@ fn rename_reference( } let mut source_change = SourceChange::default(); source_change.extend(usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(&references, def, new_name)) + (file_id, source_edit_from_references(references, def, new_name)) })); let (file_id, edit) = source_edit_from_def(sema, def, new_name)?; @@ -413,7 +413,7 @@ fn rename_self_to_param( let mut source_change = SourceChange::default(); source_change.insert_source_edit(file_id.original_file(sema.db), edit); source_change.extend(usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(&references, def, new_name)) + (file_id, source_edit_from_references(references, def, new_name)) })); Ok(source_change) } diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 552054951..03faabadc 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -158,7 +158,7 @@ fn find_related_tests( search_scope: Option, tests: &mut FxHashSet, ) { - if let Some(refs) = references::find_all_refs(&sema, position, search_scope) { + if let Some(refs) = references::find_all_refs(sema, position, search_scope) { for (file_id, refs) in refs.references { let file = sema.parse(file_id); let file = file.syntax(); @@ -169,10 +169,10 @@ fn find_related_tests( }); for fn_def in functions { - if let Some(runnable) = as_test_runnable(&sema, &fn_def) { + if let Some(runnable) = as_test_runnable(sema, &fn_def) { // direct test tests.insert(runnable); - } else if let Some(module) = parent_test_module(&sema, &fn_def) { + } else if let Some(module) = parent_test_module(sema, &fn_def) { // indirect test find_related_tests_in_module(sema, &fn_def, &module, tests); } @@ -203,7 +203,7 @@ fn find_related_tests_in_module( } fn as_test_runnable(sema: &Semantics, fn_def: &ast::Fn) -> Option { - if test_related_attribute(&fn_def).is_some() { + if test_related_attribute(fn_def).is_some() { let function = sema.to_def(fn_def)?; runnable_fn(sema, function) } else { diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index b03f1c71f..e186b82b7 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -323,7 +323,7 @@ fn traverse( if let Some(token) = element.as_token().cloned().and_then(ast::String::cast) { if token.is_raw() { let expanded = element_to_highlight.as_token().unwrap().clone(); - if inject::ra_fixture(hl, &sema, token, expanded).is_some() { + if inject::ra_fixture(hl, sema, token, expanded).is_some() { continue; } } @@ -334,7 +334,7 @@ fn traverse( } if let Some((mut highlight, binding_hash)) = highlight::element( - &sema, + sema, krate, &mut bindings_shadow_count, syntactic_name_ref_highlighting, diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 84012227d..8c0e553c0 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -449,12 +449,12 @@ fn highlight_method_call( krate: Option, method_call: &ast::MethodCallExpr, ) -> Option { - let func = sema.resolve_method_call(&method_call)?; + let func = sema.resolve_method_call(method_call)?; let mut h = SymbolKind::Function.into(); h |= HlMod::Associated; - if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { + if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(method_call) { h |= HlMod::Unsafe; } if func.is_async(sema.db) { diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index 5327af845..478facfee 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs @@ -23,7 +23,7 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo let hl_ranges = highlight(db, file_id, None, false); let text = parse.tree().syntax().to_string(); let mut buf = String::new(); - buf.push_str(&STYLE); + buf.push_str(STYLE); buf.push_str("
");
     for r in &hl_ranges {
         let chunk = html_escape(&text[r.range]);
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs
index 4269d339e..883252c0e 100644
--- a/crates/ide/src/syntax_highlighting/inject.rs
+++ b/crates/ide/src/syntax_highlighting/inject.rs
@@ -23,7 +23,7 @@ pub(super) fn ra_fixture(
     literal: ast::String,
     expanded: SyntaxToken,
 ) -> Option<()> {
-    let active_parameter = ActiveParameter::at_token(&sema, expanded)?;
+    let active_parameter = ActiveParameter::at_token(sema, expanded)?;
     if !active_parameter.ident().map_or(false, |name| name.text().starts_with("ra_fixture")) {
         return None;
     }
@@ -124,7 +124,7 @@ pub(super) fn doc_comment(
     }
 
     for attr in attributes.by_key("doc").attrs() {
-        let InFile { file_id, value: src } = attrs_source_map.source_of(&attr);
+        let InFile { file_id, value: src } = attrs_source_map.source_of(attr);
         if file_id != node.file_id {
             continue;
         }
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs
index 81c4d95b1..5cba9d11d 100644
--- a/crates/ide/src/typing/on_enter.rs
+++ b/crates/ide/src/typing/on_enter.rs
@@ -88,12 +88,12 @@ fn on_enter_in_comment(
         if comment.text().ends_with(' ') {
             cov_mark::hit!(continues_end_of_line_comment_with_space);
             remove_trailing_whitespace = true;
-        } else if !followed_by_comment(&comment) {
+        } else if !followed_by_comment(comment) {
             return None;
         }
     }
 
-    let indent = node_indent(&file, comment.syntax())?;
+    let indent = node_indent(file, comment.syntax())?;
     let inserted = format!("\n{}{} $0", indent, prefix);
     let delete = if remove_trailing_whitespace {
         let trimmed_len = comment.text().trim_end().len() as u32;
@@ -188,7 +188,7 @@ mod tests {
     use crate::fixture;
 
     fn apply_on_enter(before: &str) -> Option {
-        let (analysis, position) = fixture::position(&before);
+        let (analysis, position) = fixture::position(before);
         let result = analysis.on_enter(position).unwrap()?;
 
         let mut actual = analysis.file_text(position.file_id).unwrap().to_string();
diff --git a/crates/ide_assists/src/handlers/convert_comment_block.rs b/crates/ide_assists/src/handlers/convert_comment_block.rs
index d202a85f9..749e8685b 100644
--- a/crates/ide_assists/src/handlers/convert_comment_block.rs
+++ b/crates/ide_assists/src/handlers/convert_comment_block.rs
@@ -88,7 +88,7 @@ fn line_to_block(acc: &mut Assists, comment: ast::Comment) -> Option<()> {
             // We pick a single indentation level for the whole block comment based on the
             // comment where the assist was invoked. This will be prepended to the
             // contents of each line comment when they're put into the block comment.
-            let indentation = IndentLevel::from_token(&comment.syntax());
+            let indentation = IndentLevel::from_token(comment.syntax());
 
             let block_comment_body =
                 comments.into_iter().map(|c| line_comment_text(indentation, c)).join("\n");
@@ -167,7 +167,7 @@ fn line_comment_text(indentation: IndentLevel, comm: ast::Comment) -> String {
     if contents.is_empty() {
         contents.to_owned()
     } else {
-        indentation.to_string() + &contents
+        indentation.to_string() + contents
     }
 }
 
diff --git a/crates/ide_assists/src/handlers/early_return.rs b/crates/ide_assists/src/handlers/early_return.rs
index 5eb6a57f0..ef4a7cb50 100644
--- a/crates/ide_assists/src/handlers/early_return.rs
+++ b/crates/ide_assists/src/handlers/early_return.rs
@@ -108,7 +108,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
         "Convert to guarded return",
         target,
         |edit| {
-            let if_indent_level = IndentLevel::from_node(&if_expr.syntax());
+            let if_indent_level = IndentLevel::from_node(if_expr.syntax());
             let new_block = match if_let_pat {
                 None => {
                     // If.
@@ -174,7 +174,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
                         .take_while(|i| *i != end_of_then),
                 );
                 replace_children(
-                    &parent_block.syntax(),
+                    parent_block.syntax(),
                     RangeInclusive::new(
                         if_expr.clone().syntax().clone().into(),
                         if_expr.syntax().clone().into(),
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index a2dba915c..63d28480a 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -76,7 +76,7 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext) -> Option
     let module = ctx.sema.scope(&insert_after).module()?;
 
     let vars_defined_in_body_and_outlive =
-        vars_defined_in_body_and_outlive(ctx, &body, &node.parent().as_ref().unwrap_or(&node));
+        vars_defined_in_body_and_outlive(ctx, &body, node.parent().as_ref().unwrap_or(&node));
     let ret_ty = body_return_ty(ctx, &body)?;
 
     // FIXME: we compute variables that outlive here just to check `never!` condition
@@ -808,7 +808,7 @@ trait HasTokenAtOffset {
 
 impl HasTokenAtOffset for SyntaxNode {
     fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset {
-        SyntaxNode::token_at_offset(&self, offset)
+        SyntaxNode::token_at_offset(self, offset)
     }
 }
 
@@ -854,7 +854,7 @@ fn vars_defined_in_body_and_outlive(
     body: &FunctionBody,
     parent: &SyntaxNode,
 ) -> Vec {
-    let vars_defined_in_body = vars_defined_in_body(&body, ctx);
+    let vars_defined_in_body = vars_defined_in_body(body, ctx);
     vars_defined_in_body
         .into_iter()
         .filter_map(|var| var_outlives_body(ctx, body, var, parent))
@@ -868,7 +868,7 @@ fn is_defined_before(
     src: &hir::InFile>,
 ) -> bool {
     src.file_id.original_file(ctx.db()) == ctx.frange.file_id
-        && !body.contains_node(&either_syntax(&src.value))
+        && !body.contains_node(either_syntax(&src.value))
 }
 
 fn either_syntax(value: &Either) -> &SyntaxNode {
diff --git a/crates/ide_assists/src/handlers/fill_match_arms.rs b/crates/ide_assists/src/handlers/fill_match_arms.rs
index 3d2cd739a..c8bc923f5 100644
--- a/crates/ide_assists/src/handlers/fill_match_arms.rs
+++ b/crates/ide_assists/src/handlers/fill_match_arms.rs
@@ -212,7 +212,7 @@ impl ExtendedEnum {
 }
 
 fn resolve_enum_def(sema: &Semantics, expr: &ast::Expr) -> Option {
-    sema.type_of_expr(&expr)?.autoderef(sema.db).find_map(|ty| match ty.as_adt() {
+    sema.type_of_expr(expr)?.autoderef(sema.db).find_map(|ty| match ty.as_adt() {
         Some(Adt::Enum(e)) => Some(ExtendedEnum::Enum(e)),
         _ => {
             if ty.is_bool() {
@@ -228,7 +228,7 @@ fn resolve_tuple_of_enum_def(
     sema: &Semantics,
     expr: &ast::Expr,
 ) -> Option> {
-    sema.type_of_expr(&expr)?
+    sema.type_of_expr(expr)?
         .tuple_fields(sema.db)
         .iter()
         .map(|ty| {
diff --git a/crates/ide_assists/src/handlers/fix_visibility.rs b/crates/ide_assists/src/handlers/fix_visibility.rs
index 89f7b2c2c..9b432e92f 100644
--- a/crates/ide_assists/src/handlers/fix_visibility.rs
+++ b/crates/ide_assists/src/handlers/fix_visibility.rs
@@ -43,7 +43,7 @@ fn add_vis_to_referenced_module_def(acc: &mut Assists, ctx: &AssistContext) -> O
         _ => return None,
     };
 
-    let current_module = ctx.sema.scope(&path.syntax()).module()?;
+    let current_module = ctx.sema.scope(path.syntax()).module()?;
     let target_module = def.module(ctx.db())?;
 
     let vis = target_module.visibility_of(ctx.db(), &def)?;
diff --git a/crates/ide_assists/src/handlers/generate_enum_is_method.rs b/crates/ide_assists/src/handlers/generate_enum_is_method.rs
index a9f71a703..24939f262 100644
--- a/crates/ide_assists/src/handlers/generate_enum_is_method.rs
+++ b/crates/ide_assists/src/handlers/generate_enum_is_method.rs
@@ -47,7 +47,7 @@ pub(crate) fn generate_enum_is_method(acc: &mut Assists, ctx: &AssistContext) ->
     let fn_name = format!("is_{}", &to_lower_snake_case(&variant_name.text()));
 
     // Return early if we've found an existing new fn
-    let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?;
+    let impl_def = find_struct_impl(ctx, &parent_enum, &fn_name)?;
 
     let target = variant.syntax().text_range();
     acc.add(
diff --git a/crates/ide_assists/src/handlers/generate_enum_projection_method.rs b/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
index e2f572ba3..986fb2315 100644
--- a/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
+++ b/crates/ide_assists/src/handlers/generate_enum_projection_method.rs
@@ -136,7 +136,7 @@ fn generate_enum_projection_method(
         format!("{}_{}", props.fn_name_prefix, &to_lower_snake_case(&variant_name.text()));
 
     // Return early if we've found an existing new fn
-    let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?;
+    let impl_def = find_struct_impl(ctx, &parent_enum, &fn_name)?;
 
     let target = variant.syntax().text_range();
     acc.add(AssistId(assist_id, AssistKind::Generate), assist_description, target, |builder| {
diff --git a/crates/ide_assists/src/handlers/generate_function.rs b/crates/ide_assists/src/handlers/generate_function.rs
index bc9fc524b..706c995ac 100644
--- a/crates/ide_assists/src/handlers/generate_function.rs
+++ b/crates/ide_assists/src/handlers/generate_function.rs
@@ -59,7 +59,7 @@ pub(crate) fn generate_function(acc: &mut Assists, ctx: &AssistContext) -> Optio
         None => None,
     };
 
-    let function_builder = FunctionBuilder::from_call(&ctx, &call, &path, target_module)?;
+    let function_builder = FunctionBuilder::from_call(ctx, &call, &path, target_module)?;
 
     let target = call.syntax().text_range();
     acc.add(
@@ -128,12 +128,12 @@ impl FunctionBuilder {
                 file = in_file;
                 target
             }
-            None => next_space_for_fn_after_call_site(&call)?,
+            None => next_space_for_fn_after_call_site(call)?,
         };
         let needs_pub = target_module.is_some();
         let target_module = target_module.or_else(|| ctx.sema.scope(target.syntax()).module())?;
-        let fn_name = fn_name(&path)?;
-        let (type_params, params) = fn_args(ctx, target_module, &call)?;
+        let fn_name = fn_name(path)?;
+        let (type_params, params) = fn_args(ctx, target_module, call)?;
 
         // should_render_snippet intends to express a rough level of confidence about
         // the correctness of the return type.
diff --git a/crates/ide_assists/src/handlers/generate_getter.rs b/crates/ide_assists/src/handlers/generate_getter.rs
index 09971226e..cc020c92c 100644
--- a/crates/ide_assists/src/handlers/generate_getter.rs
+++ b/crates/ide_assists/src/handlers/generate_getter.rs
@@ -75,7 +75,7 @@ pub(crate) fn generate_getter_impl(
     if mutable {
         format_to!(fn_name, "_mut");
     }
-    let impl_def = find_struct_impl(&ctx, &ast::Adt::Struct(strukt.clone()), fn_name.as_str())?;
+    let impl_def = find_struct_impl(ctx, &ast::Adt::Struct(strukt.clone()), fn_name.as_str())?;
 
     let (id, label) = if mutable {
         ("generate_getter_mut", "Generate a mut getter method")
diff --git a/crates/ide_assists/src/handlers/generate_new.rs b/crates/ide_assists/src/handlers/generate_new.rs
index 959a1f86c..b65e8387b 100644
--- a/crates/ide_assists/src/handlers/generate_new.rs
+++ b/crates/ide_assists/src/handlers/generate_new.rs
@@ -36,7 +36,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
     };
 
     // Return early if we've found an existing new fn
-    let impl_def = find_struct_impl(&ctx, &ast::Adt::Struct(strukt.clone()), "new")?;
+    let impl_def = find_struct_impl(ctx, &ast::Adt::Struct(strukt.clone()), "new")?;
 
     let target = strukt.syntax().text_range();
     acc.add(AssistId("generate_new", AssistKind::Generate), "Generate `new`", target, |builder| {
diff --git a/crates/ide_assists/src/handlers/generate_setter.rs b/crates/ide_assists/src/handlers/generate_setter.rs
index 288cf745d..5bdf6b3f4 100644
--- a/crates/ide_assists/src/handlers/generate_setter.rs
+++ b/crates/ide_assists/src/handlers/generate_setter.rs
@@ -39,7 +39,7 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
     // Return early if we've found an existing fn
     let fn_name = to_lower_snake_case(&field_name.to_string());
     let impl_def = find_struct_impl(
-        &ctx,
+        ctx,
         &ast::Adt::Struct(strukt.clone()),
         format!("set_{}", fn_name).as_str(),
     )?;
diff --git a/crates/ide_assists/src/handlers/remove_dbg.rs b/crates/ide_assists/src/handlers/remove_dbg.rs
index c8226550f..b20fe992d 100644
--- a/crates/ide_assists/src/handlers/remove_dbg.rs
+++ b/crates/ide_assists/src/handlers/remove_dbg.rs
@@ -85,7 +85,7 @@ fn whitespace_start(it: SyntaxElement) -> Option {
 }
 
 fn adjusted_macro_contents(macro_call: &ast::MacroCall) -> Option {
-    let contents = get_valid_macrocall_contents(¯o_call, "dbg")?;
+    let contents = get_valid_macrocall_contents(macro_call, "dbg")?;
     let macro_text_with_brackets = macro_call.token_tree()?.syntax().text();
     let macro_text_in_brackets = macro_text_with_brackets.slice(TextRange::new(
         TextSize::of('('),
diff --git a/crates/ide_assists/src/handlers/reorder_fields.rs b/crates/ide_assists/src/handlers/reorder_fields.rs
index 933acead1..f6a926042 100644
--- a/crates/ide_assists/src/handlers/reorder_fields.rs
+++ b/crates/ide_assists/src/handlers/reorder_fields.rs
@@ -28,7 +28,7 @@ pub(crate) fn reorder_fields(acc: &mut Assists, ctx: &AssistContext) -> Option<(
         .or_else(|| ctx.find_node_at_offset::().map(Either::Right))?;
 
     let path = record.as_ref().either(|it| it.path(), |it| it.path())?;
-    let ranks = compute_fields_ranks(&path, &ctx)?;
+    let ranks = compute_fields_ranks(&path, ctx)?;
     let get_rank_of_field =
         |of: Option<_>| *ranks.get(&of.unwrap_or_default()).unwrap_or(&usize::MAX);
 
diff --git a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
index 10d9cec31..f9474c9f5 100644
--- a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
+++ b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
@@ -112,7 +112,7 @@ fn add_assist(
             let insert_pos = adt.syntax().text_range().end();
             let impl_def_with_items =
                 impl_def_from_trait(&ctx.sema, &annotated_name, trait_, trait_path);
-            update_attribute(builder, &input, &trait_name, &attr);
+            update_attribute(builder, input, &trait_name, attr);
             let trait_path = format!("{}", trait_path);
             match (ctx.config.snippet_cap, impl_def_with_items) {
                 (None, _) => {
diff --git a/crates/ide_assists/src/handlers/replace_if_let_with_match.rs b/crates/ide_assists/src/handlers/replace_if_let_with_match.rs
index aee880625..9404aa26d 100644
--- a/crates/ide_assists/src/handlers/replace_if_let_with_match.rs
+++ b/crates/ide_assists/src/handlers/replace_if_let_with_match.rs
@@ -169,7 +169,7 @@ pub(crate) fn replace_match_with_if_let(acc: &mut Assists, ctx: &AssistContext)
 }
 
 fn is_pat_wildcard_or_sad(sema: &hir::Semantics, pat: &ast::Pat) -> bool {
-    sema.type_of_pat(&pat)
+    sema.type_of_pat(pat)
         .and_then(|ty| TryEnum::from_ty(sema, &ty))
         .map(|it| it.sad_pattern().syntax().text() == pat.syntax().text())
         .unwrap_or_else(|| matches!(pat, ast::Pat::WildcardPat(_)))
diff --git a/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs b/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs
index 2f1da82c7..140e27356 100644
--- a/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs
+++ b/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs
@@ -123,7 +123,7 @@ impl TailReturnCollector {
     fn handle_exprs(&mut self, expr: &Expr, collect_break: bool) {
         match expr {
             Expr::BlockExpr(block_expr) => {
-                self.collect_jump_exprs(&block_expr, collect_break);
+                self.collect_jump_exprs(block_expr, collect_break);
             }
             Expr::ReturnExpr(ret_expr) => {
                 if let Some(ret_expr_arg) = &ret_expr.expr() {
diff --git a/crates/ide_assists/src/tests.rs b/crates/ide_assists/src/tests.rs
index 2b7c2d581..bdf9cb71c 100644
--- a/crates/ide_assists/src/tests.rs
+++ b/crates/ide_assists/src/tests.rs
@@ -74,7 +74,7 @@ pub(crate) fn check_assist_unresolved(assist: Handler, ra_fixture: &str) {
 #[track_caller]
 fn check_doc_test(assist_id: &str, before: &str, after: &str) {
     let after = trim_indent(after);
-    let (db, file_id, selection) = RootDatabase::with_range_or_offset(&before);
+    let (db, file_id, selection) = RootDatabase::with_range_or_offset(before);
     let before = db.file_text(file_id).to_string();
     let frange = FileRange { file_id, range: selection.into() };
 
diff --git a/crates/ide_assists/src/utils.rs b/crates/ide_assists/src/utils.rs
index 30128a24a..068df005b 100644
--- a/crates/ide_assists/src/utils.rs
+++ b/crates/ide_assists/src/utils.rs
@@ -492,7 +492,7 @@ pub(crate) fn add_method_to_adt(
     let start_offset = impl_def
         .and_then(|impl_def| find_impl_block_end(impl_def, &mut buf))
         .unwrap_or_else(|| {
-            buf = generate_impl_text(&adt, &buf);
+            buf = generate_impl_text(adt, &buf);
             adt.syntax().text_range().end()
         });
 
diff --git a/crates/ide_assists/src/utils/suggest_name.rs b/crates/ide_assists/src/utils/suggest_name.rs
index b3aabeab3..cb8bc8b2f 100644
--- a/crates/ide_assists/src/utils/suggest_name.rs
+++ b/crates/ide_assists/src/utils/suggest_name.rs
@@ -187,7 +187,7 @@ fn from_method_call(expr: &ast::Expr) -> Option {
         }
     }
 
-    normalize(&name)
+    normalize(name)
 }
 
 fn from_param(expr: &ast::Expr, sema: &Semantics<'_, RootDatabase>) -> Option {
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs
index 8ad57a069..9552875c1 100644
--- a/crates/ide_completion/src/completions/dot.rs
+++ b/crates/ide_completion/src/completions/dot.rs
@@ -13,7 +13,7 @@ pub(crate) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
         _ => return complete_undotted_self(acc, ctx),
     };
 
-    let receiver_ty = match ctx.sema.type_of_expr(&dot_receiver) {
+    let receiver_ty = match ctx.sema.type_of_expr(dot_receiver) {
         Some(ty) => ty,
         _ => return,
     };
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs
index 86eb21714..9f98b21be 100644
--- a/crates/ide_completion/src/completions/postfix.rs
+++ b/crates/ide_completion/src/completions/postfix.rs
@@ -34,7 +34,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
 
     let receiver_text = get_receiver_text(dot_receiver, receiver_is_ambiguous_float_literal);
 
-    let receiver_ty = match ctx.sema.type_of_expr(&dot_receiver) {
+    let receiver_ty = match ctx.sema.type_of_expr(dot_receiver) {
         Some(it) => it,
         None => return,
     };
@@ -50,7 +50,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 postfix_snippet(
                     ctx,
                     cap,
-                    &dot_receiver,
+                    dot_receiver,
                     "ifl",
                     "if let Ok {}",
                     &format!("if let Ok($1) = {} {{\n    $0\n}}", receiver_text),
@@ -60,7 +60,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 postfix_snippet(
                     ctx,
                     cap,
-                    &dot_receiver,
+                    dot_receiver,
                     "while",
                     "while let Ok {}",
                     &format!("while let Ok($1) = {} {{\n    $0\n}}", receiver_text),
@@ -71,7 +71,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 postfix_snippet(
                     ctx,
                     cap,
-                    &dot_receiver,
+                    dot_receiver,
                     "ifl",
                     "if let Some {}",
                     &format!("if let Some($1) = {} {{\n    $0\n}}", receiver_text),
@@ -81,7 +81,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 postfix_snippet(
                     ctx,
                     cap,
-                    &dot_receiver,
+                    dot_receiver,
                     "while",
                     "while let Some {}",
                     &format!("while let Some($1) = {} {{\n    $0\n}}", receiver_text),
@@ -93,7 +93,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         postfix_snippet(
             ctx,
             cap,
-            &dot_receiver,
+            dot_receiver,
             "if",
             "if expr {}",
             &format!("if {} {{\n    $0\n}}", receiver_text),
@@ -102,22 +102,22 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         postfix_snippet(
             ctx,
             cap,
-            &dot_receiver,
+            dot_receiver,
             "while",
             "while expr {}",
             &format!("while {} {{\n    $0\n}}", receiver_text),
         )
         .add_to(acc);
-        postfix_snippet(ctx, cap, &dot_receiver, "not", "!expr", &format!("!{}", receiver_text))
+        postfix_snippet(ctx, cap, dot_receiver, "not", "!expr", &format!("!{}", receiver_text))
             .add_to(acc);
     }
 
-    postfix_snippet(ctx, cap, &dot_receiver, "ref", "&expr", &format!("&{}", receiver_text))
+    postfix_snippet(ctx, cap, dot_receiver, "ref", "&expr", &format!("&{}", receiver_text))
         .add_to(acc);
     postfix_snippet(
         ctx,
         cap,
-        &dot_receiver,
+        dot_receiver,
         "refm",
         "&mut expr",
         &format!("&mut {}", receiver_text),
diff --git a/crates/ide_completion/src/completions/postfix/format_like.rs b/crates/ide_completion/src/completions/postfix/format_like.rs
index 9ebe1dcc0..f619f8b52 100644
--- a/crates/ide_completion/src/completions/postfix/format_like.rs
+++ b/crates/ide_completion/src/completions/postfix/format_like.rs
@@ -53,7 +53,7 @@ pub(crate) fn add_format_like_completions(
         for (label, macro_name) in KINDS {
             let snippet = parser.into_suggestion(macro_name);
 
-            postfix_snippet(ctx, cap, &dot_receiver, label, macro_name, &snippet).add_to(acc);
+            postfix_snippet(ctx, cap, dot_receiver, label, macro_name, &snippet).add_to(acc);
         }
     }
 }
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 58d4dd9ee..6083537b7 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -15,7 +15,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
         None => return,
     };
 
-    let resolution = match ctx.sema.resolve_path(&path) {
+    let resolution = match ctx.sema.resolve_path(path) {
         Some(res) => res,
         None => return,
     };
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index 2c2a4aa6b..e4abe2742 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -467,7 +467,7 @@ impl<'a> CompletionContext<'a> {
         self.expected_type = expected_type;
         self.expected_name = expected_name;
 
-        let name_like = match find_node_at_offset(&&file_with_fake_ident, offset) {
+        let name_like = match find_node_at_offset(&file_with_fake_ident, offset) {
             Some(it) => it,
             None => return,
         };
diff --git a/crates/ide_completion/src/patterns.rs b/crates/ide_completion/src/patterns.rs
index 81d7a1a1d..c567ac63d 100644
--- a/crates/ide_completion/src/patterns.rs
+++ b/crates/ide_completion/src/patterns.rs
@@ -115,12 +115,12 @@ pub(crate) fn determine_location(
 ) -> Option {
     let node = match name_like {
         ast::NameLike::NameRef(name_ref) => {
-            if ast::RecordExprField::for_field_name(&name_ref).is_some() {
+            if ast::RecordExprField::for_field_name(name_ref).is_some() {
                 return sema
                     .find_node_at_offset_with_macros(original_file, offset)
                     .map(ImmediateLocation::RecordExpr);
             }
-            if ast::RecordPatField::for_field_name_ref(&name_ref).is_some() {
+            if ast::RecordPatField::for_field_name_ref(name_ref).is_some() {
                 return sema
                     .find_node_at_offset_with_macros(original_file, offset)
                     .map(ImmediateLocation::RecordPat);
@@ -128,7 +128,7 @@ pub(crate) fn determine_location(
             maximize_name_ref(name_ref)
         }
         ast::NameLike::Name(name) => {
-            if ast::RecordPatField::for_field_name(&name).is_some() {
+            if ast::RecordPatField::for_field_name(name).is_some() {
                 return sema
                     .find_node_at_offset_with_macros(original_file, offset)
                     .map(ImmediateLocation::RecordPat);
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index d3db55c35..a55081631 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -86,7 +86,7 @@ impl<'a> RenderContext<'a> {
     }
 
     fn db(&self) -> &'a RootDatabase {
-        &self.completion.db
+        self.completion.db
     }
 
     fn source_range(&self) -> TextRange {
diff --git a/crates/ide_completion/src/render/pattern.rs b/crates/ide_completion/src/render/pattern.rs
index b4e80f424..3717a0409 100644
--- a/crates/ide_completion/src/render/pattern.rs
+++ b/crates/ide_completion/src/render/pattern.rs
@@ -75,10 +75,10 @@ fn render_pat(
 ) -> Option {
     let mut pat = match kind {
         StructKind::Tuple if ctx.snippet_cap().is_some() => {
-            render_tuple_as_pat(&fields, &name, fields_omitted)
+            render_tuple_as_pat(fields, name, fields_omitted)
         }
         StructKind::Record => {
-            render_record_as_pat(ctx.db(), ctx.snippet_cap(), &fields, &name, fields_omitted)
+            render_record_as_pat(ctx.db(), ctx.snippet_cap(), fields, name, fields_omitted)
         }
         _ => return None,
     };
@@ -86,7 +86,7 @@ fn render_pat(
     if ctx.completion.is_param {
         pat.push(':');
         pat.push(' ');
-        pat.push_str(&name);
+        pat.push_str(name);
     }
     if ctx.snippet_cap().is_some() {
         pat.push_str("$0");
diff --git a/crates/ide_db/src/call_info.rs b/crates/ide_db/src/call_info.rs
index 933bcad55..4795e2565 100644
--- a/crates/ide_db/src/call_info.rs
+++ b/crates/ide_db/src/call_info.rs
@@ -162,7 +162,7 @@ impl ActiveParameter {
     }
 
     pub fn at_token(sema: &Semantics, token: SyntaxToken) -> Option {
-        let (signature, active_parameter) = call_info_impl(&sema, token)?;
+        let (signature, active_parameter) = call_info_impl(sema, token)?;
 
         let idx = active_parameter?;
         let mut params = signature.params(sema.db);
diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs
index ae52dd8bb..9634d872e 100644
--- a/crates/ide_db/src/helpers/import_assets.rs
+++ b/crates/ide_db/src/helpers/import_assets.rs
@@ -323,7 +323,7 @@ fn import_for_item(
     }
 
     let segment_import =
-        find_import_for_segment(db, original_item_candidate, &unresolved_first_segment)?;
+        find_import_for_segment(db, original_item_candidate, unresolved_first_segment)?;
     let trait_item_to_import = item_as_assoc(db, original_item)
         .and_then(|assoc| assoc.containing_trait(db))
         .map(|trait_| ItemInNs::from(ModuleDef::from(trait_)));
@@ -383,7 +383,7 @@ fn find_import_for_segment(
         original_item
     } else {
         let matching_module =
-            module_with_segment_name(db, &unresolved_first_segment, original_item)?;
+            module_with_segment_name(db, unresolved_first_segment, original_item)?;
         ItemInNs::from(ModuleDef::from(matching_module))
     })
 }
diff --git a/crates/ide_db/src/helpers/merge_imports.rs b/crates/ide_db/src/helpers/merge_imports.rs
index 0dbabb44f..ec29476a4 100644
--- a/crates/ide_db/src/helpers/merge_imports.rs
+++ b/crates/ide_db/src/helpers/merge_imports.rs
@@ -124,7 +124,7 @@ fn recursive_merge(
                             .map(|tree_list| tree_list.use_trees().any(tree_is_self))
                             .unwrap_or(false)
                     };
-                    match (tree_contains_self(&lhs_t), tree_contains_self(&rhs_t)) {
+                    match (tree_contains_self(lhs_t), tree_contains_self(&rhs_t)) {
                         (true, false) => continue,
                         (false, true) => {
                             *lhs_t = rhs_t;
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index 8152630f5..8bfbba4bb 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -409,7 +409,7 @@ impl<'a> FindUsages<'a> {
                     if let Some(ast::NameLike::NameRef(name_ref)) =
                         sema.find_node_at_offset_with_descend(&tree, offset)
                     {
-                        if self.found_self_ty_name_ref(&self_ty, &name_ref, sink) {
+                        if self.found_self_ty_name_ref(self_ty, &name_ref, sink) {
                             return;
                         }
                     }
@@ -424,7 +424,7 @@ impl<'a> FindUsages<'a> {
         name_ref: &ast::NameRef,
         sink: &mut dyn FnMut(FileId, FileReference) -> bool,
     ) -> bool {
-        match NameRefClass::classify(self.sema, &name_ref) {
+        match NameRefClass::classify(self.sema, name_ref) {
             Some(NameRefClass::Definition(Definition::SelfType(impl_)))
                 if impl_.self_ty(self.sema.db) == *self_ty =>
             {
@@ -464,13 +464,13 @@ impl<'a> FindUsages<'a> {
         name_ref: &ast::NameRef,
         sink: &mut dyn FnMut(FileId, FileReference) -> bool,
     ) -> bool {
-        match NameRefClass::classify(self.sema, &name_ref) {
+        match NameRefClass::classify(self.sema, name_ref) {
             Some(NameRefClass::Definition(def)) if def == self.def => {
                 let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
                 let reference = FileReference {
                     range,
                     name: ast::NameLike::NameRef(name_ref.clone()),
-                    access: reference_access(&def, &name_ref),
+                    access: reference_access(&def, name_ref),
                 };
                 sink(file_id, reference)
             }
@@ -480,7 +480,7 @@ impl<'a> FindUsages<'a> {
                     let reference = FileReference {
                         range,
                         name: ast::NameLike::NameRef(name_ref.clone()),
-                        access: reference_access(&def, &name_ref),
+                        access: reference_access(&def, name_ref),
                     };
                     sink(file_id, reference)
                 } else {
@@ -491,10 +491,10 @@ impl<'a> FindUsages<'a> {
                 let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
                 let access = match self.def {
                     Definition::Field(_) if field == self.def => {
-                        reference_access(&field, &name_ref)
+                        reference_access(&field, name_ref)
                     }
                     Definition::Local(l) if local == l => {
-                        reference_access(&Definition::Local(local), &name_ref)
+                        reference_access(&Definition::Local(local), name_ref)
                     }
                     _ => return false,
                 };
diff --git a/crates/ide_ssr/src/matching.rs b/crates/ide_ssr/src/matching.rs
index b3072fb9f..fb92a0ccc 100644
--- a/crates/ide_ssr/src/matching.rs
+++ b/crates/ide_ssr/src/matching.rs
@@ -382,7 +382,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
         code: Option,
     ) -> Result<(), MatchFailed> {
         match (pattern, code) {
-            (Some(p), Some(c)) => self.attempt_match_node(phase, &p.syntax(), &c.syntax()),
+            (Some(p), Some(c)) => self.attempt_match_node(phase, p.syntax(), c.syntax()),
             (None, None) => Ok(()),
             (Some(p), None) => fail_match!("Pattern `{}` had nothing to match", p.syntax().text()),
             (None, Some(c)) => {
@@ -478,7 +478,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
                                 if Some(first_token.text()) == next_pattern_token.as_deref() {
                                     if let Some(SyntaxElement::Node(p)) = pattern.next() {
                                         // We have a subtree that starts with the next token in our pattern.
-                                        self.attempt_match_token_tree(phase, &p, &n)?;
+                                        self.attempt_match_token_tree(phase, &p, n)?;
                                         break;
                                     }
                                 }
@@ -609,7 +609,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
         expr: &ast::Expr,
     ) -> Result {
         use hir::HirDisplay;
-        let code_type = self.sema.type_of_expr(&expr).ok_or_else(|| {
+        let code_type = self.sema.type_of_expr(expr).ok_or_else(|| {
             match_error!("Failed to get receiver type for `{}`", expr.syntax().text())
         })?;
         // Temporary needed to make the borrow checker happy.
diff --git a/crates/ide_ssr/src/replacing.rs b/crates/ide_ssr/src/replacing.rs
index c9ccc1961..9265af7c1 100644
--- a/crates/ide_ssr/src/replacing.rs
+++ b/crates/ide_ssr/src/replacing.rs
@@ -84,16 +84,16 @@ impl ReplacementRenderer<'_> {
     fn render_node_or_token(&mut self, node_or_token: &SyntaxElement) {
         match node_or_token {
             SyntaxElement::Token(token) => {
-                self.render_token(&token);
+                self.render_token(token);
             }
             SyntaxElement::Node(child_node) => {
-                self.render_node(&child_node);
+                self.render_node(child_node);
             }
         }
     }
 
     fn render_node(&mut self, node: &SyntaxNode) {
-        if let Some(mod_path) = self.match_info.rendered_template_paths.get(&node) {
+        if let Some(mod_path) = self.match_info.rendered_template_paths.get(node) {
             self.out.push_str(&mod_path.to_string());
             // Emit everything except for the segment's name-ref, since we already effectively
             // emitted that as part of `mod_path`.
@@ -107,12 +107,12 @@ impl ReplacementRenderer<'_> {
                 }
             }
         } else {
-            self.render_node_children(&node);
+            self.render_node_children(node);
         }
     }
 
     fn render_token(&mut self, token: &SyntaxToken) {
-        if let Some(placeholder) = self.rule.get_placeholder(&token) {
+        if let Some(placeholder) = self.rule.get_placeholder(token) {
             if let Some(placeholder_value) =
                 self.match_info.placeholder_values.get(&placeholder.ident)
             {
diff --git a/crates/ide_ssr/src/resolving.rs b/crates/ide_ssr/src/resolving.rs
index 541da4122..a66a7a4a8 100644
--- a/crates/ide_ssr/src/resolving.rs
+++ b/crates/ide_ssr/src/resolving.rs
@@ -211,7 +211,7 @@ impl<'db> ResolutionScope<'db> {
         // First try resolving the whole path. This will work for things like
         // `std::collections::HashMap`, but will fail for things like
         // `std::collections::HashMap::new`.
-        if let Some(resolution) = self.scope.speculative_resolve(&path) {
+        if let Some(resolution) = self.scope.speculative_resolve(path) {
             return Some(resolution);
         }
         // Resolution failed, try resolving the qualifier (e.g. `std::collections::HashMap` and if
diff --git a/crates/ide_ssr/src/search.rs b/crates/ide_ssr/src/search.rs
index 28cef742c..f2056919e 100644
--- a/crates/ide_ssr/src/search.rs
+++ b/crates/ide_ssr/src/search.rs
@@ -173,7 +173,7 @@ impl<'db> MatchFinder<'db> {
         if !is_search_permitted(code) {
             return;
         }
-        self.try_add_match(rule, &code, restrict_range, matches_out);
+        self.try_add_match(rule, code, restrict_range, matches_out);
         // If we've got a macro call, we already tried matching it pre-expansion, which is the only
         // way to match the whole macro, now try expanding it and matching the expansion.
         if let Some(macro_call) = ast::MacroCall::cast(code.clone()) {
diff --git a/crates/ide_ssr/src/tests.rs b/crates/ide_ssr/src/tests.rs
index 1d8565dc0..5dd0d600f 100644
--- a/crates/ide_ssr/src/tests.rs
+++ b/crates/ide_ssr/src/tests.rs
@@ -129,7 +129,7 @@ fn assert_matches(pattern: &str, code: &str, expected: &[&str]) {
     let matched_strings: Vec =
         match_finder.matches().flattened().matches.iter().map(|m| m.matched_text()).collect();
     if matched_strings != expected && !expected.is_empty() {
-        print_match_debug_info(&match_finder, position.file_id, &expected[0]);
+        print_match_debug_info(&match_finder, position.file_id, expected[0]);
     }
     assert_eq!(matched_strings, expected);
 }
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index c982eb58f..c0e1705c0 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -121,7 +121,7 @@ impl Match {
 
 /// Matching errors are added to the `Match`.
 pub(super) fn match_(pattern: &MetaTemplate, input: &tt::Subtree) -> Match {
-    let mut res = match_loop(pattern, &input);
+    let mut res = match_loop(pattern, input);
     res.bound_count = count(res.bindings.bindings());
     return res;
 
@@ -202,7 +202,7 @@ impl BindingsBuilder {
     }
 
     fn push_nested(&mut self, parent: &mut BindingsIdx, child: &BindingsIdx) {
-        let BindingsIdx(idx, nidx) = self.copy(&child);
+        let BindingsIdx(idx, nidx) = self.copy(child);
         self.nodes[parent.0].push(LinkNode::Node(Rc::new(BindingKind::Nested(idx, nidx))));
     }
 
@@ -221,7 +221,7 @@ impl BindingsBuilder {
 
     fn build_inner(&self, bindings: &mut Bindings, link_nodes: &[LinkNode>]) {
         let mut nodes = Vec::new();
-        self.collect_nodes(&link_nodes, &mut nodes);
+        self.collect_nodes(link_nodes, &mut nodes);
 
         for cmd in nodes {
             match &**cmd {
@@ -282,7 +282,7 @@ impl BindingsBuilder {
 
         nested_refs.into_iter().for_each(|iter| {
             let mut child_bindings = Bindings::default();
-            self.build_inner(&mut child_bindings, &iter);
+            self.build_inner(&mut child_bindings, iter);
             nested.push(child_bindings)
         })
     }
@@ -417,7 +417,7 @@ fn match_loop_inner<'t>(
                     let sep_len = item.sep.as_ref().map_or(0, Separator::tt_count);
                     if item.sep.is_some() && sep_idx != sep_len {
                         let sep = item.sep.as_ref().unwrap();
-                        if src.clone().expect_separator(&sep, sep_idx) {
+                        if src.clone().expect_separator(sep, sep_idx) {
                             item.dot.next();
                             item.sep_parsed = Some(sep_idx + 1);
                             try_push!(next_items, item);
@@ -487,7 +487,7 @@ fn match_loop_inner<'t>(
                                 item.meta_result = Some((fork, match_res));
                                 try_push!(bb_items, item);
                             } else {
-                                bindings_builder.push_optional(&mut item.bindings, &name);
+                                bindings_builder.push_optional(&mut item.bindings, name);
                                 item.dot.next();
                                 cur_items.push(item);
                             }
@@ -495,7 +495,7 @@ fn match_loop_inner<'t>(
                         Some(err) => {
                             res.add_err(err);
                             if let Some(fragment) = match_res.value {
-                                bindings_builder.push_fragment(&mut item.bindings, &name, fragment);
+                                bindings_builder.push_fragment(&mut item.bindings, name, fragment);
                             }
                             item.is_error = true;
                             error_items.push(item);
@@ -504,7 +504,7 @@ fn match_loop_inner<'t>(
                 }
             }
             OpDelimited::Op(Op::Leaf(leaf)) => {
-                if let Err(err) = match_leaf(&leaf, &mut src.clone()) {
+                if let Err(err) = match_leaf(leaf, &mut src.clone()) {
                     res.add_err(err);
                     item.is_error = true;
                 } else {
@@ -640,10 +640,10 @@ fn match_loop(pattern: &MetaTemplate, src: &tt::Subtree) -> Match {
                 let (iter, match_res) = item.meta_result.take().unwrap();
                 match match_res.value {
                     Some(fragment) => {
-                        bindings_builder.push_fragment(&mut item.bindings, &name, fragment);
+                        bindings_builder.push_fragment(&mut item.bindings, name, fragment);
                     }
                     None if match_res.err.is_none() => {
-                        bindings_builder.push_optional(&mut item.bindings, &name);
+                        bindings_builder.push_optional(&mut item.bindings, name);
                     }
                     _ => {}
                 }
diff --git a/crates/mbe/src/expander/transcriber.rs b/crates/mbe/src/expander/transcriber.rs
index dd7fa97d7..9a9c1a467 100644
--- a/crates/mbe/src/expander/transcriber.rs
+++ b/crates/mbe/src/expander/transcriber.rs
@@ -55,7 +55,7 @@ pub(super) fn transcribe(
     template: &MetaTemplate,
     bindings: &Bindings,
 ) -> ExpandResult {
-    let mut ctx = ExpandCtx { bindings: &bindings, nesting: Vec::new() };
+    let mut ctx = ExpandCtx { bindings: bindings, nesting: Vec::new() };
     let mut arena: Vec = Vec::new();
     expand_subtree(&mut ctx, template, None, &mut arena)
 }
@@ -91,12 +91,12 @@ fn expand_subtree(
             Op::Leaf(tt) => arena.push(tt.clone().into()),
             Op::Subtree { tokens, delimiter } => {
                 let ExpandResult { value: tt, err: e } =
-                    expand_subtree(ctx, &tokens, *delimiter, arena);
+                    expand_subtree(ctx, tokens, *delimiter, arena);
                 err = err.or(e);
                 arena.push(tt.into());
             }
             Op::Var { name, id, .. } => {
-                let ExpandResult { value: fragment, err: e } = expand_var(ctx, &name, *id);
+                let ExpandResult { value: fragment, err: e } = expand_var(ctx, name, *id);
                 err = err.or(e);
                 push_fragment(arena, fragment);
             }
@@ -141,7 +141,7 @@ fn expand_var(ctx: &mut ExpandCtx, v: &SmolStr, id: tt::TokenId) -> ExpandResult
         .into();
         ExpandResult::ok(Fragment::Tokens(tt))
     } else {
-        ctx.bindings.get(&v, &mut ctx.nesting).map_or_else(
+        ctx.bindings.get(v, &mut ctx.nesting).map_or_else(
             |e| ExpandResult { value: Fragment::Tokens(tt::TokenTree::empty()), err: Some(e) },
             |b| ExpandResult::ok(b.clone()),
         )
diff --git a/crates/mbe/src/lib.rs b/crates/mbe/src/lib.rs
index 380a50744..8c8528aaf 100644
--- a/crates/mbe/src/lib.rs
+++ b/crates/mbe/src/lib.rs
@@ -280,8 +280,8 @@ impl Rule {
             .expect_subtree()
             .map_err(|()| ParseError::Expected("expected subtree".to_string()))?;
 
-        let lhs = MetaTemplate(parse_pattern(&lhs)?);
-        let rhs = MetaTemplate(parse_template(&rhs)?);
+        let lhs = MetaTemplate(parse_pattern(lhs)?);
+        let rhs = MetaTemplate(parse_template(rhs)?);
 
         Ok(crate::Rule { lhs, rhs })
     }
@@ -290,7 +290,7 @@ impl Rule {
 fn validate(pattern: &MetaTemplate) -> Result<(), ParseError> {
     for op in pattern.iter() {
         match op {
-            Op::Subtree { tokens, .. } => validate(&tokens)?,
+            Op::Subtree { tokens, .. } => validate(tokens)?,
             Op::Repeat { tokens: subtree, separator, .. } => {
                 // Checks that no repetition which could match an empty token
                 // https://github.com/rust-lang/rust/blob/a58b1ed44f5e06976de2bdc4d7dc81c36a96934f/src/librustc_expand/mbe/macro_rules.rs#L558
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs
index 04c0d3e75..deed884d2 100644
--- a/crates/mbe/src/parser.rs
+++ b/crates/mbe/src/parser.rs
@@ -42,7 +42,7 @@ impl<'a> OpDelimitedIter<'a> {
     }
 
     pub(crate) fn reset(&self) -> Self {
-        Self { inner: &self.inner, idx: 0, delimited: self.delimited }
+        Self { inner: self.inner, idx: 0, delimited: self.delimited }
     }
 }
 
@@ -126,11 +126,11 @@ impl Separator {
 }
 
 pub(crate) fn parse_template(template: &tt::Subtree) -> Result, ParseError> {
-    parse_inner(&template, Mode::Template).into_iter().collect()
+    parse_inner(template, Mode::Template).into_iter().collect()
 }
 
 pub(crate) fn parse_pattern(pattern: &tt::Subtree) -> Result, ParseError> {
-    parse_inner(&pattern, Mode::Pattern).into_iter().collect()
+    parse_inner(pattern, Mode::Pattern).into_iter().collect()
 }
 
 #[derive(Clone, Copy)]
@@ -140,7 +140,7 @@ enum Mode {
 }
 
 fn parse_inner(tt: &tt::Subtree, mode: Mode) -> Vec> {
-    let mut src = TtIter::new(&tt);
+    let mut src = TtIter::new(tt);
     std::iter::from_fn(move || {
         let first = src.next()?;
         Some(next_op(first, &mut src, mode))
@@ -171,7 +171,7 @@ fn next_op<'a>(first: &tt::TokenTree, src: &mut TtIter<'a>, mode: Mode) -> Resul
             match second {
                 tt::TokenTree::Subtree(subtree) => {
                     let (separator, kind) = parse_repeat(src)?;
-                    let tokens = parse_inner(&subtree, mode)
+                    let tokens = parse_inner(subtree, mode)
                         .into_iter()
                         .collect::, ParseError>>()?;
                     Op::Repeat { tokens: MetaTemplate(tokens), separator, kind }
@@ -191,7 +191,7 @@ fn next_op<'a>(first: &tt::TokenTree, src: &mut TtIter<'a>, mode: Mode) -> Resul
                         Op::Var { name, kind, id }
                     }
                     tt::Leaf::Literal(lit) => {
-                        if is_boolean_literal(&lit) {
+                        if is_boolean_literal(lit) {
                             let name = lit.text.clone();
                             let kind = eat_fragment_kind(src, mode)?;
                             let id = lit.id;
@@ -206,7 +206,7 @@ fn next_op<'a>(first: &tt::TokenTree, src: &mut TtIter<'a>, mode: Mode) -> Resul
         tt::TokenTree::Leaf(tt) => Op::Leaf(tt.clone()),
         tt::TokenTree::Subtree(subtree) => {
             let tokens =
-                parse_inner(&subtree, mode).into_iter().collect::, ParseError>>()?;
+                parse_inner(subtree, mode).into_iter().collect::, ParseError>>()?;
             Op::Subtree { tokens: MetaTemplate(tokens), delimiter: subtree.delimiter }
         }
     };
diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs
index bde370fdb..ee80807ad 100644
--- a/crates/mbe/src/subtree_source.rs
+++ b/crates/mbe/src/subtree_source.rs
@@ -22,7 +22,7 @@ impl<'a> SubtreeTokenSource {
     #[cfg(test)]
     pub(crate) fn text(&self) -> SmolStr {
         match self.cached.get(self.curr.1) {
-            Some(ref tt) => tt.text.clone(),
+            Some(tt) => tt.text.clone(),
             _ => SmolStr::new(""),
         }
     }
@@ -59,7 +59,7 @@ impl<'a> SubtreeTokenSource {
 
             current = match tt {
                 Some(tt::buffer::TokenTreeRef::Leaf(leaf, _)) => {
-                    cached.push(convert_leaf(&leaf));
+                    cached.push(convert_leaf(leaf));
                     cursor.bump()
                 }
                 Some(tt::buffer::TokenTreeRef::Subtree(subtree, _)) => {
@@ -114,7 +114,7 @@ impl<'a> TokenSource for SubtreeTokenSource {
     /// Is the current token a specified keyword?
     fn is_keyword(&self, kw: &str) -> bool {
         match self.cached.get(self.curr.1) {
-            Some(ref t) => t.text == *kw,
+            Some(t) => t.text == *kw,
             _ => false,
         }
     }
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index 978c75747..cdc22425d 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -633,7 +633,7 @@ impl<'a> TreeSink for TtTreeSink<'a> {
                     }
                 }
             };
-            self.buf += &text;
+            self.buf += text;
             self.text_pos += TextSize::of(text);
         }
 
diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs
index 75c88687c..c788e427e 100644
--- a/crates/mbe/src/tests/expand.rs
+++ b/crates/mbe/src/tests/expand.rs
@@ -490,7 +490,7 @@ MACRO_ITEMS@0..40
 
 fn to_subtree(tt: &tt::TokenTree) -> &tt::Subtree {
     if let tt::TokenTree::Subtree(subtree) = tt {
-        return &subtree;
+        return subtree;
     }
     unreachable!("It is not a subtree");
 }
diff --git a/crates/mbe/src/tt_iter.rs b/crates/mbe/src/tt_iter.rs
index bd54f2442..5a4eca7bf 100644
--- a/crates/mbe/src/tt_iter.rs
+++ b/crates/mbe/src/tt_iter.rs
@@ -115,7 +115,7 @@ impl<'a> TtIter<'a> {
             }
         }
 
-        let buffer = TokenBuffer::from_tokens(&self.inner.as_slice());
+        let buffer = TokenBuffer::from_tokens(self.inner.as_slice());
         let mut src = SubtreeTokenSource::new(&buffer);
         let mut sink = OffsetTokenSink { cursor: buffer.begin(), error: false };
 
diff --git a/crates/proc_macro_api/src/msg.rs b/crates/proc_macro_api/src/msg.rs
index 14eed4289..899895578 100644
--- a/crates/proc_macro_api/src/msg.rs
+++ b/crates/proc_macro_api/src/msg.rs
@@ -59,7 +59,7 @@ pub trait Message: Serialize + DeserializeOwned {
         Ok(match read_json(inp, buf)? {
             None => None,
             Some(text) => {
-                let mut deserializer = serde_json::Deserializer::from_str(&text);
+                let mut deserializer = serde_json::Deserializer::from_str(text);
                 // Note that some proc-macro generate very deep syntax tree
                 // We have to disable the current limit of serde here
                 deserializer.disable_recursion_limit();
diff --git a/crates/project_model/src/build_data.rs b/crates/project_model/src/build_data.rs
index 33a4f8168..53cb4bae7 100644
--- a/crates/project_model/src/build_data.rs
+++ b/crates/project_model/src/build_data.rs
@@ -184,7 +184,7 @@ impl WorkspaceBuildData {
 
                 // Copy-pasted from existing cargo_metadata. It seems like we
                 // should be using sered_stacker here?
-                let mut deserializer = serde_json::Deserializer::from_str(&line);
+                let mut deserializer = serde_json::Deserializer::from_str(line);
                 deserializer.disable_recursion_limit();
                 let message = Message::deserialize(&mut deserializer)
                     .unwrap_or(Message::TextLine(line.to_string()));
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index b8ad08364..ac079f83e 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -278,7 +278,7 @@ impl CargoWorkspace {
                 id, edition, name, manifest_path, version, metadata, ..
             } = meta_pkg;
             let meta = from_value::(metadata.clone()).unwrap_or_default();
-            let is_member = ws_members.contains(&id);
+            let is_member = ws_members.contains(id);
             let edition = edition
                 .parse::()
                 .with_context(|| format!("Failed to parse edition {}", edition))?;
diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs
index 4e39d6dd3..a22f79c15 100644
--- a/crates/project_model/src/sysroot.rs
+++ b/crates/project_model/src/sysroot.rs
@@ -142,12 +142,12 @@ fn discover_sysroot_src_dir(
         log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core);
     }
 
-    get_rust_src(&sysroot_path)
+    get_rust_src(sysroot_path)
         .or_else(|| {
             let mut rustup = Command::new(toolchain::rustup());
             rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]);
             utf8_stdout(rustup).ok()?;
-            get_rust_src(&sysroot_path)
+            get_rust_src(sysroot_path)
         })
         .ok_or_else(|| {
             format_err!(
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs
index 84990075f..ef0f3c9e4 100644
--- a/crates/project_model/src/workspace.rs
+++ b/crates/project_model/src/workspace.rs
@@ -185,7 +185,7 @@ impl ProjectWorkspace {
 
     pub fn load_detached_files(detached_files: Vec) -> Result {
         let sysroot = Sysroot::discover(
-            &detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?,
+            detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?,
         )?;
         let rustc_cfg = rustc_cfg::get(None, None);
         Ok(ProjectWorkspace::DetachedFiles { files: detached_files, sysroot, rustc_cfg })
@@ -324,7 +324,7 @@ impl ProjectWorkspace {
     pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) {
         match self {
             ProjectWorkspace::Cargo { cargo, .. } => {
-                collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone());
+                collector.add_config(cargo.workspace_root(), cargo.build_data_config().clone());
             }
             _ => {}
         }
@@ -348,7 +348,7 @@ fn project_json_to_crate_graph(
         .crates()
         .filter_map(|(crate_id, krate)| {
             let file_path = &krate.root_module;
-            let file_id = load(&file_path)?;
+            let file_id = load(file_path)?;
             Some((crate_id, krate, file_id))
         })
         .map(|(crate_id, krate, file_id)| {
@@ -534,7 +534,7 @@ fn detached_files_to_crate_graph(
     cfg_options.extend(rustc_cfg);
 
     for detached_file in detached_files {
-        let file_id = match load(&detached_file) {
+        let file_id = match load(detached_file) {
             Some(file_id) => file_id,
             None => {
                 log::error!("Failed to load detached file {:?}", detached_file);
@@ -602,7 +602,7 @@ fn handle_rustc_crates(
                         crate_graph,
                         &rustc_workspace[pkg],
                         rustc_build_data_map.and_then(|it| it.get(&rustc_workspace[pkg].id)),
-                        &cfg_options,
+                        cfg_options,
                         proc_macro_loader,
                         file_id,
                         &rustc_workspace[tgt].name,
@@ -685,7 +685,7 @@ fn add_target_crate_root(
     let proc_macro = build_data
         .as_ref()
         .and_then(|it| it.proc_macro_dylib_path.as_ref())
-        .map(|it| proc_macro_loader(&it))
+        .map(|it| proc_macro_loader(it))
         .unwrap_or_default();
 
     let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string());
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs
index f4cd43448..5d8547152 100644
--- a/crates/rust-analyzer/src/cargo_target_spec.rs
+++ b/crates/rust-analyzer/src/cargo_target_spec.rs
@@ -123,7 +123,7 @@ impl CargoTargetSpec {
         let res = CargoTargetSpec {
             workspace_root: cargo_ws.workspace_root().to_path_buf(),
             cargo_toml: package_data.manifest.clone(),
-            package: cargo_ws.package_flag(&package_data),
+            package: cargo_ws.package_flag(package_data),
             target: target_data.name.clone(),
             target_kind: target_data.kind,
         };
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index 19cb1c046..b5f5519b4 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -126,7 +126,7 @@ fn load_crate_graph(
             }
         }
     }
-    let source_roots = source_root_config.partition(&vfs);
+    let source_roots = source_root_config.partition(vfs);
     analysis_change.set_roots(source_roots);
 
     analysis_change.set_crate_graph(crate_graph);
diff --git a/crates/rust-analyzer/src/diagnostics.rs b/crates/rust-analyzer/src/diagnostics.rs
index d4b9db362..2f63c26ce 100644
--- a/crates/rust-analyzer/src/diagnostics.rs
+++ b/crates/rust-analyzer/src/diagnostics.rs
@@ -47,7 +47,7 @@ impl DiagnosticCollection {
     ) {
         let diagnostics = self.check.entry(file_id).or_default();
         for existing_diagnostic in diagnostics.iter() {
-            if are_diagnostics_equal(&existing_diagnostic, &diagnostic) {
+            if are_diagnostics_equal(existing_diagnostic, &diagnostic) {
                 return;
             }
         }
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index 82dd0da9a..8594d923c 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -224,7 +224,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
 
     let mut message = rd.message.clone();
     for child in &rd.children {
-        let child = map_rust_child_diagnostic(config, workspace_root, &child);
+        let child = map_rust_child_diagnostic(config, workspace_root, child);
         match child {
             MappedRustChildDiagnostic::SubDiagnostic(sub) => {
                 subdiagnostics.push(sub);
@@ -268,7 +268,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
     primary_spans
         .iter()
         .flat_map(|primary_span| {
-            let primary_location = primary_location(config, workspace_root, &primary_span);
+            let primary_location = primary_location(config, workspace_root, primary_span);
 
             let mut message = message.clone();
             if needs_primary_span_label {
@@ -298,7 +298,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
                 // generated that code.
                 let is_in_macro_call = i != 0;
 
-                let secondary_location = location(config, workspace_root, &span);
+                let secondary_location = location(config, workspace_root, span);
                 if secondary_location == primary_location {
                     continue;
                 }
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 582a89667..583900cfe 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -194,7 +194,7 @@ impl GlobalState {
                 change.change_file(file.file_id, text);
             }
             if has_fs_changes {
-                let roots = self.source_root_config.partition(&vfs);
+                let roots = self.source_root_config.partition(vfs);
                 change.set_roots(roots);
             }
             change
@@ -291,7 +291,7 @@ impl GlobalStateSnapshot {
     }
 
     pub(crate) fn url_file_version(&self, url: &Url) -> Option {
-        let path = from_proto::vfs_path(&url).ok()?;
+        let path = from_proto::vfs_path(url).ok()?;
         Some(self.mem_docs.get(&path)?.version)
     }
 
@@ -300,7 +300,7 @@ impl GlobalStateSnapshot {
         base.pop();
         let path = base.join(&path.path).unwrap();
         let path = path.as_path().unwrap();
-        url_from_abs_path(&path)
+        url_from_abs_path(path)
     }
 
     pub(crate) fn cargo_target_for_crate_root(
@@ -312,7 +312,7 @@ impl GlobalStateSnapshot {
         let path = path.as_path()?;
         self.workspaces.iter().find_map(|ws| match ws {
             ProjectWorkspace::Cargo { cargo, .. } => {
-                cargo.target_by_root(&path).map(|it| (cargo, it))
+                cargo.target_by_root(path).map(|it| (cargo, it))
             }
             ProjectWorkspace::Json { .. } => None,
             ProjectWorkspace::DetachedFiles { .. } => None,
@@ -323,7 +323,7 @@ impl GlobalStateSnapshot {
 pub(crate) fn file_id_to_url(vfs: &vfs::Vfs, id: FileId) -> Url {
     let path = vfs.file_path(id);
     let path = path.as_path().unwrap();
-    url_from_abs_path(&path)
+    url_from_abs_path(path)
 }
 
 pub(crate) fn url_to_file_id(vfs: &vfs::Vfs, url: &Url) -> Result {
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 40dd0da3e..59339d401 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -1396,7 +1396,7 @@ pub(crate) fn handle_semantic_tokens_full_delta(
 
     if let Some(prev_id) = &cached_tokens.result_id {
         if *prev_id == params.previous_result_id {
-            let delta = to_proto::semantic_token_delta(&cached_tokens, &semantic_tokens);
+            let delta = to_proto::semantic_token_delta(cached_tokens, &semantic_tokens);
             *cached_tokens = semantic_tokens;
             return Ok(Some(delta.into()));
         }
@@ -1540,7 +1540,7 @@ fn runnable_action_links(
     snap: &GlobalStateSnapshot,
     runnable: Runnable,
 ) -> Option {
-    let cargo_spec = CargoTargetSpec::for_file(&snap, runnable.nav.file_id).ok()?;
+    let cargo_spec = CargoTargetSpec::for_file(snap, runnable.nav.file_id).ok()?;
     let hover_config = snap.config.hover();
     if !hover_config.runnable() || should_skip_target(&runnable, cargo_spec.as_ref()) {
         return None;
@@ -1624,7 +1624,7 @@ fn run_rustfmt(
     text_document: TextDocumentIdentifier,
     range: Option,
 ) -> Result>> {
-    let file_id = from_proto::file_id(&snap, &text_document.uri)?;
+    let file_id = from_proto::file_id(snap, &text_document.uri)?;
     let file = snap.analysis.file_text(file_id)?;
     let crate_ids = snap.analysis.crate_for(file_id)?;
 
@@ -1671,7 +1671,7 @@ fn run_rustfmt(
                     .into());
                 }
 
-                let frange = from_proto::file_range(&snap, text_document, range)?;
+                let frange = from_proto::file_range(snap, text_document, range)?;
                 let start_line = line_index.index.line_col(frange.range.start()).line;
                 let end_line = line_index.index.line_col(frange.range.end()).line;
 
diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs
index 8000b5490..087c26a71 100644
--- a/crates/rust-analyzer/src/lsp_utils.rs
+++ b/crates/rust-analyzer/src/lsp_utils.rs
@@ -124,7 +124,7 @@ pub(crate) fn apply_document_changes(
         match change.range {
             Some(range) => {
                 if !index_valid.covers(range.end.line) {
-                    line_index.index = Arc::new(ide::LineIndex::new(&old_text));
+                    line_index.index = Arc::new(ide::LineIndex::new(old_text));
                 }
                 index_valid = IndexValid::UpToLineExclusive(range.start.line);
                 let range = from_proto::text_range(&line_index, range);
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 31d8ea9e7..fa5fc6fbf 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -740,7 +740,7 @@ impl GlobalState {
         let subscriptions = self
             .mem_docs
             .keys()
-            .map(|path| self.vfs.read().0.file_id(&path).unwrap())
+            .map(|path| self.vfs.read().0.file_id(path).unwrap())
             .collect::>();
 
         log::trace!("updating notifications for {:?}", subscriptions);
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 7428a3043..e53cd3c7b 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -405,7 +405,7 @@ pub(crate) fn semantic_tokens(
                 text_range =
                     TextRange::new(text_range.start(), text_range.end() - TextSize::of('\n'));
             }
-            let range = range(&line_index, text_range);
+            let range = range(line_index, text_range);
             builder.push(range, token_index, modifier_bitset);
         }
     }
@@ -781,7 +781,7 @@ pub(crate) fn snippet_workspace_edit(
         document_changes.extend_from_slice(&ops);
     }
     for (file_id, edit) in source_change.source_file_edits {
-        let edit = snippet_text_document_edit(&snap, source_change.is_snippet, file_id, edit)?;
+        let edit = snippet_text_document_edit(snap, source_change.is_snippet, file_id, edit)?;
         document_changes.push(lsp_ext::SnippetDocumentChangeOperation::Edit(edit));
     }
     let mut workspace_edit = lsp_ext::SnippetWorkspaceEdit {
@@ -957,7 +957,7 @@ pub(crate) fn code_lens(
             let annotation_range = range(&line_index, annotation.range);
 
             let action = run.action();
-            let r = runnable(&snap, run)?;
+            let r = runnable(snap, run)?;
 
             let command = if debug {
                 command::debug_single(&r)
@@ -1236,12 +1236,12 @@ fn main() {
         assert_eq!(folds.len(), 4);
 
         let line_index = LineIndex {
-            index: Arc::new(ide::LineIndex::new(&text)),
+            index: Arc::new(ide::LineIndex::new(text)),
             endings: LineEndings::Unix,
             encoding: OffsetEncoding::Utf16,
         };
         let converted: Vec =
-            folds.into_iter().map(|it| folding_range(&text, &line_index, true, it)).collect();
+            folds.into_iter().map(|it| folding_range(text, &line_index, true, it)).collect();
 
         let expected_lines = [(0, 2), (4, 10), (5, 6), (7, 9)];
         assert_eq!(converted.len(), expected_lines.len());
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index 9e89209ea..3585132d4 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -493,7 +493,7 @@ fn preserves_dos_line_endings() {
     }
 
     let server = Project::with_fixture(
-        &"
+        "
 //- /Cargo.toml
 [package]
 name = \"foo\"
@@ -758,7 +758,7 @@ pub fn foo(_input: TokenStream) -> TokenStream {
         ```rust
         fn bar()
         ```"#]]
-    .assert_eq(&value);
+    .assert_eq(value);
 }
 
 #[test]
@@ -795,7 +795,7 @@ fn main() {}
 
 "#;
     let server =
-        Project::with_fixture(&code).tmp_dir(tmp_dir).server().wait_until_workspace_is_loaded();
+        Project::with_fixture(code).tmp_dir(tmp_dir).server().wait_until_workspace_is_loaded();
 
     //rename same level file
     server.request::(
diff --git a/crates/rust-analyzer/tests/slow-tests/support.rs b/crates/rust-analyzer/tests/slow-tests/support.rs
index 75e677762..e22c295f9 100644
--- a/crates/rust-analyzer/tests/slow-tests/support.rs
+++ b/crates/rust-analyzer/tests/slow-tests/support.rs
@@ -323,7 +323,7 @@ fn find_mismatch<'a>(expected: &'a Value, actual: &'a Value) -> Option<(&'a Valu
 
             if !l.is_empty() {
                 assert!(!r.is_empty());
-                Some((&l[0], &r[0]))
+                Some((l[0], r[0]))
             } else {
                 assert_eq!(r.len(), 0);
                 None
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs
index 19107ee38..8698687d8 100644
--- a/crates/syntax/src/ast/edit.rs
+++ b/crates/syntax/src/ast/edit.rs
@@ -30,7 +30,7 @@ impl ast::UseTree {
         let suffix = if self.path().as_ref() == Some(prefix) && self.use_tree_list().is_none() {
             make::path_unqualified(make::path_segment_self())
         } else {
-            match split_path_prefix(&prefix) {
+            match split_path_prefix(prefix) {
                 Some(it) => it,
                 None => return self.clone(),
             }
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
index 4b1e1ccee..ad52d9f54 100644
--- a/crates/syntax/src/ast/token_ext.rs
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -242,7 +242,7 @@ impl ast::ByteString {
             (Ok(c), true) if char_range.len() == 1 && Some(c) == text_iter.next() => (),
             (Ok(c), true) => {
                 buf.reserve_exact(text.len());
-                buf.extend_from_slice(&text[..char_range.start].as_bytes());
+                buf.extend_from_slice(text[..char_range.start].as_bytes());
                 buf.push(c as u8);
             }
             (Err(_), _) => has_error = true,
diff --git a/crates/syntax/src/parsing.rs b/crates/syntax/src/parsing.rs
index 431ed0699..001921343 100644
--- a/crates/syntax/src/parsing.rs
+++ b/crates/syntax/src/parsing.rs
@@ -15,7 +15,7 @@ use crate::{syntax_node::GreenNode, AstNode, SyntaxError, SyntaxNode};
 pub(crate) use crate::parsing::{lexer::*, reparsing::incremental_reparse};
 
 pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec) {
-    let (tokens, lexer_errors) = tokenize(&text);
+    let (tokens, lexer_errors) = tokenize(text);
 
     let mut token_source = TextTokenSource::new(text, &tokens);
     let mut tree_sink = TextTreeSink::new(text, &tokens);
@@ -33,7 +33,7 @@ pub(crate) fn parse_text_fragment(
     text: &str,
     fragment_kind: parser::FragmentKind,
 ) -> Result {
-    let (tokens, lexer_errors) = tokenize(&text);
+    let (tokens, lexer_errors) = tokenize(text);
     if !lexer_errors.is_empty() {
         return Err(());
     }
diff --git a/crates/syntax/src/parsing/lexer.rs b/crates/syntax/src/parsing/lexer.rs
index 7c8d0a4c4..ae4844e48 100644
--- a/crates/syntax/src/parsing/lexer.rs
+++ b/crates/syntax/src/parsing/lexer.rs
@@ -144,7 +144,7 @@ fn rustc_token_kind_to_syntax_kind(
             }
 
             rustc_lexer::TokenKind::RawIdent => IDENT,
-            rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind),
+            rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(kind),
 
             rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME_IDENT,
             rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => {
diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs
index 304f47b3d..186cc9e74 100644
--- a/crates/syntax/src/parsing/reparsing.rs
+++ b/crates/syntax/src/parsing/reparsing.rs
@@ -26,11 +26,11 @@ pub(crate) fn incremental_reparse(
     edit: &Indel,
     errors: Vec,
 ) -> Option<(GreenNode, Vec, TextRange)> {
-    if let Some((green, new_errors, old_range)) = reparse_token(node, &edit) {
+    if let Some((green, new_errors, old_range)) = reparse_token(node, edit) {
         return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
     }
 
-    if let Some((green, new_errors, old_range)) = reparse_block(node, &edit) {
+    if let Some((green, new_errors, old_range)) = reparse_block(node, edit) {
         return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
     }
     None
@@ -52,7 +52,7 @@ fn reparse_token(
                 }
             }
 
-            let mut new_text = get_text_after_edit(prev_token.clone().into(), &edit);
+            let mut new_text = get_text_after_edit(prev_token.clone().into(), edit);
             let (new_token_kind, new_err) = lex_single_syntax_kind(&new_text)?;
 
             if new_token_kind != prev_token_kind
diff --git a/crates/syntax/src/tests.rs b/crates/syntax/src/tests.rs
index 9f2426171..4961ca08d 100644
--- a/crates/syntax/src/tests.rs
+++ b/crates/syntax/src/tests.rs
@@ -69,13 +69,13 @@ fn parser_tests() {
     dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], "rast", |text, path| {
         let parse = SourceFile::parse(text);
         let errors = parse.errors();
-        assert_errors_are_absent(&errors, path);
+        assert_errors_are_absent(errors, path);
         parse.debug_dump()
     });
     dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], "rast", |text, path| {
         let parse = SourceFile::parse(text);
         let errors = parse.errors();
-        assert_errors_are_present(&errors, path);
+        assert_errors_are_present(errors, path);
         parse.debug_dump()
     });
 }
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs
index 0a4590c8d..0011f73c9 100644
--- a/crates/vfs/src/file_set.rs
+++ b/crates/vfs/src/file_set.rs
@@ -111,7 +111,7 @@ impl FileSetConfig {
         let mut scratch_space = Vec::new();
         let mut res = vec![FileSet::default(); self.len()];
         for (file_id, path) in vfs.iter() {
-            let root = self.classify(&path, &mut scratch_space);
+            let root = self.classify(path, &mut scratch_space);
             res[root].insert(file_id, path.clone())
         }
         res
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs
index 3b54b2489..4aebb02bd 100644
--- a/xtask/src/codegen/gen_lint_completions.rs
+++ b/xtask/src/codegen/gen_lint_completions.rs
@@ -28,7 +28,7 @@ pub(crate) fn generate_lint_completions() -> Result<()> {
     contents.push('\n');
 
     cmd!("curl https://rust-lang.github.io/rust-clippy/master/lints.json --output ./target/clippy_lints.json").run()?;
-    generate_descriptor_clippy(&mut contents, &Path::new("./target/clippy_lints.json"))?;
+    generate_descriptor_clippy(&mut contents, Path::new("./target/clippy_lints.json"))?;
     let contents = reformat(&contents)?;
 
     let destination = project_root().join("crates/ide_db/src/helpers/generated_lints.rs");
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index b0b9e30db..5435da76e 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -258,7 +258,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> Result {
     for chunk in ast.split("# [pretty_doc_comment_placeholder_workaround] ") {
         res.push_str(chunk);
         if let Some(doc) = docs.next() {
-            write_doc_comment(&doc, &mut res);
+            write_doc_comment(doc, &mut res);
         }
     }
 
@@ -294,14 +294,14 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result {
 
     let full_keywords_values = &grammar.keywords;
     let full_keywords =
-        full_keywords_values.iter().map(|kw| format_ident!("{}_KW", to_upper_snake_case(&kw)));
+        full_keywords_values.iter().map(|kw| format_ident!("{}_KW", to_upper_snake_case(kw)));
 
     let all_keywords_values =
         grammar.keywords.iter().chain(grammar.contextual_keywords.iter()).collect::>();
     let all_keywords_idents = all_keywords_values.iter().map(|kw| format_ident!("{}", kw));
     let all_keywords = all_keywords_values
         .iter()
-        .map(|name| format_ident!("{}_KW", to_upper_snake_case(&name)))
+        .map(|name| format_ident!("{}_KW", to_upper_snake_case(name)))
         .collect::>();
 
     let literals =
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs
index 34679062f..7b190d425 100644
--- a/xtask/src/metrics.rs
+++ b/xtask/src/metrics.rs
@@ -71,7 +71,7 @@ impl Metrics {
         Ok(())
     }
     fn measure_analysis_stats_self(&mut self) -> Result<()> {
-        self.measure_analysis_stats_path("self", &".")
+        self.measure_analysis_stats_path("self", ".")
     }
     fn measure_analysis_stats(&mut self, bench: &str) -> Result<()> {
         self.measure_analysis_stats_path(
-- 
cgit v1.2.3