Skip to content

Commit f850d15

Browse files
Rollup merge of rust-lang#133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu
Change `AttrArgs::Eq` to a struct variant Cleanups for simplifying rust-lang#131808 Basically changes `AttrArgs::Eq` to a struct variant and then avoids several matches on `AttrArgsEq` in favor of methods on it. This will make future refactorings simpler, as they can either keep methods or switch to field accesses without having to restructure code
2 parents a0a948d + 5082adf commit f850d15

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

clippy_lints/src/attrs/should_panic_without_expect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::sym;
99

1010
pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
1111
if let AttrKind::Normal(normal_attr) = &attr.kind {
12-
if let AttrArgs::Eq(_, AttrArgsEq::Ast(_)) = &normal_attr.item.args {
12+
if let AttrArgs::Eq { value: AttrArgsEq::Ast(_), .. } = &normal_attr.item.args {
1313
// `#[should_panic = ".."]` found, good
1414
return;
1515
}

clippy_lints/src/doc/include_in_doc_without_cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
1212
if !attr.span.from_expansion()
1313
&& let AttrKind::Normal(ref normal) = attr.kind
1414
&& normal.item.path == sym::doc
15-
&& let AttrArgs::Eq(_, AttrArgsEq::Hir(ref meta)) = normal.item.args
15+
&& let AttrArgs::Eq { value: AttrArgsEq::Hir(ref meta), .. } = normal.item.args
1616
&& !attr.span.contains(meta.span)
1717
// Since the `include_str` is already expanded at this point, we can only take the
1818
// whole attribute snippet and then modify for our suggestion.

clippy_lints/src/large_include_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl LateLintPass<'_> for LargeIncludeFile {
9696
&& let AttrKind::Normal(ref normal) = attr.kind
9797
&& let Some(doc) = attr.doc_str()
9898
&& doc.as_str().len() as u64 > self.max_file_size
99-
&& let AttrArgs::Eq(_, AttrArgsEq::Hir(ref meta)) = normal.item.args
99+
&& let AttrArgs::Eq { value: AttrArgsEq::Hir(ref meta), .. } = normal.item.args
100100
&& !attr.span.contains(meta.span)
101101
// Since the `include_str` is already expanded at this point, we can only take the
102102
// whole attribute snippet and then modify for our suggestion.

clippy_utils/src/ast_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
872872
match (l, r) {
873873
(Empty, Empty) => true,
874874
(Delimited(la), Delimited(ra)) => eq_delim_args(la, ra),
875-
(Eq(_, AttrArgsEq::Ast(le)), Eq(_, AttrArgsEq::Ast(re))) => eq_expr(le, re),
876-
(Eq(_, AttrArgsEq::Hir(ll)), Eq(_, AttrArgsEq::Hir(rl))) => ll.kind == rl.kind,
875+
(Eq { value: AttrArgsEq::Ast(le), .. }, Eq{ value: AttrArgsEq::Ast(re), .. }) => eq_expr(le, re),
876+
(Eq { value: AttrArgsEq::Hir(ll), .. }, Eq{ value: AttrArgsEq::Hir(rl), .. }) => ll.kind == rl.kind,
877877
_ => false,
878878
}
879879
}

0 commit comments

Comments
 (0)