Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/signatures.rs')
| -rw-r--r-- | crates/hir-def/src/signatures.rs | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/crates/hir-def/src/signatures.rs b/crates/hir-def/src/signatures.rs index d1d250a09e..4c5cae129a 100644 --- a/crates/hir-def/src/signatures.rs +++ b/crates/hir-def/src/signatures.rs @@ -74,10 +74,10 @@ impl StructSignature { let attrs = item_tree.attrs(db, loc.container.krate, ModItem::from(loc.id.value).into()); let mut flags = StructFlags::empty(); - if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() { + if attrs.by_key(sym::rustc_has_incoherent_inherent_impls).exists() { flags |= StructFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS; } - if attrs.by_key(&sym::fundamental).exists() { + if attrs.by_key(sym::fundamental).exists() { flags |= StructFlags::FUNDAMENTAL; } if let Some(lang) = attrs.lang_item() { @@ -131,10 +131,10 @@ impl UnionSignature { let item_tree = loc.id.item_tree(db); let attrs = item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()); let mut flags = StructFlags::empty(); - if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() { + if attrs.by_key(sym::rustc_has_incoherent_inherent_impls).exists() { flags |= StructFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS; } - if attrs.by_key(&sym::fundamental).exists() { + if attrs.by_key(sym::fundamental).exists() { flags |= StructFlags::FUNDAMENTAL; } @@ -184,7 +184,7 @@ impl EnumSignature { let item_tree = loc.id.item_tree(db); let attrs = item_tree.attrs(db, loc.container.krate, ModItem::from(loc.id.value).into()); let mut flags = EnumFlags::empty(); - if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() { + if attrs.by_key(sym::rustc_has_incoherent_inherent_impls).exists() { flags |= EnumFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS; } @@ -244,7 +244,7 @@ impl ConstSignature { let module = loc.container.module(db); let attrs = item_tree.attrs(db, module.krate, ModItem::from(loc.id.value).into()); let mut flags = ConstFlags::empty(); - if attrs.by_key(&sym::rustc_allow_incoherent_impl).exists() { + if attrs.by_key(sym::rustc_allow_incoherent_impl).exists() { flags |= ConstFlags::RUSTC_ALLOW_INCOHERENT_IMPL; } let source = loc.source(db); @@ -300,7 +300,7 @@ impl StaticSignature { let module = loc.container.module(db); let attrs = item_tree.attrs(db, module.krate, ModItem::from(loc.id.value).into()); let mut flags = StaticFlags::empty(); - if attrs.by_key(&sym::rustc_allow_incoherent_impl).exists() { + if attrs.by_key(sym::rustc_allow_incoherent_impl).exists() { flags |= StaticFlags::RUSTC_ALLOW_INCOHERENT_IMPL; } @@ -418,19 +418,19 @@ impl TraitSignature { if source.value.unsafe_token().is_some() { flags.insert(TraitFlags::UNSAFE); } - if attrs.by_key(&sym::fundamental).exists() { + if attrs.by_key(sym::fundamental).exists() { flags |= TraitFlags::FUNDAMENTAL; } - if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() { + if attrs.by_key(sym::rustc_has_incoherent_inherent_impls).exists() { flags |= TraitFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS; } - if attrs.by_key(&sym::rustc_paren_sugar).exists() { + if attrs.by_key(sym::rustc_paren_sugar).exists() { flags |= TraitFlags::RUSTC_PAREN_SUGAR; } let mut skip_array_during_method_dispatch = - attrs.by_key(&sym::rustc_skip_array_during_method_dispatch).exists(); + attrs.by_key(sym::rustc_skip_array_during_method_dispatch).exists(); let mut skip_boxed_slice_during_method_dispatch = false; - for tt in attrs.by_key(&sym::rustc_skip_during_method_dispatch).tt_values() { + for tt in attrs.by_key(sym::rustc_skip_during_method_dispatch).tt_values() { for tt in tt.iter() { if let tt::iter::TtElement::Leaf(tt::Leaf::Ident(ident)) = tt { skip_array_during_method_dispatch |= ident.sym == sym::array; @@ -534,11 +534,11 @@ impl FunctionSignature { let mut flags = FnFlags::empty(); let attrs = item_tree.attrs(db, module.krate, ModItem::from(loc.id.value).into()); - if attrs.by_key(&sym::rustc_allow_incoherent_impl).exists() { + if attrs.by_key(sym::rustc_allow_incoherent_impl).exists() { flags.insert(FnFlags::RUSTC_ALLOW_INCOHERENT_IMPL); } - if attrs.by_key(&sym::target_feature).exists() { + if attrs.by_key(sym::target_feature).exists() { flags.insert(FnFlags::HAS_TARGET_FEATURE); } let legacy_const_generics_indices = attrs.rustc_legacy_const_generics(); @@ -546,7 +546,7 @@ impl FunctionSignature { let source = loc.source(db); if source.value.unsafe_token().is_some() { - if attrs.by_key(&sym::rustc_deprecated_safe_2024).exists() { + if attrs.by_key(sym::rustc_deprecated_safe_2024).exists() { flags.insert(FnFlags::DEPRECATED_SAFE_2024); } else { flags.insert(FnFlags::UNSAFE); @@ -569,8 +569,7 @@ impl FunctionSignature { } let abi = source.value.abi().map(|abi| { - abi.abi_string() - .map_or_else(|| sym::C.clone(), |it| Symbol::intern(it.text_without_quotes())) + abi.abi_string().map_or_else(|| sym::C, |it| Symbol::intern(it.text_without_quotes())) }); let (store, source_map, generic_params, params, ret_type, self_param, variadic) = lower_function(db, module, source, id); @@ -671,10 +670,10 @@ impl TypeAliasSignature { loc.container.module(db).krate(), ModItem::from(loc.id.value).into(), ); - if attrs.by_key(&sym::rustc_has_incoherent_inherent_impls).exists() { + if attrs.by_key(sym::rustc_has_incoherent_inherent_impls).exists() { flags.insert(TypeAliasFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPL); } - if attrs.by_key(&sym::rustc_allow_incoherent_impl).exists() { + if attrs.by_key(sym::rustc_allow_incoherent_impl).exists() { flags.insert(TypeAliasFlags::RUSTC_ALLOW_INCOHERENT_IMPL); } if matches!(loc.container, ItemContainerId::ExternBlockId(_)) { |