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/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 ++++++++-------- 9 files changed, 36 insertions(+), 36 deletions(-) (limited to 'crates/hir_def') 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() { -- cgit v1.2.3 From 6cc6dee9e96d55dbbd8593523551a9981a691147 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:25:55 +0530 Subject: clippy::useless_conversion --- crates/hir_def/src/item_tree/pretty.rs | 2 +- crates/hir_def/src/lib.rs | 9 +++------ crates/hir_def/src/test_db.rs | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs index cc9944a22..b1e1b70d0 100644 --- a/crates/hir_def/src/item_tree/pretty.rs +++ b/crates/hir_def/src/item_tree/pretty.rs @@ -426,7 +426,7 @@ impl<'a> Printer<'a> { w!(self, " {{"); self.indented(|this| { for item in &**items { - this.print_mod_item((*item).into()); + this.print_mod_item(*item); } }); wln!(self, "}}"); diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 987485acc..3e7d496d5 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs @@ -736,8 +736,7 @@ fn macro_call_as_call_id( db.upcast(), krate, MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, - ) - .into()) + )) }; Ok(res) } @@ -765,8 +764,7 @@ fn derive_macro_as_call_id( derive_name: last_segment.to_string(), derive_attr_index: derive_attr.ast_index, }, - ) - .into(); + ); Ok(res) } @@ -804,7 +802,6 @@ fn attr_macro_as_call_id( attr_args: arg, invoc_attr_index: macro_attr.id.ast_index, }, - ) - .into(); + ); Ok(res) } diff --git a/crates/hir_def/src/test_db.rs b/crates/hir_def/src/test_db.rs index b20b066e2..a16203fdb 100644 --- a/crates/hir_def/src/test_db.rs +++ b/crates/hir_def/src/test_db.rs @@ -325,7 +325,7 @@ impl TestDB { for diag in source_map.diagnostics() { let (ptr, message): (InFile, &str) = match diag { BodyDiagnostic::InactiveCode { node, .. } => { - (node.clone().map(|it| it.into()), "InactiveCode") + (node.clone().map(|it| it), "InactiveCode") } BodyDiagnostic::MacroError { node, message } => { (node.clone().map(|it| it.into()), message.as_str()) -- cgit v1.2.3 From 705f7e6e2644bf5de4255bc05ea8d9d5027c29b0 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:27:19 +0530 Subject: clippy::clone_on_copy --- crates/hir_def/src/attr.rs | 2 +- crates/hir_def/src/item_scope.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index d9f9fadc1..2b21cf927 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -606,7 +606,7 @@ pub struct DocsRangeMap { impl DocsRangeMap { pub fn map(&self, range: TextRange) -> Option> { let found = self.mapping.binary_search_by(|(probe, ..)| probe.ordering(range)).ok()?; - let (line_docs_range, idx, original_line_src_range) = self.mapping[found].clone(); + let (line_docs_range, idx, original_line_src_range) = self.mapping[found]; if !line_docs_range.contains_range(range) { return None; } diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs index 0f74f050d..08407ebfa 100644 --- a/crates/hir_def/src/item_scope.rs +++ b/crates/hir_def/src/item_scope.rs @@ -59,7 +59,7 @@ pub struct ItemScope { pub(crate) static BUILTIN_SCOPE: Lazy> = Lazy::new(|| { BuiltinType::ALL .iter() - .map(|(name, ty)| (name.clone(), PerNs::types(ty.clone().into(), Visibility::Public))) + .map(|(name, ty)| (name.clone(), PerNs::types((*ty).into(), Visibility::Public))) .collect() }); -- cgit v1.2.3 From 75370312fbfe072947ffdc568eebc9cb4c6108e4 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:29:36 +0530 Subject: clippy::redundant_closure --- crates/hir_def/src/attr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 2b21cf927..d07adb084 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -583,13 +583,13 @@ impl AttrSourceMap { .get(id.ast_index as usize) .unwrap_or_else(|| panic!("cannot find doc comment at index {:?}", id)) .clone() - .map(|attr| Either::Right(attr)) + .map(Either::Right) } else { self.attrs .get(id.ast_index as usize) .unwrap_or_else(|| panic!("cannot find `Attr` at index {:?}", id)) .clone() - .map(|attr| Either::Left(attr)) + .map(Either::Left) } } } -- cgit v1.2.3 From c50b4579ec842ac7c1f52e0e3c834d50fc9cd1bb Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:35:29 +0530 Subject: clippy::useless_return --- crates/hir_def/src/body/lower.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index a8bd36a0a..bed4c4994 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -1000,7 +1000,7 @@ impl From for Literal { // FIXME: these should have actual values filled in, but unsure on perf impact LiteralKind::IntNumber(lit) => { if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) { - return Literal::Float(Default::default(), builtin); + Literal::Float(Default::default(), builtin) } else if let builtin @ Some(_) = lit.suffix().and_then(|it| BuiltinInt::from_suffix(it)) { -- cgit v1.2.3 From 5ac6804bb3a07b959e8c2c3534255a8d6bb4948c Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:48:15 +0530 Subject: cargo fmt --- crates/hir_def/src/lib.rs | 51 ++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 3e7d496d5..303083c6d 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs @@ -731,12 +731,11 @@ fn macro_call_as_call_id( ) .map(MacroCallId::from) } else { - Ok(def - .as_lazy_macro( - db.upcast(), - krate, - MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, - )) + Ok(def.as_lazy_macro( + db.upcast(), + krate, + MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, + )) }; Ok(res) } @@ -755,16 +754,15 @@ fn derive_macro_as_call_id( .segments() .last() .ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?; - let res = def - .as_lazy_macro( - db.upcast(), - krate, - MacroCallKind::Derive { - ast_id: item_attr.ast_id, - derive_name: last_segment.to_string(), - derive_attr_index: derive_attr.ast_index, - }, - ); + let res = def.as_lazy_macro( + db.upcast(), + krate, + MacroCallKind::Derive { + ast_id: item_attr.ast_id, + derive_name: last_segment.to_string(), + derive_attr_index: derive_attr.ast_index, + }, + ); Ok(res) } @@ -792,16 +790,15 @@ fn attr_macro_as_call_id( // The parentheses are always disposed here. arg.delimiter = None; - let res = def - .as_lazy_macro( - db.upcast(), - krate, - MacroCallKind::Attr { - ast_id: item_attr.ast_id, - attr_name: last_segment.to_string(), - attr_args: arg, - invoc_attr_index: macro_attr.id.ast_index, - }, - ); + let res = def.as_lazy_macro( + db.upcast(), + krate, + MacroCallKind::Attr { + ast_id: item_attr.ast_id, + attr_name: last_segment.to_string(), + attr_args: arg, + invoc_attr_index: macro_attr.id.ast_index, + }, + ); Ok(res) } -- cgit v1.2.3