Skip to content

Commit 6e5f90a

Browse files
committed
Shrink ast::Attribute.
1 parent 86a0a18 commit 6e5f90a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

clippy_lints/src/crate_in_macro_def.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ impl EarlyLintPass for CrateInMacroDef {
7474

7575
fn is_macro_export(attr: &Attribute) -> bool {
7676
if_chain! {
77-
if let AttrKind::Normal(attr_item, _) = &attr.kind;
78-
if let [segment] = attr_item.path.segments.as_slice();
77+
if let AttrKind::Normal(normal) = &attr.kind;
78+
if let [segment] = normal.item.path.segments.as_slice();
7979
then {
8080
segment.ident.name == sym::macro_export
8181
} else {

clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ pub fn eq_attr(l: &Attribute, r: &Attribute) -> bool {
695695
l.style == r.style
696696
&& match (&l.kind, &r.kind) {
697697
(DocComment(l1, l2), DocComment(r1, r2)) => l1 == r1 && l2 == r2,
698-
(Normal(l, _), Normal(r, _)) => eq_path(&l.path, &r.path) && eq_mac_args(&l.args, &r.args),
698+
(Normal(l), Normal(r)) => eq_path(&l.item.path, &r.item.path) && eq_mac_args(&l.item.args, &r.item.args),
699699
_ => false,
700700
}
701701
}

clippy_utils/src/attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ pub fn get_attr<'a>(
5959
name: &'static str,
6060
) -> impl Iterator<Item = &'a ast::Attribute> {
6161
attrs.iter().filter(move |attr| {
62-
let attr = if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
63-
attr
62+
let attr = if let ast::AttrKind::Normal(ref normal) = attr.kind {
63+
&normal.item
6464
} else {
6565
return false;
6666
};

clippy_utils/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,8 @@ pub fn std_or_core(cx: &LateContext<'_>) -> Option<&'static str> {
18931893

18941894
pub fn is_no_std_crate(cx: &LateContext<'_>) -> bool {
18951895
cx.tcx.hir().attrs(hir::CRATE_HIR_ID).iter().any(|attr| {
1896-
if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
1897-
attr.path == sym::no_std
1896+
if let ast::AttrKind::Normal(ref normal) = attr.kind {
1897+
normal.item.path == sym::no_std
18981898
} else {
18991899
false
19001900
}
@@ -1903,8 +1903,8 @@ pub fn is_no_std_crate(cx: &LateContext<'_>) -> bool {
19031903

19041904
pub fn is_no_core_crate(cx: &LateContext<'_>) -> bool {
19051905
cx.tcx.hir().attrs(hir::CRATE_HIR_ID).iter().any(|attr| {
1906-
if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
1907-
attr.path == sym::no_core
1906+
if let ast::AttrKind::Normal(ref normal) = attr.kind {
1907+
normal.item.path == sym::no_core
19081908
} else {
19091909
false
19101910
}

0 commit comments

Comments
 (0)