Skip to content

Commit 2226f16

Browse files
committed
Rename NestedMetaItem to MetaItemInner
1 parent d050730 commit 2226f16

8 files changed

+20
-20
lines changed

clippy_lints/src/attrs/allow_attributes_without_reason.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use super::{ALLOW_ATTRIBUTES_WITHOUT_REASON, Attribute};
22
use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::is_from_proc_macro;
4-
use rustc_ast::{MetaItemKind, NestedMetaItem};
4+
use rustc_ast::{MetaItemInner, MetaItemKind};
55
use rustc_lint::{LateContext, LintContext};
66
use rustc_middle::lint::in_external_macro;
77
use rustc_span::sym;
88
use rustc_span::symbol::Symbol;
99

10-
pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) {
10+
pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[MetaItemInner], attr: &'cx Attribute) {
1111
// Check if the reason is present
12-
if let Some(item) = items.last().and_then(NestedMetaItem::meta_item)
12+
if let Some(item) = items.last().and_then(MetaItemInner::meta_item)
1313
&& let MetaItemKind::NameValue(_) = &item.kind
1414
&& item.path == sym::reason
1515
{

clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use super::BLANKET_CLIPPY_RESTRICTION_LINTS;
22
use super::utils::extract_clippy_lint;
33
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_then};
4-
use rustc_ast::NestedMetaItem;
4+
use rustc_ast::MetaItemInner;
55
use rustc_lint::{LateContext, Level, LintContext};
66
use rustc_span::symbol::Symbol;
77
use rustc_span::{DUMMY_SP, sym};
88

9-
pub(super) fn check(cx: &LateContext<'_>, name: Symbol, items: &[NestedMetaItem]) {
9+
pub(super) fn check(cx: &LateContext<'_>, name: Symbol, items: &[MetaItemInner]) {
1010
for lint in items {
1111
if let Some(lint_name) = extract_clippy_lint(lint) {
1212
if lint_name.as_str() == "restriction" && name != sym::allow {

clippy_lints/src/attrs/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mod utils;
1414

1515
use clippy_config::Conf;
1616
use clippy_config::msrvs::{self, Msrv};
17-
use rustc_ast::{Attribute, MetaItemKind, NestedMetaItem};
17+
use rustc_ast::{Attribute, MetaItemInner, MetaItemKind};
1818
use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
1919
use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
2020
use rustc_session::impl_lint_pass;
@@ -456,7 +456,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
456456
return;
457457
}
458458
for item in items {
459-
if let NestedMetaItem::MetaItem(mi) = &item
459+
if let MetaItemInner::MetaItem(mi) = &item
460460
&& let MetaItemKind::NameValue(lit) = &mi.kind
461461
&& mi.has_name(sym::since)
462462
{

clippy_lints/src/attrs/non_minimal_cfg.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{Attribute, NON_MINIMAL_CFG};
22
use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::source::SpanRangeExt;
4-
use rustc_ast::{MetaItemKind, NestedMetaItem};
4+
use rustc_ast::{MetaItemInner, MetaItemKind};
55
use rustc_errors::Applicability;
66
use rustc_lint::EarlyContext;
77
use rustc_span::sym;
@@ -14,9 +14,9 @@ pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
1414
}
1515
}
1616

17-
fn check_nested_cfg(cx: &EarlyContext<'_>, items: &[NestedMetaItem]) {
17+
fn check_nested_cfg(cx: &EarlyContext<'_>, items: &[MetaItemInner]) {
1818
for item in items {
19-
if let NestedMetaItem::MetaItem(meta) = item {
19+
if let MetaItemInner::MetaItem(meta) = item {
2020
if !meta.has_name(sym::any) && !meta.has_name(sym::all) {
2121
continue;
2222
}

clippy_lints/src/attrs/useless_attribute.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::utils::{extract_clippy_lint, is_lint_level, is_word};
22
use super::{Attribute, USELESS_ATTRIBUTE};
33
use clippy_utils::diagnostics::span_lint_and_then;
44
use clippy_utils::source::{SpanRangeExt, first_line_of_span};
5-
use rustc_ast::NestedMetaItem;
5+
use rustc_ast::MetaItemInner;
66
use rustc_errors::Applicability;
77
use rustc_hir::{Item, ItemKind};
88
use rustc_lint::{LateContext, LintContext};
@@ -21,7 +21,7 @@ pub(super) fn check(cx: &LateContext<'_>, item: &Item<'_>, attrs: &[Attribute])
2121
for lint in lint_list {
2222
match item.kind {
2323
ItemKind::Use(..) => {
24-
if let NestedMetaItem::MetaItem(meta_item) = lint
24+
if let MetaItemInner::MetaItem(meta_item) = lint
2525
&& meta_item.is_word()
2626
&& let Some(ident) = meta_item.ident()
2727
&& matches!(

clippy_lints/src/attrs/utils.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::macros::{is_panic, macro_backtrace};
2-
use rustc_ast::{AttrId, NestedMetaItem};
2+
use rustc_ast::{AttrId, MetaItemInner};
33
use rustc_hir::{
44
Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitFn, TraitItem, TraitItemKind,
55
};
@@ -8,8 +8,8 @@ use rustc_middle::ty;
88
use rustc_span::sym;
99
use rustc_span::symbol::Symbol;
1010

11-
pub(super) fn is_word(nmi: &NestedMetaItem, expected: Symbol) -> bool {
12-
if let NestedMetaItem::MetaItem(mi) = &nmi {
11+
pub(super) fn is_word(nmi: &MetaItemInner, expected: Symbol) -> bool {
12+
if let MetaItemInner::MetaItem(mi) = &nmi {
1313
mi.is_word() && mi.has_name(expected)
1414
} else {
1515
false
@@ -74,7 +74,7 @@ fn is_relevant_expr(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_>
7474
}
7575

7676
/// Returns the lint name if it is clippy lint.
77-
pub(super) fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<Symbol> {
77+
pub(super) fn extract_clippy_lint(lint: &MetaItemInner) -> Option<Symbol> {
7878
if let Some(meta_item) = lint.meta_item()
7979
&& meta_item.path.segments.len() > 1
8080
&& let tool_name = meta_item.path.segments[0].ident

clippy_lints/src/cfg_not_test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
2-
use rustc_ast::NestedMetaItem;
2+
use rustc_ast::MetaItemInner;
33
use rustc_lint::{EarlyContext, EarlyLintPass};
44
use rustc_session::declare_lint_pass;
55

@@ -47,7 +47,7 @@ impl EarlyLintPass for CfgNotTest {
4747
}
4848
}
4949

50-
fn contains_not_test(list: Option<&[NestedMetaItem]>, not: bool) -> bool {
50+
fn contains_not_test(list: Option<&[MetaItemInner]>, not: bool) -> bool {
5151
list.is_some_and(|list| {
5252
list.iter().any(|item| {
5353
item.ident().is_some_and(|ident| match ident.name {

clippy_lints/src/returns.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clippy_utils::{
77
path_to_local_id, span_contains_cfg, span_find_starting_semi,
88
};
99
use core::ops::ControlFlow;
10-
use rustc_ast::NestedMetaItem;
10+
use rustc_ast::MetaItemInner;
1111
use rustc_errors::Applicability;
1212
use rustc_hir::LangItem::ResultErr;
1313
use rustc_hir::intravisit::FnKind;
@@ -421,7 +421,7 @@ fn check_final_expr<'tcx>(
421421
if matches!(Level::from_attr(attr), Some(Level::Expect(_)))
422422
&& let metas = attr.meta_item_list()
423423
&& let Some(lst) = metas
424-
&& let [NestedMetaItem::MetaItem(meta_item), ..] = lst.as_slice()
424+
&& let [MetaItemInner::MetaItem(meta_item), ..] = lst.as_slice()
425425
&& let [tool, lint_name] = meta_item.path.segments.as_slice()
426426
&& tool.ident.name == sym::clippy
427427
&& matches!(

0 commit comments

Comments
 (0)