From b21c7204a571657ada07da9adc97c38e310b0891 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Wed, 29 Oct 2025 14:56:48 +0000 Subject: [PATCH] Remove the pre-expansion pass --- clippy_lints/src/attrs/deprecated_cfg_attr.rs | 131 +++++++++++------ clippy_lints/src/attrs/mod.rs | 112 +++++++++----- clippy_lints/src/attrs/non_minimal_cfg.rs | 87 +++++------ clippy_lints/src/lib.rs | 9 +- clippy_utils/src/msrvs.rs | 2 +- tests/ui/cfg_attr_cargo_clippy.fixed | 14 +- tests/ui/cfg_attr_cargo_clippy.rs | 14 +- tests/ui/cfg_attr_cargo_clippy.stderr | 16 +- tests/ui/cfg_attr_rustfmt.fixed | 82 ++++++++--- tests/ui/cfg_attr_rustfmt.rs | 86 +++++++---- tests/ui/cfg_attr_rustfmt.stderr | 139 ++++++++++++++++-- tests/ui/explicit_write_in_test.stderr | 0 tests/ui/must_use_unit_unfixable.rs | 4 +- tests/ui/must_use_unit_unfixable.stderr | 12 +- tests/ui/non_minimal_cfg.fixed | 50 +++++-- tests/ui/non_minimal_cfg.rs | 50 +++++-- tests/ui/non_minimal_cfg.stderr | 80 ++++++++-- tests/ui/non_minimal_cfg2.rs | 9 -- tests/ui/non_minimal_cfg2.stderr | 11 -- 19 files changed, 635 insertions(+), 273 deletions(-) delete mode 100644 tests/ui/explicit_write_in_test.stderr delete mode 100644 tests/ui/non_minimal_cfg2.rs delete mode 100644 tests/ui/non_minimal_cfg2.stderr diff --git a/clippy_lints/src/attrs/deprecated_cfg_attr.rs b/clippy_lints/src/attrs/deprecated_cfg_attr.rs index d67a194b0206..18f8d03c2aa6 100644 --- a/clippy_lints/src/attrs/deprecated_cfg_attr.rs +++ b/clippy_lints/src/attrs/deprecated_cfg_attr.rs @@ -1,70 +1,66 @@ -use super::{Attribute, DEPRECATED_CFG_ATTR, DEPRECATED_CLIPPY_CFG_ATTR, unnecessary_clippy_cfg}; -use clippy_utils::diagnostics::span_lint_and_sugg; +use super::{Attribute, DEPRECATED_CFG_ATTR, DEPRECATED_CLIPPY_CFG_ATTR}; +use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then, span_lint_hir_and_then}; use clippy_utils::msrvs::{self, MsrvStack}; use clippy_utils::sym; use rustc_ast::AttrStyle; use rustc_errors::Applicability; -use rustc_lint::EarlyContext; +use rustc_hir::attrs::CfgEntry; +use rustc_hir::def_id::{LOCAL_CRATE, LocalDefId}; +use rustc_lint::{EarlyContext, LateContext}; -pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute, msrv: &MsrvStack) { +pub(super) fn check_rustfmt(cx: &EarlyContext<'_>, attrs: &[Attribute], msrv: &MsrvStack) { + for attr in attrs { + check_rustfmt_attr(cx, attr, msrv); + } +} + +fn check_rustfmt_attr(cx: &EarlyContext<'_>, attr: &Attribute, msrv: &MsrvStack) { // check cfg_attr - if attr.has_name(sym::cfg_attr) + if attr.has_name(sym::cfg_attr_trace) && let Some(items) = attr.meta_item_list() && items.len() == 2 && let Some(feature_item) = items[0].meta_item() - { // check for `rustfmt` - if feature_item.has_name(sym::rustfmt) - && msrv.meets(msrvs::TOOL_ATTRIBUTES) - // check for `rustfmt_skip` and `rustfmt::skip` - && let Some(skip_item) = &items[1].meta_item() - && (skip_item.has_name(sym::rustfmt_skip) - || skip_item - .path - .segments - .last() - .expect("empty path in attribute") - .ident - .name - == sym::skip) - // Only lint outer attributes, because custom inner attributes are unstable - // Tracking issue: https://github.com/rust-lang/rust/issues/54726 - && attr.style == AttrStyle::Outer - { - span_lint_and_sugg( - cx, - DEPRECATED_CFG_ATTR, - attr.span, - "`cfg_attr` is deprecated for rustfmt and got replaced by tool attributes", - "use", - "#[rustfmt::skip]".to_string(), - Applicability::MachineApplicable, - ); - } else { - check_deprecated_cfg_recursively(cx, feature_item); - if let Some(behind_cfg_attr) = items[1].meta_item() { - unnecessary_clippy_cfg::check(cx, feature_item, behind_cfg_attr, attr); - } - } - } -} - -pub(super) fn check_clippy(cx: &EarlyContext<'_>, attr: &Attribute) { - if attr.has_name(sym::cfg) - && let Some(list) = attr.meta_item_list() + && feature_item.has_name(sym::rustfmt) + && msrv.meets(msrvs::TOOL_ATTRIBUTES) + // check for `rustfmt_skip` and `rustfmt::skip` + && let Some(skip_item) = &items[1].meta_item() + && (skip_item.has_name(sym::rustfmt_skip) + || skip_item + .path + .segments + .last() + .expect("empty path in attribute") + .ident + .name + == sym::skip) + // Only lint outer attributes, because custom inner attributes are unstable + // Tracking issue: https://github.com/rust-lang/rust/issues/54726 + && attr.style == AttrStyle::Outer { - for item in list.iter().filter_map(|item| item.meta_item()) { - check_deprecated_cfg_recursively(cx, item); - } + span_lint_and_then( + cx, + DEPRECATED_CFG_ATTR, + attr.span, + "`cfg_attr` is deprecated for rustfmt", + |diag| { + diag.span_suggestion_verbose( + attr.span, + "use the `rustfmt::skip` tool attribute instead", + "#[rustfmt::skip]", + Applicability::MachineApplicable, + ); + }, + ); } } -fn check_deprecated_cfg_recursively(cx: &EarlyContext<'_>, attr: &rustc_ast::MetaItem) { +pub(super) fn check(cx: &EarlyContext<'_>, attr: &rustc_ast::MetaItem) { if let Some(ident) = attr.ident() { if matches!(ident.name, sym::any | sym::all | sym::not) { let Some(list) = attr.meta_item_list() else { return }; for item in list.iter().filter_map(|item| item.meta_item()) { - check_deprecated_cfg_recursively(cx, item); + check(cx, item); } } else { check_cargo_clippy_attr(cx, attr); @@ -85,3 +81,40 @@ fn check_cargo_clippy_attr(cx: &EarlyContext<'_>, item: &rustc_ast::MetaItem) { ); } } + +pub fn check_stripped(cx: &LateContext<'_>) { + for stripped in cx.tcx.stripped_cfg_items(LOCAL_CRATE) { + if let Some(parent_module) = stripped.parent_module.as_local() { + check_cfg_entry(cx, &stripped.cfg.0, parent_module); + } + } +} + +fn check_cfg_entry(cx: &LateContext<'_>, cfg: &CfgEntry, parent_module: LocalDefId) { + match cfg { + &CfgEntry::NameValue { + name: sym::feature, + name_span: _, + value: Some((sym::cargo_clippy, _)), + span, + } => { + span_lint_hir_and_then( + cx, + DEPRECATED_CLIPPY_CFG_ATTR, + cx.tcx.local_def_id_to_hir_id(parent_module), + span, + "`feature = \"cargo-clippy\"` was replaced by `clippy`", + |diag| { + diag.span_suggestion(span, "replace with", "clippy", Applicability::MachineApplicable); + }, + ); + }, + CfgEntry::All(children, _) | CfgEntry::Any(children, _) => { + for child in children { + check_cfg_entry(cx, child, parent_module); + } + }, + CfgEntry::Not(child, _) => check_cfg_entry(cx, child, parent_module), + _ => {}, + } +} diff --git a/clippy_lints/src/attrs/mod.rs b/clippy_lints/src/attrs/mod.rs index 91c2dc7f3dc6..8615838736cd 100644 --- a/clippy_lints/src/attrs/mod.rs +++ b/clippy_lints/src/attrs/mod.rs @@ -160,9 +160,11 @@ declare_clippy_lint! { /// are stable now, they should be used instead of the old `cfg_attr(rustfmt)` attributes. /// /// ### Known problems - /// This lint doesn't detect crate level inner attributes, because they get - /// processed before the PreExpansionPass lints get executed. See - /// [#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765) + /// Does not detect attributes applied to macro invocations such as + /// ```no_run + /// #[cfg_attr(rustfmt, rustfmt_skip)] + /// println!(".."); + /// ``` /// /// ### Example /// ```no_run @@ -314,11 +316,16 @@ declare_clippy_lint! { declare_clippy_lint! { /// ### What it does - /// Checks for `any` and `all` combinators in `cfg` with only one condition. + /// Checks for `any` and `all` combinators in `cfg` or `cfg_attr` with only one condition. /// /// ### Why is this bad? /// If there is only one condition, no need to wrap it into `any` or `all` combinators. /// + /// ### Known Problems + /// Only attributes that are attached to items included in the current compilation will be linted, + /// for the examples below the lint will only fire when `Bar` is compiled - in this case when on + /// a `unix` target. + /// /// ### Example /// ```no_run /// #[cfg(any(unix))] @@ -474,22 +481,27 @@ declare_clippy_lint! { "ignored tests without messages" } -pub struct Attributes { +pub struct LateAttributes { msrv: Msrv, } -impl_lint_pass!(Attributes => [ +impl_lint_pass!(LateAttributes => [ INLINE_ALWAYS, REPR_PACKED_WITHOUT_ABI, + DEPRECATED_CLIPPY_CFG_ATTR, ]); -impl Attributes { +impl LateAttributes { pub fn new(conf: &'static Conf) -> Self { Self { msrv: conf.msrv } } } -impl<'tcx> LateLintPass<'tcx> for Attributes { +impl<'tcx> LateLintPass<'tcx> for LateAttributes { + fn check_crate(&mut self, cx: &LateContext<'tcx>) { + deprecated_cfg_attr::check_stripped(cx); + } + fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) { let attrs = cx.tcx.hir_attrs(item.hir_id()); if let ItemKind::Fn { ident, .. } = item.kind @@ -526,35 +538,6 @@ impl EarlyAttributes { } impl_lint_pass!(EarlyAttributes => [ - DEPRECATED_CFG_ATTR, - NON_MINIMAL_CFG, - DEPRECATED_CLIPPY_CFG_ATTR, - UNNECESSARY_CLIPPY_CFG, -]); - -impl EarlyLintPass for EarlyAttributes { - fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) { - deprecated_cfg_attr::check(cx, attr, &self.msrv); - deprecated_cfg_attr::check_clippy(cx, attr); - non_minimal_cfg::check(cx, attr); - } - - extract_msrv_attr!(); -} - -pub struct PostExpansionEarlyAttributes { - msrv: MsrvStack, -} - -impl PostExpansionEarlyAttributes { - pub fn new(conf: &'static Conf) -> Self { - Self { - msrv: MsrvStack::new(conf.msrv), - } - } -} - -impl_lint_pass!(PostExpansionEarlyAttributes => [ ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON, DEPRECATED_SEMVER, @@ -564,9 +547,13 @@ impl_lint_pass!(PostExpansionEarlyAttributes => [ SHOULD_PANIC_WITHOUT_EXPECT, MIXED_ATTRIBUTES_STYLE, DUPLICATED_ATTRIBUTES, + DEPRECATED_CFG_ATTR, + DEPRECATED_CLIPPY_CFG_ATTR, + UNNECESSARY_CLIPPY_CFG, + NON_MINIMAL_CFG, ]); -impl EarlyLintPass for PostExpansionEarlyAttributes { +impl EarlyLintPass for EarlyAttributes { fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &ast::Crate) { blanket_clippy_restriction_lints::check_command_line(cx); duplicated_attributes::check(cx, &krate.attrs); @@ -585,6 +572,15 @@ impl EarlyLintPass for PostExpansionEarlyAttributes { if is_lint_level(ident.name, attr.id) { blanket_clippy_restriction_lints::check(cx, ident.name, items); } + if matches!(ident.name, sym::cfg_trace | sym::cfg_attr_trace) + && let Some(meta_item) = items.first().and_then(|item| item.meta_item()) + { + non_minimal_cfg::check(cx, items, &self.msrv); + deprecated_cfg_attr::check(cx, meta_item); + if let Some(behind_cfg) = items.get(1).and_then(|item| item.meta_item()) { + unnecessary_clippy_cfg::check(cx, meta_item, behind_cfg, attr); + } + } if items.is_empty() || !attr.has_name(sym::deprecated) { return; } @@ -620,14 +616,52 @@ impl EarlyLintPass for PostExpansionEarlyAttributes { } fn check_item(&mut self, cx: &EarlyContext<'_>, item: &'_ ast::Item) { - match item.kind { + match &item.kind { ast::ItemKind::ExternCrate(..) | ast::ItemKind::Use(..) => useless_attribute::check(cx, item, &item.attrs), + ast::ItemKind::Struct(.., variant) => { + for field in variant.fields() { + deprecated_cfg_attr::check_rustfmt(cx, &field.attrs, &self.msrv); + } + }, + ast::ItemKind::ForeignMod(foreign) => { + for item in &foreign.items { + deprecated_cfg_attr::check_rustfmt(cx, &item.attrs, &self.msrv); + } + }, _ => {}, } + deprecated_cfg_attr::check_rustfmt(cx, &item.attrs, &self.msrv); mixed_attributes_style::check(cx, item.span, &item.attrs); duplicated_attributes::check(cx, &item.attrs); } + fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) { + match &stmt.kind { + ast::StmtKind::Let(local) => deprecated_cfg_attr::check_rustfmt(cx, &local.attrs, &self.msrv), + ast::StmtKind::Semi(expr) => deprecated_cfg_attr::check_rustfmt(cx, &expr.attrs, &self.msrv), + _ => {}, + } + } + + fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) { + deprecated_cfg_attr::check_rustfmt(cx, &arm.attrs, &self.msrv); + } + + fn check_trait_item(&mut self, cx: &EarlyContext<'_>, item: &ast::AssocItem) { + deprecated_cfg_attr::check_rustfmt(cx, &item.attrs, &self.msrv); + } + + fn check_impl_item(&mut self, cx: &EarlyContext<'_>, item: &ast::AssocItem) { + deprecated_cfg_attr::check_rustfmt(cx, &item.attrs, &self.msrv); + } + + fn check_variant(&mut self, cx: &EarlyContext<'_>, variant: &ast::Variant) { + deprecated_cfg_attr::check_rustfmt(cx, &variant.attrs, &self.msrv); + for field in variant.data.fields() { + deprecated_cfg_attr::check_rustfmt(cx, &field.attrs, &self.msrv); + } + } + extract_msrv_attr!(); } diff --git a/clippy_lints/src/attrs/non_minimal_cfg.rs b/clippy_lints/src/attrs/non_minimal_cfg.rs index 7eff5eccfa13..1890f945102e 100644 --- a/clippy_lints/src/attrs/non_minimal_cfg.rs +++ b/clippy_lints/src/attrs/non_minimal_cfg.rs @@ -1,53 +1,56 @@ -use super::{Attribute, NON_MINIMAL_CFG}; +use super::NON_MINIMAL_CFG; use clippy_utils::diagnostics::span_lint_and_then; +use clippy_utils::msrvs::{self, MsrvStack}; use clippy_utils::source::SpanRangeExt; use rustc_ast::{MetaItemInner, MetaItemKind}; use rustc_errors::Applicability; use rustc_lint::EarlyContext; use rustc_span::sym; -pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) { - if attr.has_name(sym::cfg) - && let Some(items) = attr.meta_item_list() - { - check_nested_cfg(cx, &items); - } -} - -fn check_nested_cfg(cx: &EarlyContext<'_>, items: &[MetaItemInner]) { +pub(super) fn check(cx: &EarlyContext<'_>, items: &[MetaItemInner], msrv: &MsrvStack) { for item in items { - if let MetaItemInner::MetaItem(meta) = item { - if !meta.has_name(sym::any) && !meta.has_name(sym::all) { - continue; - } - if let MetaItemKind::List(list) = &meta.kind { - check_nested_cfg(cx, list); - if list.len() == 1 { - span_lint_and_then( - cx, - NON_MINIMAL_CFG, - meta.span, - "unneeded sub `cfg` when there is only one condition", - |diag| { - if let Some(snippet) = list[0].span().get_source_text(cx) { - diag.span_suggestion( - meta.span, - "try", - snippet.to_owned(), - Applicability::MaybeIncorrect, - ); - } - }, - ); - } else if list.is_empty() && meta.has_name(sym::all) { - span_lint_and_then( - cx, - NON_MINIMAL_CFG, - meta.span, - "unneeded sub `cfg` when there is no condition", - |_| {}, - ); - } + if let MetaItemInner::MetaItem(meta) = item + && let Some(name @ (sym::any | sym::all)) = meta.name() + && !meta.span.from_expansion() + && let MetaItemKind::List(list) = &meta.kind + { + check(cx, list, msrv); + if list.len() == 1 { + span_lint_and_then( + cx, + NON_MINIMAL_CFG, + meta.span, + "unneeded sub `cfg` when there is only one condition", + |diag| { + if let Some(snippet) = list[0].span().get_source_text(cx) { + diag.span_suggestion( + meta.span, + "try", + snippet.to_owned(), + Applicability::MachineApplicable, + ); + } + }, + ); + } else if list.is_empty() && msrv.meets(msrvs::CFG_BOOLEAN_LITERALS) { + span_lint_and_then( + cx, + NON_MINIMAL_CFG, + meta.span, + "unneeded sub `cfg` when there is no condition", + |diag| { + diag.span_suggestion_verbose( + meta.span, + "use a boolean literal instead", + match name { + sym::all => "true", + sym::any => "false", + _ => return, + }, + Applicability::MachineApplicable, + ); + }, + ); } } } diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 1d0ebff26e69..55a786be3e8b 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -442,12 +442,7 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co store.register_removed(name, reason); } - // NOTE: Do not add any more pre-expansion passes. These should be removed eventually. - // Due to the architecture of the compiler, currently `cfg_attr` attributes on crate - // level (i.e `#![cfg_attr(...)]`) will still be expanded even when using a pre-expansion pass. - store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes::new(conf))); - - store.register_early_pass(move || Box::new(attrs::PostExpansionEarlyAttributes::new(conf))); + store.register_early_pass(move || Box::new(attrs::EarlyAttributes::new(conf))); let format_args_storage = FormatArgsStorage::default(); let format_args = format_args_storage.clone(); @@ -480,7 +475,7 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co store.register_late_pass(|_| Box::new(unnecessary_mut_passed::UnnecessaryMutPassed)); store.register_late_pass(|_| Box::>::default()); store.register_late_pass(move |_| Box::new(len_zero::LenZero::new(conf))); - store.register_late_pass(move |_| Box::new(attrs::Attributes::new(conf))); + store.register_late_pass(move |_| Box::new(attrs::LateAttributes::new(conf))); store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions)); store.register_late_pass(|_| Box::new(unicode::Unicode)); store.register_late_pass(|_| Box::new(uninit_vec::UninitVec)); diff --git a/clippy_utils/src/msrvs.rs b/clippy_utils/src/msrvs.rs index 86d17a8231d5..787aae73e537 100644 --- a/clippy_utils/src/msrvs.rs +++ b/clippy_utils/src/msrvs.rs @@ -23,7 +23,7 @@ macro_rules! msrv_aliases { // names may refer to stabilized feature flags or library items msrv_aliases! { - 1,88,0 { LET_CHAINS } + 1,88,0 { LET_CHAINS, CFG_BOOLEAN_LITERALS } 1,87,0 { OS_STR_DISPLAY, INT_MIDPOINT, CONST_CHAR_IS_DIGIT, UNSIGNED_IS_MULTIPLE_OF, INTEGER_SIGN_CAST } 1,85,0 { UINT_FLOAT_MIDPOINT, CONST_SIZE_OF_VAL } 1,84,0 { CONST_OPTION_AS_SLICE, MANUAL_DANGLING_PTR } diff --git a/tests/ui/cfg_attr_cargo_clippy.fixed b/tests/ui/cfg_attr_cargo_clippy.fixed index f55920db5503..b09d5cc2f59c 100644 --- a/tests/ui/cfg_attr_cargo_clippy.fixed +++ b/tests/ui/cfg_attr_cargo_clippy.fixed @@ -7,14 +7,22 @@ //~^ deprecated_clippy_cfg_attr #[cfg_attr(not(clippy), derive(Debug))] //~^ deprecated_clippy_cfg_attr -#[cfg(clippy)] -//~^ deprecated_clippy_cfg_attr +struct Attrs; + #[cfg(not(clippy))] //~^ deprecated_clippy_cfg_attr +struct Not; + +#[cfg(clippy)] +//~^ deprecated_clippy_cfg_attr +struct Stripped; + #[cfg(any(clippy))] //~^ deprecated_clippy_cfg_attr +struct StrippedAny; + #[cfg(all(clippy))] //~^ deprecated_clippy_cfg_attr -pub struct Bar; +struct StrippedAll; fn main() {} diff --git a/tests/ui/cfg_attr_cargo_clippy.rs b/tests/ui/cfg_attr_cargo_clippy.rs index faf36d98f2b3..a9a25faddffd 100644 --- a/tests/ui/cfg_attr_cargo_clippy.rs +++ b/tests/ui/cfg_attr_cargo_clippy.rs @@ -7,14 +7,22 @@ //~^ deprecated_clippy_cfg_attr #[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))] //~^ deprecated_clippy_cfg_attr -#[cfg(feature = "cargo-clippy")] -//~^ deprecated_clippy_cfg_attr +struct Attrs; + #[cfg(not(feature = "cargo-clippy"))] //~^ deprecated_clippy_cfg_attr +struct Not; + +#[cfg(feature = "cargo-clippy")] +//~^ deprecated_clippy_cfg_attr +struct Stripped; + #[cfg(any(feature = "cargo-clippy"))] //~^ deprecated_clippy_cfg_attr +struct StrippedAny; + #[cfg(all(feature = "cargo-clippy"))] //~^ deprecated_clippy_cfg_attr -pub struct Bar; +struct StrippedAll; fn main() {} diff --git a/tests/ui/cfg_attr_cargo_clippy.stderr b/tests/ui/cfg_attr_cargo_clippy.stderr index 4f5c39b78415..3d6aa2fa2f64 100644 --- a/tests/ui/cfg_attr_cargo_clippy.stderr +++ b/tests/ui/cfg_attr_cargo_clippy.stderr @@ -19,12 +19,6 @@ error: `feature = "cargo-clippy"` was replaced by `clippy` LL | #[cfg_attr(not(feature = "cargo-clippy"), derive(Debug))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` -error: `feature = "cargo-clippy"` was replaced by `clippy` - --> tests/ui/cfg_attr_cargo_clippy.rs:10:7 - | -LL | #[cfg(feature = "cargo-clippy")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` - error: `feature = "cargo-clippy"` was replaced by `clippy` --> tests/ui/cfg_attr_cargo_clippy.rs:12:11 | @@ -32,13 +26,19 @@ LL | #[cfg(not(feature = "cargo-clippy"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` error: `feature = "cargo-clippy"` was replaced by `clippy` - --> tests/ui/cfg_attr_cargo_clippy.rs:14:11 + --> tests/ui/cfg_attr_cargo_clippy.rs:16:7 + | +LL | #[cfg(feature = "cargo-clippy")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` + +error: `feature = "cargo-clippy"` was replaced by `clippy` + --> tests/ui/cfg_attr_cargo_clippy.rs:20:11 | LL | #[cfg(any(feature = "cargo-clippy"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` error: `feature = "cargo-clippy"` was replaced by `clippy` - --> tests/ui/cfg_attr_cargo_clippy.rs:16:11 + --> tests/ui/cfg_attr_cargo_clippy.rs:24:11 | LL | #[cfg(all(feature = "cargo-clippy"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy` diff --git a/tests/ui/cfg_attr_rustfmt.fixed b/tests/ui/cfg_attr_rustfmt.fixed index 401476a9c1fe..0d971e38a0aa 100644 --- a/tests/ui/cfg_attr_rustfmt.fixed +++ b/tests/ui/cfg_attr_rustfmt.fixed @@ -1,46 +1,80 @@ - -#![feature(stmt_expr_attributes)] - -#![allow(unused, clippy::no_effect, clippy::unnecessary_operation)] #![warn(clippy::deprecated_cfg_attr)] -// This doesn't get linted, see known problems +// #![rusfmt::skip] requires https://github.com/rust-lang/rust/issues/54726 #![cfg_attr(rustfmt, rustfmt_skip)] #[rustfmt::skip] -trait Foo -{ fn foo( -); +) {} + +#[rustfmt::skip] +//~^ deprecated_cfg_attr +fn outer() { + + #[rustfmt::skip] + //~^ deprecated_cfg_attr + let _ = 1; + + #[rustfmt::skip] + //~^ deprecated_cfg_attr + foo(); } -fn skip_on_statements() { +struct S { #[rustfmt::skip] //~^ deprecated_cfg_attr - 5+3; + field: String } -#[rustfmt::skip] -//~^ deprecated_cfg_attr -fn main() { - foo::f(); +impl S { + #[rustfmt::skip] + //~^ deprecated_cfg_attr + fn g() {} } -mod foo { - #![cfg_attr(rustfmt, rustfmt_skip)] +trait A { + #[rustfmt::skip] + //~^ deprecated_cfg_attr + fn f(); +} - pub fn f() {} +impl A for S { + #[rustfmt::skip] + //~^ deprecated_cfg_attr + fn f() {} } -#[clippy::msrv = "1.29"] -fn msrv_1_29() { - #[cfg_attr(rustfmt, rustfmt::skip)] - 1+29; +enum E { + #[rustfmt::skip] + //~^ deprecated_cfg_attr + Variant { + #[rustfmt::skip] + //~^ deprecated_cfg_attr + field: String, + } } -#[clippy::msrv = "1.30"] -fn msrv_1_30() { +unsafe extern "C" { #[rustfmt::skip] //~^ deprecated_cfg_attr - 1+30; + fn external(); } + +fn invalid() { + #![cfg_attr(rustfmt, rustfmt_skip)] + + #[cfg_attr(rustfmt, rustfmt::skip)] + {} + + #[cfg_attr(rustfmt, rustfmt_skip)] + foo() +} + +#[clippy::msrv = "1.29"] +#[cfg_attr(rustfmt, rustfmt::skip)] +fn msrv_1_29() {} + +#[clippy::msrv = "1.30"] +#[rustfmt::skip] +//~^ deprecated_cfg_attr +fn msrv_1_30() {} diff --git a/tests/ui/cfg_attr_rustfmt.rs b/tests/ui/cfg_attr_rustfmt.rs index 3cf368129fd8..4084e85ffe92 100644 --- a/tests/ui/cfg_attr_rustfmt.rs +++ b/tests/ui/cfg_attr_rustfmt.rs @@ -1,46 +1,80 @@ - -#![feature(stmt_expr_attributes)] - -#![allow(unused, clippy::no_effect, clippy::unnecessary_operation)] #![warn(clippy::deprecated_cfg_attr)] -// This doesn't get linted, see known problems +// #![rusfmt::skip] requires https://github.com/rust-lang/rust/issues/54726 #![cfg_attr(rustfmt, rustfmt_skip)] #[rustfmt::skip] -trait Foo -{ fn foo( -); +) {} + +#[cfg_attr(rustfmt, rustfmt_skip)] +//~^ deprecated_cfg_attr +fn outer() { + + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + let _ = 1; + + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + foo(); } -fn skip_on_statements() { - #[cfg_attr(rustfmt, rustfmt::skip)] +struct S { + #[cfg_attr(rustfmt, rustfmt_skip)] //~^ deprecated_cfg_attr - 5+3; + field: String } -#[cfg_attr(rustfmt, rustfmt_skip)] -//~^ deprecated_cfg_attr -fn main() { - foo::f(); +impl S { + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + fn g() {} } -mod foo { - #![cfg_attr(rustfmt, rustfmt_skip)] +trait A { + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + fn f(); +} - pub fn f() {} +impl A for S { + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + fn f() {} } -#[clippy::msrv = "1.29"] -fn msrv_1_29() { - #[cfg_attr(rustfmt, rustfmt::skip)] - 1+29; +enum E { + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + Variant { + #[cfg_attr(rustfmt, rustfmt_skip)] + //~^ deprecated_cfg_attr + field: String, + } } -#[clippy::msrv = "1.30"] -fn msrv_1_30() { - #[cfg_attr(rustfmt, rustfmt::skip)] +unsafe extern "C" { + #[cfg_attr(rustfmt, rustfmt_skip)] //~^ deprecated_cfg_attr - 1+30; + fn external(); +} + +fn invalid() { + #![cfg_attr(rustfmt, rustfmt_skip)] + + #[cfg_attr(rustfmt, rustfmt::skip)] + {} + + #[cfg_attr(rustfmt, rustfmt_skip)] + foo() } + +#[clippy::msrv = "1.29"] +#[cfg_attr(rustfmt, rustfmt::skip)] +fn msrv_1_29() {} + +#[clippy::msrv = "1.30"] +#[cfg_attr(rustfmt, rustfmt::skip)] +//~^ deprecated_cfg_attr +fn msrv_1_30() {} diff --git a/tests/ui/cfg_attr_rustfmt.stderr b/tests/ui/cfg_attr_rustfmt.stderr index d7825f854be5..e27a5a5efad3 100644 --- a/tests/ui/cfg_attr_rustfmt.stderr +++ b/tests/ui/cfg_attr_rustfmt.stderr @@ -1,23 +1,136 @@ -error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes - --> tests/ui/cfg_attr_rustfmt.rs:18:5 +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:10:1 | -LL | #[cfg_attr(rustfmt, rustfmt::skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::deprecated_cfg_attr)]` +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | -error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes - --> tests/ui/cfg_attr_rustfmt.rs:23:1 +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:14:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:18:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:24:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:30:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:36:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:42:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:48:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] | -LL | #[cfg_attr(rustfmt, rustfmt_skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` -error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes - --> tests/ui/cfg_attr_rustfmt.rs:43:5 +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:51:9 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:58:5 + | +LL | #[cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt_skip)] +LL + #[rustfmt::skip] + | + +error: `cfg_attr` is deprecated for rustfmt + --> tests/ui/cfg_attr_rustfmt.rs:78:1 + | +LL | #[cfg_attr(rustfmt, rustfmt::skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the `rustfmt::skip` tool attribute instead + | +LL - #[cfg_attr(rustfmt, rustfmt::skip)] +LL + #[rustfmt::skip] | -LL | #[cfg_attr(rustfmt, rustfmt::skip)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]` -error: aborting due to 3 previous errors +error: aborting due to 11 previous errors diff --git a/tests/ui/explicit_write_in_test.stderr b/tests/ui/explicit_write_in_test.stderr deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/ui/must_use_unit_unfixable.rs b/tests/ui/must_use_unit_unfixable.rs index 8eeaf36dca29..6f4b4b3b1d23 100644 --- a/tests/ui/must_use_unit_unfixable.rs +++ b/tests/ui/must_use_unit_unfixable.rs @@ -1,8 +1,8 @@ -#[cfg_attr(all(), must_use, deprecated)] +#[cfg_attr(true, must_use, deprecated)] fn issue_12320() {} //~^ must_use_unit -#[cfg_attr(all(), deprecated, doc = "foo", must_use)] +#[cfg_attr(true, deprecated, doc = "foo", must_use)] fn issue_12320_2() {} //~^ must_use_unit diff --git a/tests/ui/must_use_unit_unfixable.stderr b/tests/ui/must_use_unit_unfixable.stderr index 8b5e556b1b2e..09d8a73dffda 100644 --- a/tests/ui/must_use_unit_unfixable.stderr +++ b/tests/ui/must_use_unit_unfixable.stderr @@ -5,10 +5,10 @@ LL | fn issue_12320() {} | ^^^^^^^^^^^^^^^^ | help: remove `must_use` - --> tests/ui/must_use_unit_unfixable.rs:1:19 + --> tests/ui/must_use_unit_unfixable.rs:1:18 | -LL | #[cfg_attr(all(), must_use, deprecated)] - | ^^^^^^^^ +LL | #[cfg_attr(true, must_use, deprecated)] + | ^^^^^^^^ = note: `-D clippy::must-use-unit` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]` @@ -19,10 +19,10 @@ LL | fn issue_12320_2() {} | ^^^^^^^^^^^^^^^^^^ | help: remove `must_use` - --> tests/ui/must_use_unit_unfixable.rs:5:44 + --> tests/ui/must_use_unit_unfixable.rs:5:43 | -LL | #[cfg_attr(all(), deprecated, doc = "foo", must_use)] - | ^^^^^^^^ +LL | #[cfg_attr(true, deprecated, doc = "foo", must_use)] + | ^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/non_minimal_cfg.fixed b/tests/ui/non_minimal_cfg.fixed index a2b69d0662ee..192cbcea7ae0 100644 --- a/tests/ui/non_minimal_cfg.fixed +++ b/tests/ui/non_minimal_cfg.fixed @@ -1,19 +1,49 @@ -#![allow(unused)] +//@compile-flags: --cfg foo --cfg bar -#[cfg(windows)] +#[cfg(foo)] //~^ non_minimal_cfg -fn hermit() {} +fn all() {} -#[cfg(windows)] +#[cfg(foo)] //~^ non_minimal_cfg -fn wasi() {} +fn any() {} -#[cfg(all(unix, not(windows)))] +#[cfg(any(foo, not(bar)))] //~^ non_minimal_cfg //~| non_minimal_cfg -fn the_end() {} +fn mixed() {} -#[cfg(any())] -fn any() {} +#[cfg(true)] +//~^ non_minimal_cfg +fn empty_all() {} + +#[cfg(any(true, false))] +//~^ non_minimal_cfg +fn empty_any() {} + +#[cfg_attr(foo, doc = "all")] +//~^ non_minimal_cfg +#[cfg_attr(any(foo, not(bar)), doc = "mixed")] +//~^ non_minimal_cfg +//~| non_minimal_cfg +#[cfg_attr(not_active, doc = "catches not active cfg_attrs")] +//~^ non_minimal_cfg +fn cfg_attr() {} + +macro_rules! in_macro { + ($($tt:tt)*) => { + #[cfg(any($($tt)*))] + struct FromMacro; + } +} -fn main() {} +in_macro!(foo); + +#[clippy::msrv = "1.87"] +#[cfg_attr(any(), inline)] +fn msrv_1_87() {} + +#[clippy::msrv = "1.88"] +#[cfg_attr(false, inline)] +//~^ non_minimal_cfg +fn msrv_1_88() {} diff --git a/tests/ui/non_minimal_cfg.rs b/tests/ui/non_minimal_cfg.rs index 7178cd189c08..a44e679c9c46 100644 --- a/tests/ui/non_minimal_cfg.rs +++ b/tests/ui/non_minimal_cfg.rs @@ -1,19 +1,49 @@ -#![allow(unused)] +//@compile-flags: --cfg foo --cfg bar -#[cfg(all(windows))] +#[cfg(all(foo))] //~^ non_minimal_cfg -fn hermit() {} +fn all() {} -#[cfg(any(windows))] +#[cfg(any(foo))] //~^ non_minimal_cfg -fn wasi() {} +fn any() {} -#[cfg(all(any(unix), all(not(windows))))] +#[cfg(any(any(foo), all(not(bar))))] //~^ non_minimal_cfg //~| non_minimal_cfg -fn the_end() {} +fn mixed() {} -#[cfg(any())] -fn any() {} +#[cfg(all())] +//~^ non_minimal_cfg +fn empty_all() {} + +#[cfg(any(true, any()))] +//~^ non_minimal_cfg +fn empty_any() {} + +#[cfg_attr(all(foo), doc = "all")] +//~^ non_minimal_cfg +#[cfg_attr(any(any(foo), all(not(bar))), doc = "mixed")] +//~^ non_minimal_cfg +//~| non_minimal_cfg +#[cfg_attr(any(not_active), doc = "catches not active cfg_attrs")] +//~^ non_minimal_cfg +fn cfg_attr() {} + +macro_rules! in_macro { + ($($tt:tt)*) => { + #[cfg(any($($tt)*))] + struct FromMacro; + } +} -fn main() {} +in_macro!(foo); + +#[clippy::msrv = "1.87"] +#[cfg_attr(any(), inline)] +fn msrv_1_87() {} + +#[clippy::msrv = "1.88"] +#[cfg_attr(any(), inline)] +//~^ non_minimal_cfg +fn msrv_1_88() {} diff --git a/tests/ui/non_minimal_cfg.stderr b/tests/ui/non_minimal_cfg.stderr index 3bf306dd89c2..e2245739dcb3 100644 --- a/tests/ui/non_minimal_cfg.stderr +++ b/tests/ui/non_minimal_cfg.stderr @@ -1,8 +1,8 @@ error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:3:7 | -LL | #[cfg(all(windows))] - | ^^^^^^^^^^^^ help: try: `windows` +LL | #[cfg(all(foo))] + | ^^^^^^^^ help: try: `foo` | = note: `-D clippy::non-minimal-cfg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::non_minimal_cfg)]` @@ -10,20 +10,80 @@ LL | #[cfg(all(windows))] error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:7:7 | -LL | #[cfg(any(windows))] - | ^^^^^^^^^^^^ help: try: `windows` +LL | #[cfg(any(foo))] + | ^^^^^^^^ help: try: `foo` error: unneeded sub `cfg` when there is only one condition --> tests/ui/non_minimal_cfg.rs:11:11 | -LL | #[cfg(all(any(unix), all(not(windows))))] - | ^^^^^^^^^ help: try: `unix` +LL | #[cfg(any(any(foo), all(not(bar))))] + | ^^^^^^^^ help: try: `foo` error: unneeded sub `cfg` when there is only one condition - --> tests/ui/non_minimal_cfg.rs:11:22 + --> tests/ui/non_minimal_cfg.rs:11:21 | -LL | #[cfg(all(any(unix), all(not(windows))))] - | ^^^^^^^^^^^^^^^^^ help: try: `not(windows)` +LL | #[cfg(any(any(foo), all(not(bar))))] + | ^^^^^^^^^^^^^ help: try: `not(bar)` -error: aborting due to 4 previous errors +error: unneeded sub `cfg` when there is no condition + --> tests/ui/non_minimal_cfg.rs:16:7 + | +LL | #[cfg(all())] + | ^^^^^ + | +help: use a boolean literal instead + | +LL - #[cfg(all())] +LL + #[cfg(true)] + | + +error: unneeded sub `cfg` when there is no condition + --> tests/ui/non_minimal_cfg.rs:20:17 + | +LL | #[cfg(any(true, any()))] + | ^^^^^ + | +help: use a boolean literal instead + | +LL - #[cfg(any(true, any()))] +LL + #[cfg(any(true, false))] + | + +error: unneeded sub `cfg` when there is only one condition + --> tests/ui/non_minimal_cfg.rs:24:12 + | +LL | #[cfg_attr(all(foo), doc = "all")] + | ^^^^^^^^ help: try: `foo` + +error: unneeded sub `cfg` when there is only one condition + --> tests/ui/non_minimal_cfg.rs:26:16 + | +LL | #[cfg_attr(any(any(foo), all(not(bar))), doc = "mixed")] + | ^^^^^^^^ help: try: `foo` + +error: unneeded sub `cfg` when there is only one condition + --> tests/ui/non_minimal_cfg.rs:26:26 + | +LL | #[cfg_attr(any(any(foo), all(not(bar))), doc = "mixed")] + | ^^^^^^^^^^^^^ help: try: `not(bar)` + +error: unneeded sub `cfg` when there is only one condition + --> tests/ui/non_minimal_cfg.rs:29:12 + | +LL | #[cfg_attr(any(not_active), doc = "catches not active cfg_attrs")] + | ^^^^^^^^^^^^^^^ help: try: `not_active` + +error: unneeded sub `cfg` when there is no condition + --> tests/ui/non_minimal_cfg.rs:47:12 + | +LL | #[cfg_attr(any(), inline)] + | ^^^^^ + | +help: use a boolean literal instead + | +LL - #[cfg_attr(any(), inline)] +LL + #[cfg_attr(false, inline)] + | + +error: aborting due to 11 previous errors diff --git a/tests/ui/non_minimal_cfg2.rs b/tests/ui/non_minimal_cfg2.rs deleted file mode 100644 index d073feedb1da..000000000000 --- a/tests/ui/non_minimal_cfg2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@require-annotations-for-level: WARN -#![allow(unused)] - -#[cfg(all())] -//~^ ERROR: unneeded sub `cfg` when there is no condition -//~| NOTE: `-D clippy::non-minimal-cfg` implied by `-D warnings` -fn all() {} - -fn main() {} diff --git a/tests/ui/non_minimal_cfg2.stderr b/tests/ui/non_minimal_cfg2.stderr deleted file mode 100644 index 169d2989aa13..000000000000 --- a/tests/ui/non_minimal_cfg2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: unneeded sub `cfg` when there is no condition - --> tests/ui/non_minimal_cfg2.rs:4:7 - | -LL | #[cfg(all())] - | ^^^^^ - | - = note: `-D clippy::non-minimal-cfg` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::non_minimal_cfg)]` - -error: aborting due to 1 previous error -