From e0d31a8dfa5cf00e5dc75a9dfb02fd71ebee3ba8 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Fri, 8 Jul 2022 20:54:09 +0200 Subject: [PATCH 1/6] Stabilize `lint_reasons` in rustc (RFC 2383) --- compiler/rustc_feature/src/accepted.rs | 2 + compiler/rustc_feature/src/active.rs | 2 - compiler/rustc_feature/src/builtin_attrs.rs | 5 +-- compiler/rustc_lint/src/expect.rs | 5 --- compiler/rustc_lint/src/levels.rs | 11 +---- compiler/rustc_lint_defs/src/builtin.rs | 5 +-- src/test/ui/empty/empty-attributes.rs | 2 - src/test/ui/empty/empty-attributes.stderr | 18 ++++---- .../feature-gate-lint-reasons.rs | 5 --- .../feature-gate-lint-reasons.stderr | 21 ---------- src/test/ui/lint/empty-lint-attributes.rs | 2 - src/test/ui/lint/reasons-erroneous.rs | 2 - src/test/ui/lint/reasons-erroneous.stderr | 42 +++++++++---------- src/test/ui/lint/reasons-forbidden.rs | 2 - src/test/ui/lint/reasons-forbidden.stderr | 6 +-- src/test/ui/lint/reasons.rs | 1 - src/test/ui/lint/reasons.stderr | 8 ++-- .../avoid_delayed_good_path_ice.rs | 1 - .../catch_multiple_lint_triggers.rs | 2 - .../crate_level_expect.rs | 2 - .../crate_level_expect.stderr | 2 +- .../expect_inside_macro.rs | 2 - .../expect_lint_from_macro.rs | 2 - .../expect_lint_from_macro.stderr | 6 +-- .../expect_missing_feature_gate.rs | 9 ---- .../expect_missing_feature_gate.stderr | 12 ------ .../expect_multiple_lints.rs | 2 - .../expect_multiple_lints.stderr | 16 +++---- .../expect_nested_lint_levels.rs | 1 - .../expect_nested_lint_levels.stderr | 14 +++---- .../expect_on_fn_params.rs | 1 - .../expect_on_fn_params.stderr | 2 +- .../expect_tool_lint_rfc_2383.rs | 1 - .../expect_tool_lint_rfc_2383.stderr | 4 +- .../expect_unfulfilled_expectation.rs | 1 - .../expect_unfulfilled_expectation.stderr | 8 ++-- .../expect_with_forbid.rs | 2 - .../expect_with_forbid.stderr | 12 +++--- .../expect_with_reason.rs | 1 - .../expect_with_reason.stderr | 2 +- .../force_warn_expected_lints_fulfilled.rs | 2 - ...force_warn_expected_lints_fulfilled.stderr | 10 ++--- .../force_warn_expected_lints_unfulfilled.rs | 2 - ...rce_warn_expected_lints_unfulfilled.stderr | 10 ++--- .../fulfilled_expectation_early_lints.rs | 2 - .../fulfilled_expectation_late_lints.rs | 1 - .../lint-attribute-only-with-reason.rs | 2 - .../lint-attribute-only-with-reason.stderr | 12 +++--- .../multiple_expect_attrs.rs | 1 - .../multiple_expect_attrs.stderr | 2 +- .../no_ice_for_partial_compiler_runs.rs | 2 - .../no_ice_for_partial_compiler_runs.stdout | 8 ++-- 52 files changed, 96 insertions(+), 202 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-lint-reasons.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-lint-reasons.stderr delete mode 100644 src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.rs delete mode 100644 src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.stderr diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 2d24101b2d59a..de5d447534059 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -188,6 +188,8 @@ declare_features! ( (accepted, item_like_imports, "1.15.0", Some(35120), None), /// Allows `if/while p && let q = r && ...` chains. (accepted, let_chains, "1.64.0", Some(53667), None), + /// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check. + (accepted, lint_reasons, "1.64.0", Some(54503), None), /// Allows `break {expr}` with a value inside `loop`s. (accepted, loop_break_value, "1.19.0", Some(37339), None), /// Allows use of `?` as the Kleene "at most one" operator in macros. diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 1018facebaed9..a9e023f40315f 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -428,8 +428,6 @@ declare_features! ( (active, let_else, "1.56.0", Some(87335), None), /// Allows `#[link(..., cfg(..))]`. (active, link_cfg, "1.14.0", Some(37406), None), - /// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check. - (active, lint_reasons, "1.31.0", Some(54503), None), /// Give access to additional metadata about declarative macro meta-variables. (active, macro_metavar_expr, "1.61.0", Some(83527), None), /// Allows `#[marker]` on certain traits allowing overlapping implementations. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index c806df8214586..635314053c8fa 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -301,9 +301,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ungated!( allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk ), - gated!( - expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk, - lint_reasons, experimental!(expect) + ungated!( + expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk ), ungated!( forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk diff --git a/compiler/rustc_lint/src/expect.rs b/compiler/rustc_lint/src/expect.rs index 699e81543188f..42c26f992ea2c 100644 --- a/compiler/rustc_lint/src/expect.rs +++ b/compiler/rustc_lint/src/expect.rs @@ -4,7 +4,6 @@ use rustc_hir::HirId; use rustc_middle::ty::query::Providers; use rustc_middle::{lint::LintExpectation, ty::TyCtxt}; use rustc_session::lint::LintExpectationId; -use rustc_span::symbol::sym; use rustc_span::Symbol; pub(crate) fn provide(providers: &mut Providers) { @@ -12,10 +11,6 @@ pub(crate) fn provide(providers: &mut Providers) { } fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option) { - if !tcx.sess.features_untracked().enabled(sym::lint_reasons) { - return; - } - let fulfilled_expectations = tcx.sess.diagnostic().steal_fulfilled_expectation_ids(); let lint_expectations = &tcx.lint_levels(()).lint_expectations; diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 00e96f20d1aaa..4a6d591d5ef32 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -17,7 +17,7 @@ use rustc_session::lint::{ builtin::{self, FORBIDDEN_LINT_GROUPS, SINGLE_USE_LIFETIMES, UNFULFILLED_LINT_EXPECTATIONS}, Level, Lint, LintExpectationId, LintId, }; -use rustc_session::parse::{add_feature_diagnostics, feature_err}; +use rustc_session::parse::add_feature_diagnostics; use rustc_session::Session; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; @@ -306,15 +306,6 @@ impl<'s> LintLevelsBuilder<'s> { ast::MetaItemKind::NameValue(ref name_value) => { if item.path == sym::reason { if let ast::LitKind::Str(rationale, _) = name_value.kind { - if !self.sess.features_untracked().lint_reasons { - feature_err( - &self.sess.parse_sess, - sym::lint_reasons, - item.span, - "lint reasons are experimental", - ) - .emit(); - } reason = Some(rationale); } else { bad_attr(name_value.span) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 39690851d1ea8..f38e415b55479 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -503,8 +503,6 @@ declare_lint! { /// ### Example /// /// ```rust - /// #![feature(lint_reasons)] - /// /// #[expect(unused_variables)] /// let x = 10; /// println!("{}", x); @@ -530,8 +528,7 @@ declare_lint! { /// [#54503]: https://github.com/rust-lang/rust/issues/54503 pub UNFULFILLED_LINT_EXPECTATIONS, Warn, - "unfulfilled lint expectation", - @feature_gate = rustc_span::sym::lint_reasons; + "unfulfilled lint expectation" } declare_lint! { diff --git a/src/test/ui/empty/empty-attributes.rs b/src/test/ui/empty/empty-attributes.rs index d319227b217a7..027d30cce17f0 100644 --- a/src/test/ui/empty/empty-attributes.rs +++ b/src/test/ui/empty/empty-attributes.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - #![deny(unused_attributes)] #![allow()] //~ ERROR unused attribute #![expect()] //~ ERROR unused attribute diff --git a/src/test/ui/empty/empty-attributes.stderr b/src/test/ui/empty/empty-attributes.stderr index 8653eaf5ccdf3..2071c00dc69d4 100644 --- a/src/test/ui/empty/empty-attributes.stderr +++ b/src/test/ui/empty/empty-attributes.stderr @@ -1,18 +1,18 @@ error: unused attribute - --> $DIR/empty-attributes.rs:11:1 + --> $DIR/empty-attributes.rs:9:1 | LL | #[repr()] | ^^^^^^^^^ help: remove this attribute | note: the lint level is defined here - --> $DIR/empty-attributes.rs:3:9 + --> $DIR/empty-attributes.rs:1:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ = note: attribute `repr` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:14:1 + --> $DIR/empty-attributes.rs:12:1 | LL | #[target_feature()] | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute @@ -20,7 +20,7 @@ LL | #[target_feature()] = note: attribute `target_feature` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:4:1 + --> $DIR/empty-attributes.rs:2:1 | LL | #![allow()] | ^^^^^^^^^^^ help: remove this attribute @@ -28,7 +28,7 @@ LL | #![allow()] = note: attribute `allow` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:5:1 + --> $DIR/empty-attributes.rs:3:1 | LL | #![expect()] | ^^^^^^^^^^^^ help: remove this attribute @@ -36,7 +36,7 @@ LL | #![expect()] = note: attribute `expect` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:6:1 + --> $DIR/empty-attributes.rs:4:1 | LL | #![warn()] | ^^^^^^^^^^ help: remove this attribute @@ -44,7 +44,7 @@ LL | #![warn()] = note: attribute `warn` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:7:1 + --> $DIR/empty-attributes.rs:5:1 | LL | #![deny()] | ^^^^^^^^^^ help: remove this attribute @@ -52,7 +52,7 @@ LL | #![deny()] = note: attribute `deny` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:8:1 + --> $DIR/empty-attributes.rs:6:1 | LL | #![forbid()] | ^^^^^^^^^^^^ help: remove this attribute @@ -60,7 +60,7 @@ LL | #![forbid()] = note: attribute `forbid` with an empty list has no effect error: unused attribute - --> $DIR/empty-attributes.rs:9:1 + --> $DIR/empty-attributes.rs:7:1 | LL | #![feature()] | ^^^^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui/feature-gates/feature-gate-lint-reasons.rs b/src/test/ui/feature-gates/feature-gate-lint-reasons.rs deleted file mode 100644 index 7756074e235a1..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-lint-reasons.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![warn(nonstandard_style, reason = "the standard should be respected")] -//~^ ERROR lint reasons are experimental -//~| ERROR lint reasons are experimental - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr b/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr deleted file mode 100644 index 12793c7a28fca..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-lint-reasons.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: lint reasons are experimental - --> $DIR/feature-gate-lint-reasons.rs:1:28 - | -LL | #![warn(nonstandard_style, reason = "the standard should be respected")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #54503 for more information - = help: add `#![feature(lint_reasons)]` to the crate attributes to enable - -error[E0658]: lint reasons are experimental - --> $DIR/feature-gate-lint-reasons.rs:1:28 - | -LL | #![warn(nonstandard_style, reason = "the standard should be respected")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #54503 for more information - = help: add `#![feature(lint_reasons)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/lint/empty-lint-attributes.rs b/src/test/ui/lint/empty-lint-attributes.rs index 9a0ec253322e4..24ee2a9478a55 100644 --- a/src/test/ui/lint/empty-lint-attributes.rs +++ b/src/test/ui/lint/empty-lint-attributes.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - // check-pass // Empty (and reason-only) lint attributes are legal—although we may want to diff --git a/src/test/ui/lint/reasons-erroneous.rs b/src/test/ui/lint/reasons-erroneous.rs index cd693ae166cde..26c9d1ec1ef35 100644 --- a/src/test/ui/lint/reasons-erroneous.rs +++ b/src/test/ui/lint/reasons-erroneous.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - #![warn(absolute_paths_not_starting_with_crate, reason = 0)] //~^ ERROR malformed lint attribute //~| ERROR malformed lint attribute diff --git a/src/test/ui/lint/reasons-erroneous.stderr b/src/test/ui/lint/reasons-erroneous.stderr index 5521af17c8412..a9ec21b6aba7f 100644 --- a/src/test/ui/lint/reasons-erroneous.stderr +++ b/src/test/ui/lint/reasons-erroneous.stderr @@ -1,125 +1,125 @@ error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:3:58 + --> $DIR/reasons-erroneous.rs:1:58 | LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] | ^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:8:40 + --> $DIR/reasons-erroneous.rs:6:40 | LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 + --> $DIR/reasons-erroneous.rs:11:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 + --> $DIR/reasons-erroneous.rs:11:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 + --> $DIR/reasons-erroneous.rs:20:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 + --> $DIR/reasons-erroneous.rs:20:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 + --> $DIR/reasons-erroneous.rs:29:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 + --> $DIR/reasons-erroneous.rs:29:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:40:44 + --> $DIR/reasons-erroneous.rs:38:44 | LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:45:25 + --> $DIR/reasons-erroneous.rs:43:25 | LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:3:58 + --> $DIR/reasons-erroneous.rs:1:58 | LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] | ^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:8:40 + --> $DIR/reasons-erroneous.rs:6:40 | LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 + --> $DIR/reasons-erroneous.rs:11:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 + --> $DIR/reasons-erroneous.rs:11:29 | LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 + --> $DIR/reasons-erroneous.rs:20:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 + --> $DIR/reasons-erroneous.rs:20:23 | LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 + --> $DIR/reasons-erroneous.rs:29:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 + --> $DIR/reasons-erroneous.rs:29:36 | LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:40:44 + --> $DIR/reasons-erroneous.rs:38:44 | LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:45:25 + --> $DIR/reasons-erroneous.rs:43:25 | LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last warning: unknown lint: `reason` - --> $DIR/reasons-erroneous.rs:50:39 + --> $DIR/reasons-erroneous.rs:48:39 | LL | #![warn(missing_copy_implementations, reason)] | ^^^^^^ diff --git a/src/test/ui/lint/reasons-forbidden.rs b/src/test/ui/lint/reasons-forbidden.rs index 9c2edec4d5214..e082a5b30f5a2 100644 --- a/src/test/ui/lint/reasons-forbidden.rs +++ b/src/test/ui/lint/reasons-forbidden.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - // If you turn off deduplicate diagnostics (which rustc turns on by default but // compiletest turns off when it runs ui tests), then the errors are // (unfortunately) repeated here because the checking is done as we read in the diff --git a/src/test/ui/lint/reasons-forbidden.stderr b/src/test/ui/lint/reasons-forbidden.stderr index ab6f19a019d43..cecc83450796c 100644 --- a/src/test/ui/lint/reasons-forbidden.stderr +++ b/src/test/ui/lint/reasons-forbidden.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(unsafe_code) incompatible with previous forbid - --> $DIR/reasons-forbidden.rs:25:13 + --> $DIR/reasons-forbidden.rs:23:13 | LL | unsafe_code, | ----------- `forbid` level set here @@ -10,7 +10,7 @@ LL | #[allow(unsafe_code)] = note: our errors & omissions insurance policy doesn't cover unsafe Rust error: usage of an `unsafe` block - --> $DIR/reasons-forbidden.rs:29:5 + --> $DIR/reasons-forbidden.rs:27:5 | LL | / unsafe { LL | | @@ -21,7 +21,7 @@ LL | | } | = note: our errors & omissions insurance policy doesn't cover unsafe Rust note: the lint level is defined here - --> $DIR/reasons-forbidden.rs:14:5 + --> $DIR/reasons-forbidden.rs:12:5 | LL | unsafe_code, | ^^^^^^^^^^^ diff --git a/src/test/ui/lint/reasons.rs b/src/test/ui/lint/reasons.rs index da1c740c4a344..34ed26e9748e1 100644 --- a/src/test/ui/lint/reasons.rs +++ b/src/test/ui/lint/reasons.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(lint_reasons)] #![warn(elided_lifetimes_in_paths, //~^ NOTE the lint level is defined here reason = "explicit anonymous lifetimes aid reasoning about ownership")] diff --git a/src/test/ui/lint/reasons.stderr b/src/test/ui/lint/reasons.stderr index cd8412153f101..8028785ab94be 100644 --- a/src/test/ui/lint/reasons.stderr +++ b/src/test/ui/lint/reasons.stderr @@ -1,5 +1,5 @@ warning: hidden lifetime parameters in types are deprecated - --> $DIR/reasons.rs:20:34 + --> $DIR/reasons.rs:19:34 | LL | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | -----^^^^^^^^^ @@ -8,7 +8,7 @@ LL | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | = note: explicit anonymous lifetimes aid reasoning about ownership note: the lint level is defined here - --> $DIR/reasons.rs:4:9 + --> $DIR/reasons.rs:3:9 | LL | #![warn(elided_lifetimes_in_paths, | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { | ++++ warning: variable `Social_exchange_psychology` should have a snake case name - --> $DIR/reasons.rs:30:9 + --> $DIR/reasons.rs:29:9 | LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case (notice the capitalization): `social_exchange_psychology` @@ -26,7 +26,7 @@ LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; = note: people shouldn't have to change their usual style habits to contribute to our project note: the lint level is defined here - --> $DIR/reasons.rs:8:5 + --> $DIR/reasons.rs:7:5 | LL | nonstandard_style, | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/avoid_delayed_good_path_ice.rs b/src/test/ui/lint/rfc-2383-lint-reason/avoid_delayed_good_path_ice.rs index 912e831d88a7d..8cec27581a145 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/avoid_delayed_good_path_ice.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/avoid_delayed_good_path_ice.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(lint_reasons)] #[expect(drop_bounds)] fn trigger_rustc_lints() { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/catch_multiple_lint_triggers.rs b/src/test/ui/lint/rfc-2383-lint-reason/catch_multiple_lint_triggers.rs index 6b255b799b7ec..3ffe519de217e 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/catch_multiple_lint_triggers.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/catch_multiple_lint_triggers.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - #![warn(unused)] // This expect attribute should catch all lint triggers diff --git a/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.rs b/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.rs index 9f591ba985232..41f5e4a9780e5 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - #![warn(unused)] #![expect(unused_mut)] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.stderr b/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.stderr index 7237f6fb6bba0..90a2c54b5822b 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/crate_level_expect.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/crate_level_expect.rs:7:11 + --> $DIR/crate_level_expect.rs:5:11 | LL | #![expect(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_inside_macro.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_inside_macro.rs index b95815bc50b98..d8514b58426fa 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_inside_macro.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_inside_macro.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - #![warn(unused)] macro_rules! expect_inside_macro { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs index 07c60fa0c325b..8286a3cf9b242 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - #![warn(unused_variables)] macro_rules! trigger_unused_variables_macro { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr index 817e16fdcaa06..49dba1c7ffe8c 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr @@ -1,5 +1,5 @@ warning: unused variable: `x` - --> $DIR/expect_lint_from_macro.rs:9:13 + --> $DIR/expect_lint_from_macro.rs:7:13 | LL | let x = 0; | ^ help: if this is intentional, prefix it with an underscore: `_x` @@ -8,14 +8,14 @@ LL | trigger_unused_variables_macro!(); | --------------------------------- in this macro invocation | note: the lint level is defined here - --> $DIR/expect_lint_from_macro.rs:5:9 + --> $DIR/expect_lint_from_macro.rs:3:9 | LL | #![warn(unused_variables)] | ^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unused variable: `x` - --> $DIR/expect_lint_from_macro.rs:9:13 + --> $DIR/expect_lint_from_macro.rs:7:13 | LL | let x = 0; | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.rs deleted file mode 100644 index 928e161061432..0000000000000 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.rs +++ /dev/null @@ -1,9 +0,0 @@ -// should error due to missing feature gate. - -#![warn(unused)] - -#[expect(unused)] -//~^ ERROR: the `#[expect]` attribute is an experimental feature [E0658] -fn main() { - let x = 1; -} diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.stderr deleted file mode 100644 index b5601cf9e6594..0000000000000 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_missing_feature_gate.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[expect]` attribute is an experimental feature - --> $DIR/expect_missing_feature_gate.rs:5:1 - | -LL | #[expect(unused)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #54503 for more information - = help: add `#![feature(lint_reasons)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.rs index dc9a719a3f7e7..ba0d56a16e0ea 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - #![warn(unused)] // The warnings are not double triggers, they identify different unfulfilled lint diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.stderr index 90ee744b26b01..c551c55fbeda2 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:10:28 + --> $DIR/expect_multiple_lints.rs:8:28 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^ @@ -7,43 +7,43 @@ LL | #[expect(unused_variables, unused_mut, while_true)] = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:10:40 + --> $DIR/expect_multiple_lints.rs:8:40 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:19:10 + --> $DIR/expect_multiple_lints.rs:17:10 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:19:40 + --> $DIR/expect_multiple_lints.rs:17:40 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:28:10 + --> $DIR/expect_multiple_lints.rs:26:10 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:28:28 + --> $DIR/expect_multiple_lints.rs:26:28 | LL | #[expect(unused_variables, unused_mut, while_true)] | ^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:36:18 + --> $DIR/expect_multiple_lints.rs:34:18 | LL | #[expect(unused, while_true)] | ^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_multiple_lints.rs:45:10 + --> $DIR/expect_multiple_lints.rs:43:10 | LL | #[expect(unused, while_true)] | ^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.rs index 8f94bd6ec6cb8..1d365363ceb68 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.rs @@ -1,6 +1,5 @@ // ignore-tidy-linelength -#![feature(lint_reasons)] #![warn(unused_mut)] #[expect( diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr index 370e51bf70a7a..b1be19bc7d121 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr @@ -1,17 +1,17 @@ error: unused variable: `this_is_my_function` - --> $DIR/expect_nested_lint_levels.rs:48:9 + --> $DIR/expect_nested_lint_levels.rs:47:9 | LL | let this_is_my_function = 3; | ^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_is_my_function` | note: the lint level is defined here - --> $DIR/expect_nested_lint_levels.rs:45:10 + --> $DIR/expect_nested_lint_levels.rs:44:10 | LL | #[forbid(unused_variables)] | ^^^^^^^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/expect_nested_lint_levels.rs:36:13 + --> $DIR/expect_nested_lint_levels.rs:35:13 | LL | let mut v = 0; | ----^ @@ -20,13 +20,13 @@ LL | let mut v = 0; | = note: this overrides the previous `expect` lint level and warns about the `unused_mut` lint here note: the lint level is defined here - --> $DIR/expect_nested_lint_levels.rs:31:9 + --> $DIR/expect_nested_lint_levels.rs:30:9 | LL | unused_mut, | ^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect_nested_lint_levels.rs:7:5 + --> $DIR/expect_nested_lint_levels.rs:6:5 | LL | unused_mut, | ^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | unused_mut, = note: this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered warning: this lint expectation is unfulfilled - --> $DIR/expect_nested_lint_levels.rs:24:5 + --> $DIR/expect_nested_lint_levels.rs:23:5 | LL | unused_mut, | ^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | unused_mut, = note: this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered warning: this lint expectation is unfulfilled - --> $DIR/expect_nested_lint_levels.rs:43:10 + --> $DIR/expect_nested_lint_levels.rs:42:10 | LL | #[expect(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs index 5fdb710416f04..01c99fad409d3 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(lint_reasons)] #[warn(unused_variables)] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.stderr index 69f7cda08ef0b..14e78ddd305e9 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect_on_fn_params.rs:9:43 + --> $DIR/expect_on_fn_params.rs:8:43 | LL | fn check_unfulfilled_expectation(#[expect(unused_variables)] used_value: u32) { | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.rs index f80fe88cbb97e..9bb05766c0658 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(lint_reasons)] //! This file tests the `#[expect]` attribute implementation for tool lints. The same //! file is used to test clippy and rustdoc. Any changes to this file should be synced diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.stderr index 6d49e7543dc59..4031cc04e9fcf 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_tool_lint_rfc_2383.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect_tool_lint_rfc_2383.rs:37:14 + --> $DIR/expect_tool_lint_rfc_2383.rs:36:14 | LL | #[expect(dead_code)] | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[expect(dead_code)] = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled - --> $DIR/expect_tool_lint_rfc_2383.rs:43:18 + --> $DIR/expect_tool_lint_rfc_2383.rs:42:18 | LL | #[expect(illegal_floating_point_literal_pattern)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.rs index d38e65533869a..4e334231aa859 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.rs @@ -1,7 +1,6 @@ // check-pass // ignore-tidy-linelength -#![feature(lint_reasons)] #![warn(unused_mut)] #![expect(unfulfilled_lint_expectations, reason = "idk why you would expect this")] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr index 9bfee79b03d70..57b704f6f43dd 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect_unfulfilled_expectation.rs:7:11 + --> $DIR/expect_unfulfilled_expectation.rs:6:11 | LL | #![expect(unfulfilled_lint_expectations, reason = "idk why you would expect this")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | #![expect(unfulfilled_lint_expectations, reason = "idk why you would expect = note: the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message warning: this lint expectation is unfulfilled - --> $DIR/expect_unfulfilled_expectation.rs:13:10 + --> $DIR/expect_unfulfilled_expectation.rs:12:10 | LL | #[expect(unfulfilled_lint_expectations, reason = "a local: idk why you would expect this")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | #[expect(unfulfilled_lint_expectations, reason = "a local: idk why you woul = note: the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message warning: this lint expectation is unfulfilled - --> $DIR/expect_unfulfilled_expectation.rs:18:14 + --> $DIR/expect_unfulfilled_expectation.rs:17:14 | LL | #[expect(unused_mut, reason = "this expectation will create a diagnostic with the default lint level")] | ^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | #[expect(unused_mut, reason = "this expectation will create a diagnosti = note: this expectation will create a diagnostic with the default lint level warning: this lint expectation is unfulfilled - --> $DIR/expect_unfulfilled_expectation.rs:25:22 + --> $DIR/expect_unfulfilled_expectation.rs:24:22 | LL | #[expect(unused, unfulfilled_lint_expectations, reason = "the expectation for `unused` should be fulfilled")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs index 479ee198e1743..c3e7720df3646 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - #[forbid(unused_variables)] //~^ NOTE `forbid` level set here //~| NOTE `forbid` level set here diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr index a8116e93404f2..10de222c0a20d 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr @@ -1,5 +1,5 @@ error[E0453]: expect(unused_variables) incompatible with previous forbid - --> $DIR/expect_with_forbid.rs:6:10 + --> $DIR/expect_with_forbid.rs:4:10 | LL | #[forbid(unused_variables)] | ---------------- `forbid` level set here @@ -8,7 +8,7 @@ LL | #[expect(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: expect(while_true) incompatible with previous forbid - --> $DIR/expect_with_forbid.rs:17:10 + --> $DIR/expect_with_forbid.rs:15:10 | LL | #[forbid(while_true)] | ---------- `forbid` level set here @@ -17,7 +17,7 @@ LL | #[expect(while_true)] | ^^^^^^^^^^ overruled by previous forbid error[E0453]: expect(unused_variables) incompatible with previous forbid - --> $DIR/expect_with_forbid.rs:6:10 + --> $DIR/expect_with_forbid.rs:4:10 | LL | #[forbid(unused_variables)] | ---------------- `forbid` level set here @@ -26,7 +26,7 @@ LL | #[expect(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: expect(while_true) incompatible with previous forbid - --> $DIR/expect_with_forbid.rs:17:10 + --> $DIR/expect_with_forbid.rs:15:10 | LL | #[forbid(while_true)] | ---------- `forbid` level set here @@ -35,13 +35,13 @@ LL | #[expect(while_true)] | ^^^^^^^^^^ overruled by previous forbid error: denote infinite loops with `loop { ... }` - --> $DIR/expect_with_forbid.rs:26:5 + --> $DIR/expect_with_forbid.rs:24:5 | LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: the lint level is defined here - --> $DIR/expect_with_forbid.rs:13:10 + --> $DIR/expect_with_forbid.rs:11:10 | LL | #[forbid(while_true)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.rs b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.rs index b4183d982118e..40c63907218a2 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(lint_reasons)] #![warn(unused)] #![expect(unused_variables, reason = "")] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr index 82c1a4c08bb39..4ab87b08f58f2 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect_with_reason.rs:6:11 + --> $DIR/expect_with_reason.rs:5:11 | LL | #![expect(unused_variables, reason = "")] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs index a3c3933d70038..80325ec63123f 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs @@ -3,8 +3,6 @@ // compile-flags: --force-warn unused_mut // check-pass -#![feature(lint_reasons)] - fn expect_early_pass_lint() { #[expect(while_true)] while true { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr index 06befcbb5117e..d7f4ec55f0ee0 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr @@ -1,5 +1,5 @@ warning: denote infinite loops with `loop { ... }` - --> $DIR/force_warn_expected_lints_fulfilled.rs:10:5 + --> $DIR/force_warn_expected_lints_fulfilled.rs:8:5 | LL | while true { | ^^^^^^^^^^ help: use `loop` @@ -7,7 +7,7 @@ LL | while true { = note: requested on the command line with `--force-warn while-true` warning: unused variable: `x` - --> $DIR/force_warn_expected_lints_fulfilled.rs:20:9 + --> $DIR/force_warn_expected_lints_fulfilled.rs:18:9 | LL | let x = 2; | ^ help: if this is intentional, prefix it with an underscore: `_x` @@ -15,19 +15,19 @@ LL | let x = 2; = note: requested on the command line with `--force-warn unused-variables` warning: unused variable: `fox_name` - --> $DIR/force_warn_expected_lints_fulfilled.rs:28:9 + --> $DIR/force_warn_expected_lints_fulfilled.rs:26:9 | LL | let fox_name = "Sir Nibbles"; | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_fox_name` warning: unused variable: `this_should_fulfill_the_expectation` - --> $DIR/force_warn_expected_lints_fulfilled.rs:43:9 + --> $DIR/force_warn_expected_lints_fulfilled.rs:41:9 | LL | let this_should_fulfill_the_expectation = "The `#[allow]` has no power here"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_should_fulfill_the_expectation` warning: variable does not need to be mutable - --> $DIR/force_warn_expected_lints_fulfilled.rs:32:9 + --> $DIR/force_warn_expected_lints_fulfilled.rs:30:9 | LL | let mut what_does_the_fox_say = "*ding* *deng* *dung*"; | ----^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.rs b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.rs index 080e300232b03..a6999484a47b9 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.rs @@ -3,8 +3,6 @@ // compile-flags: --force-warn unused_mut // check-pass -#![feature(lint_reasons)] - fn expect_early_pass_lint(terminate: bool) { #[expect(while_true)] //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr index c74fabe27dc87..f5e66694b8eaa 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.stderr @@ -1,5 +1,5 @@ warning: unused variable: `this_should_not_fulfill_the_expectation` - --> $DIR/force_warn_expected_lints_unfulfilled.rs:40:9 + --> $DIR/force_warn_expected_lints_unfulfilled.rs:38:9 | LL | let this_should_not_fulfill_the_expectation = "maybe"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_should_not_fulfill_the_expectation` @@ -7,7 +7,7 @@ LL | let this_should_not_fulfill_the_expectation = "maybe"; = note: requested on the command line with `--force-warn unused-variables` warning: this lint expectation is unfulfilled - --> $DIR/force_warn_expected_lints_unfulfilled.rs:9:14 + --> $DIR/force_warn_expected_lints_unfulfilled.rs:7:14 | LL | #[expect(while_true)] | ^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[expect(while_true)] = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled - --> $DIR/force_warn_expected_lints_unfulfilled.rs:17:10 + --> $DIR/force_warn_expected_lints_unfulfilled.rs:15:10 | LL | #[expect(unused_variables, reason="")] | ^^^^^^^^^^^^^^^^ @@ -23,13 +23,13 @@ LL | #[expect(unused_variables, reason=" warning: this lint expectation is unfulfilled - --> $DIR/force_warn_expected_lints_unfulfilled.rs:24:10 + --> $DIR/force_warn_expected_lints_unfulfilled.rs:22:10 | LL | #[expect(unused)] | ^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/force_warn_expected_lints_unfulfilled.rs:36:10 + --> $DIR/force_warn_expected_lints_unfulfilled.rs:34:10 | LL | #[expect(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_early_lints.rs b/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_early_lints.rs index 6624b930e5e70..79238690fc94b 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_early_lints.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_early_lints.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(lint_reasons)] - fn expect_early_pass_lints() { #[expect(while_true)] while true { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_late_lints.rs b/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_late_lints.rs index 5d928b3cab3fe..e372c6ae81384 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_late_lints.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/fulfilled_expectation_late_lints.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(lint_reasons)] #![warn(unused)] #[expect(unused_variables)] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.rs b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.rs index bafdea96e08df..a7767769344a2 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - #![deny(unused_attributes)] #[allow(reason = "I want to allow something")]//~ ERROR unused attribute diff --git a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr index 3bf8137dc6e40..90529fa9416d9 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr @@ -1,18 +1,18 @@ error: unused attribute - --> $DIR/lint-attribute-only-with-reason.rs:5:1 + --> $DIR/lint-attribute-only-with-reason.rs:3:1 | LL | #[allow(reason = "I want to allow something")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: the lint level is defined here - --> $DIR/lint-attribute-only-with-reason.rs:3:9 + --> $DIR/lint-attribute-only-with-reason.rs:1:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ = note: attribute `allow` without any lints has no effect error: unused attribute - --> $DIR/lint-attribute-only-with-reason.rs:6:1 + --> $DIR/lint-attribute-only-with-reason.rs:4:1 | LL | #[expect(reason = "I don't know what I'm waiting for")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute @@ -20,7 +20,7 @@ LL | #[expect(reason = "I don't know what I'm waiting for")] = note: attribute `expect` without any lints has no effect error: unused attribute - --> $DIR/lint-attribute-only-with-reason.rs:7:1 + --> $DIR/lint-attribute-only-with-reason.rs:5:1 | LL | #[warn(reason = "This should be warn by default")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute @@ -28,7 +28,7 @@ LL | #[warn(reason = "This should be warn by default")] = note: attribute `warn` without any lints has no effect error: unused attribute - --> $DIR/lint-attribute-only-with-reason.rs:8:1 + --> $DIR/lint-attribute-only-with-reason.rs:6:1 | LL | #[deny(reason = "All listed lints are denied")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute @@ -36,7 +36,7 @@ LL | #[deny(reason = "All listed lints are denied")] = note: attribute `deny` without any lints has no effect error: unused attribute - --> $DIR/lint-attribute-only-with-reason.rs:9:1 + --> $DIR/lint-attribute-only-with-reason.rs:7:1 | LL | #[forbid(reason = "Just some reason")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute diff --git a/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.rs b/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.rs index 98080b4e8224f..0553762fbce6a 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(lint_reasons)] #![warn(unused)] #[warn(unused_variables)] diff --git a/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.stderr b/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.stderr index df7d6584f99dd..31042c4bb6dce 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/multiple_expect_attrs.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/multiple_expect_attrs.rs:7:10 + --> $DIR/multiple_expect_attrs.rs:6:10 | LL | #[expect(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs b/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs index 2b6c3c6a1fdf6..eb1dfea23c1e9 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs +++ b/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.rs @@ -2,8 +2,6 @@ // check-pass // compile-flags: -Z unpretty=expanded -#![feature(lint_reasons)] - // This `expect` will create an expectation with an unstable expectation id #[expect(while_true)] fn create_early_lint_pass_expectation() { diff --git a/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.stdout b/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.stdout index 0ee3a03c38847..3ea78d59b4615 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.stdout +++ b/src/test/ui/lint/rfc-2383-lint-reason/no_ice_for_partial_compiler_runs.stdout @@ -1,14 +1,12 @@ #![feature(prelude_import)] #![no_std] -// This ensures that ICEs like rust#94953 don't happen -// check-pass -// compile-flags: -Z unpretty=expanded - -#![feature(lint_reasons)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; +// This ensures that ICEs like rust#94953 don't happen +// check-pass +// compile-flags: -Z unpretty=expanded // This `expect` will create an expectation with an unstable expectation id #[expect(while_true)] From 28523815ba680482d376fc20420136194d066a94 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Fri, 8 Jul 2022 20:56:47 +0200 Subject: [PATCH 2/6] Stabilize `lint_reasons` in rustdoc (RFC 2383) --- src/test/rustdoc-ui/expect-tool-lint-rfc-2383.rs | 1 - src/test/rustdoc-ui/expect-tool-lint-rfc-2383.stderr | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.rs b/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.rs index 0901ac3640fdd..52dc14adce323 100644 --- a/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.rs +++ b/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(lint_reasons)] //! This file tests the `#[expect]` attribute implementation for tool lints. The same //! file is used to test clippy and rustdoc. Any changes to this file should be synced diff --git a/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.stderr b/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.stderr index efc5f349f4f44..b319cc5d39b50 100644 --- a/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.stderr +++ b/src/test/rustdoc-ui/expect-tool-lint-rfc-2383.stderr @@ -1,5 +1,5 @@ warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:16:11 + --> $DIR/expect-tool-lint-rfc-2383.rs:15:11 | LL | #![expect(rustdoc::missing_crate_level_docs)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,19 +7,19 @@ LL | #![expect(rustdoc::missing_crate_level_docs)] = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:71:14 + --> $DIR/expect-tool-lint-rfc-2383.rs:70:14 | LL | #[expect(rustdoc::broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:76:14 + --> $DIR/expect-tool-lint-rfc-2383.rs:75:14 | LL | #[expect(rustdoc::invalid_html_tags)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: this lint expectation is unfulfilled - --> $DIR/expect-tool-lint-rfc-2383.rs:81:14 + --> $DIR/expect-tool-lint-rfc-2383.rs:80:14 | LL | #[expect(rustdoc::bare_urls)] | ^^^^^^^^^^^^^^^^^^ From 2755f1dadb1ad70d0af9de266f8dd0cba35712ae Mon Sep 17 00:00:00 2001 From: xFrednet Date: Fri, 8 Jul 2022 21:07:30 +0200 Subject: [PATCH 3/6] Stabilize `lint_reasons` in Clippy (RFC 2383) --- src/tools/clippy/CHANGELOG.md | 2 +- src/tools/clippy/clippy_lints/src/attrs.rs | 11 +-- src/tools/clippy/clippy_lints/src/lib.rs | 2 +- src/tools/clippy/clippy_utils/src/lib.rs | 2 +- .../ui-cargo/duplicate_mod/fail/src/main.rs | 2 - .../duplicate_mod/fail/src/main.stderr | 8 +- .../ui/allow_attributes_without_reason.rs | 1 - .../ui/allow_attributes_without_reason.stderr | 6 +- .../clippy/tests/ui/async_yields_async.fixed | 1 - .../clippy/tests/ui/async_yields_async.rs | 1 - .../clippy/tests/ui/async_yields_async.stderr | 12 +-- src/tools/clippy/tests/ui/boxed_local.rs | 1 - src/tools/clippy/tests/ui/boxed_local.stderr | 8 +- .../ui/checked_unwrap/simple_conditionals.rs | 1 - .../checked_unwrap/simple_conditionals.stderr | 38 +++++----- .../ui/default_numeric_fallback_i32.fixed | 1 - .../tests/ui/default_numeric_fallback_i32.rs | 1 - .../ui/default_numeric_fallback_i32.stderr | 50 ++++++------- .../tests/ui/expect_tool_lint_rfc_2383.rs | 2 +- .../clippy/tests/ui/implicit_return.fixed | 1 - src/tools/clippy/tests/ui/implicit_return.rs | 1 - .../clippy/tests/ui/implicit_return.stderr | 32 ++++---- src/tools/clippy/tests/ui/logic_bug.rs | 1 - src/tools/clippy/tests/ui/logic_bug.stderr | 20 ++--- .../clippy/tests/ui/macro_use_imports.fixed | 1 - .../clippy/tests/ui/macro_use_imports.rs | 1 - .../clippy/tests/ui/macro_use_imports.stderr | 16 ++-- .../tests/ui/macro_use_imports_expect.rs | 1 - .../tests/ui/manual_non_exhaustive_enum.rs | 1 - .../ui/manual_non_exhaustive_enum.stderr | 8 +- .../clippy/tests/ui/needless_borrow.fixed | 2 - src/tools/clippy/tests/ui/needless_borrow.rs | 2 - .../clippy/tests/ui/needless_borrow.stderr | 40 +++++----- .../clippy/tests/ui/needless_return.fixed | 1 - src/tools/clippy/tests/ui/needless_return.rs | 1 - .../clippy/tests/ui/needless_return.stderr | 74 +++++++++---------- src/tools/clippy/tests/ui/nonminimal_bool.rs | 1 - .../clippy/tests/ui/nonminimal_bool.stderr | 24 +++--- src/tools/clippy/tests/ui/ptr_arg.rs | 1 - src/tools/clippy/tests/ui/ptr_arg.stderr | 34 ++++----- .../clippy/tests/ui/redundant_clone.fixed | 1 - src/tools/clippy/tests/ui/redundant_clone.rs | 1 - .../clippy/tests/ui/redundant_clone.stderr | 60 +++++++-------- .../tests/ui/ref_binding_to_reference.rs | 1 - .../tests/ui/ref_binding_to_reference.stderr | 14 ++-- src/tools/clippy/tests/ui/same_name_method.rs | 1 - .../clippy/tests/ui/same_name_method.stderr | 20 ++--- 47 files changed, 238 insertions(+), 273 deletions(-) diff --git a/src/tools/clippy/CHANGELOG.md b/src/tools/clippy/CHANGELOG.md index 920d397add716..a96aa4103400c 100644 --- a/src/tools/clippy/CHANGELOG.md +++ b/src/tools/clippy/CHANGELOG.md @@ -183,7 +183,7 @@ Released 2022-05-19 [#8218](https://github.com/rust-lang/rust-clippy/pull/8218) * [`needless_match`] [#8471](https://github.com/rust-lang/rust-clippy/pull/8471) -* [`allow_attributes_without_reason`] (Requires `#![feature(lint_reasons)]`) +* [`allow_attributes_without_reason`] [#8504](https://github.com/rust-lang/rust-clippy/pull/8504) * [`print_in_format_impl`] [#8253](https://github.com/rust-lang/rust-clippy/pull/8253) diff --git a/src/tools/clippy/clippy_lints/src/attrs.rs b/src/tools/clippy/clippy_lints/src/attrs.rs index 4bcbeacf9feb5..5f7c6503fc9ad 100644 --- a/src/tools/clippy/clippy_lints/src/attrs.rs +++ b/src/tools/clippy/clippy_lints/src/attrs.rs @@ -269,22 +269,20 @@ declare_clippy_lint! { /// ### What it does /// Checks for attributes that allow lints without a reason. /// - /// (This requires the `lint_reasons` feature) - /// /// ### Why is this bad? /// Allowing a lint should always have a reason. This reason should be documented to /// ensure that others understand the reasoning /// /// ### Example /// ```rust - /// #![feature(lint_reasons)] + /// # #![cfg_attr(bootstrap, feature(lint_reasons))] /// /// #![allow(clippy::some_lint)] /// ``` /// /// Use instead: /// ```rust - /// #![feature(lint_reasons)] + /// # #![cfg_attr(bootstrap, feature(lint_reasons))] /// /// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")] /// ``` @@ -450,11 +448,6 @@ fn check_clippy_lint_names(cx: &LateContext<'_>, name: Symbol, items: &[NestedMe } fn check_lint_reason(cx: &LateContext<'_>, name: Symbol, items: &[NestedMetaItem], attr: &'_ Attribute) { - // Check for the feature - if !cx.tcx.sess.features_untracked().lint_reasons { - return; - } - // Check if the reason is present if let Some(item) = items.last().and_then(NestedMetaItem::meta_item) && let MetaItemKind::NameValue(_) = &item.kind diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 1988c24578e0b..65da64fa8ac2a 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -6,7 +6,7 @@ #![feature(iter_intersperse)] #![cfg_attr(bootstrap, feature(let_chains))] #![feature(let_else)] -#![feature(lint_reasons)] +#![cfg_attr(bootstrap, feature(lint_reasons))] #![feature(never_type)] #![feature(once_cell)] #![feature(rustc_private)] diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 2fdda9fac1629..13ca9a0aa48ce 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -2,7 +2,7 @@ #![feature(control_flow_enum)] #![feature(let_else)] #![cfg_attr(bootstrap, feature(let_chains))] -#![feature(lint_reasons)] +#![cfg_attr(bootstrap, feature(lint_reasons))] #![feature(once_cell)] #![feature(rustc_private)] #![recursion_limit = "512"] diff --git a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs index 6478e65ac81ad..9cbe4b83b25e0 100644 --- a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs +++ b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs @@ -1,5 +1,3 @@ -#![feature(lint_reasons)] - mod a; mod b; diff --git a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.stderr b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.stderr index b450a2b18f257..62dded83999ca 100644 --- a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.stderr +++ b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.stderr @@ -1,5 +1,5 @@ error: file is loaded as a module multiple times: `$DIR/b.rs` - --> $DIR/main.rs:5:1 + --> $DIR/main.rs:3:1 | LL | mod b; | ^^^^^^ first loaded here @@ -11,7 +11,7 @@ LL | | mod b2; = help: replace all but one `mod` item with `use` items error: file is loaded as a module multiple times: `$DIR/c.rs` - --> $DIR/main.rs:9:1 + --> $DIR/main.rs:7:1 | LL | mod c; | ^^^^^^ first loaded here @@ -25,7 +25,7 @@ LL | | mod c3; = help: replace all but one `mod` item with `use` items error: file is loaded as a module multiple times: `$DIR/d.rs` - --> $DIR/main.rs:18:1 + --> $DIR/main.rs:16:1 | LL | mod d; | ^^^^^^ first loaded here @@ -36,7 +36,7 @@ LL | | mod d2; = help: replace all but one `mod` item with `use` items error: file is loaded as a module multiple times: `$DIR/from_other_module.rs` - --> $DIR/main.rs:15:1 + --> $DIR/main.rs:13:1 | LL | mod from_other_module; | ^^^^^^^^^^^^^^^^^^^^^^ first loaded here diff --git a/src/tools/clippy/tests/ui/allow_attributes_without_reason.rs b/src/tools/clippy/tests/ui/allow_attributes_without_reason.rs index 1a0d4e886576e..505e724534dd8 100644 --- a/src/tools/clippy/tests/ui/allow_attributes_without_reason.rs +++ b/src/tools/clippy/tests/ui/allow_attributes_without_reason.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![deny(clippy::allow_attributes_without_reason)] // These should trigger the lint diff --git a/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr b/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr index cd040a144aaca..4c0b24dd162a6 100644 --- a/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr +++ b/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr @@ -1,18 +1,18 @@ error: `allow` attribute without specifying a reason - --> $DIR/allow_attributes_without_reason.rs:5:1 + --> $DIR/allow_attributes_without_reason.rs:4:1 | LL | #[allow(dead_code)] | ^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/allow_attributes_without_reason.rs:2:9 + --> $DIR/allow_attributes_without_reason.rs:1:9 | LL | #![deny(clippy::allow_attributes_without_reason)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: try adding a reason at the end with `, reason = ".."` error: `allow` attribute without specifying a reason - --> $DIR/allow_attributes_without_reason.rs:6:1 + --> $DIR/allow_attributes_without_reason.rs:5:1 | LL | #[allow(dead_code, deprecated)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/async_yields_async.fixed b/src/tools/clippy/tests/ui/async_yields_async.fixed index 3cf380d2b954b..6c3befdc8abcc 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.fixed +++ b/src/tools/clippy/tests/ui/async_yields_async.fixed @@ -1,5 +1,4 @@ // run-rustfix -#![feature(lint_reasons)] #![feature(async_closure)] #![warn(clippy::async_yields_async)] diff --git a/src/tools/clippy/tests/ui/async_yields_async.rs b/src/tools/clippy/tests/ui/async_yields_async.rs index dd4131b60ab3a..7a532b9297da8 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.rs +++ b/src/tools/clippy/tests/ui/async_yields_async.rs @@ -1,5 +1,4 @@ // run-rustfix -#![feature(lint_reasons)] #![feature(async_closure)] #![warn(clippy::async_yields_async)] diff --git a/src/tools/clippy/tests/ui/async_yields_async.stderr b/src/tools/clippy/tests/ui/async_yields_async.stderr index b0c4215e7ddf1..20178e015c36b 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.stderr +++ b/src/tools/clippy/tests/ui/async_yields_async.stderr @@ -1,5 +1,5 @@ error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:39:9 + --> $DIR/async_yields_async.rs:38:9 | LL | let _h = async { | ____________________- @@ -20,7 +20,7 @@ LL + }.await | error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:44:9 + --> $DIR/async_yields_async.rs:43:9 | LL | let _i = async { | ____________________- @@ -33,7 +33,7 @@ LL | | }; | |_____- outer async construct error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:50:9 + --> $DIR/async_yields_async.rs:49:9 | LL | let _j = async || { | _______________________- @@ -53,7 +53,7 @@ LL + }.await | error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:55:9 + --> $DIR/async_yields_async.rs:54:9 | LL | let _k = async || { | _______________________- @@ -66,7 +66,7 @@ LL | | }; | |_____- outer async construct error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:57:23 + --> $DIR/async_yields_async.rs:56:23 | LL | let _l = async || CustomFutureType; | ^^^^^^^^^^^^^^^^ @@ -76,7 +76,7 @@ LL | let _l = async || CustomFutureType; | help: consider awaiting this value: `CustomFutureType.await` error: an async construct yields a type which is itself awaitable - --> $DIR/async_yields_async.rs:63:9 + --> $DIR/async_yields_async.rs:62:9 | LL | let _m = async || { | _______________________- diff --git a/src/tools/clippy/tests/ui/boxed_local.rs b/src/tools/clippy/tests/ui/boxed_local.rs index 4639f00a8d830..41ad5cd8da25b 100644 --- a/src/tools/clippy/tests/ui/boxed_local.rs +++ b/src/tools/clippy/tests/ui/boxed_local.rs @@ -1,5 +1,4 @@ #![feature(box_syntax)] -#![feature(lint_reasons)] #![allow( clippy::borrowed_box, clippy::needless_pass_by_value, diff --git a/src/tools/clippy/tests/ui/boxed_local.stderr b/src/tools/clippy/tests/ui/boxed_local.stderr index 9036529f39c51..0fbad913f27f1 100644 --- a/src/tools/clippy/tests/ui/boxed_local.stderr +++ b/src/tools/clippy/tests/ui/boxed_local.stderr @@ -1,5 +1,5 @@ error: local variable doesn't need to be boxed here - --> $DIR/boxed_local.rs:41:13 + --> $DIR/boxed_local.rs:40:13 | LL | fn warn_arg(x: Box) { | ^ @@ -7,19 +7,19 @@ LL | fn warn_arg(x: Box) { = note: `-D clippy::boxed-local` implied by `-D warnings` error: local variable doesn't need to be boxed here - --> $DIR/boxed_local.rs:132:12 + --> $DIR/boxed_local.rs:131:12 | LL | pub fn new(_needs_name: Box>) -> () {} | ^^^^^^^^^^^ error: local variable doesn't need to be boxed here - --> $DIR/boxed_local.rs:196:44 + --> $DIR/boxed_local.rs:195:44 | LL | fn default_impl_x(self: Box, x: Box) -> u32 { | ^ error: local variable doesn't need to be boxed here - --> $DIR/boxed_local.rs:203:16 + --> $DIR/boxed_local.rs:202:16 | LL | fn foo(x: Box) {} | ^ diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs index 82dce81979fd9..a4d6ba6c8e8dc 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs +++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] #![allow(clippy::if_same_then_else, clippy::branches_sharing_code)] diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr index ef68827422233..3413159280217 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr +++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr @@ -1,5 +1,5 @@ error: called `unwrap` on `x` after checking its variant with `is_some` - --> $DIR/simple_conditionals.rs:40:9 + --> $DIR/simple_conditionals.rs:39:9 | LL | if x.is_some() { | -------------- help: try: `if let Some(..) = x` @@ -7,13 +7,13 @@ LL | x.unwrap(); // unnecessary | ^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/simple_conditionals.rs:2:35 + --> $DIR/simple_conditionals.rs:1:35 | LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `expect` on `x` after checking its variant with `is_some` - --> $DIR/simple_conditionals.rs:41:9 + --> $DIR/simple_conditionals.rs:40:9 | LL | if x.is_some() { | -------------- help: try: `if let Some(..) = x` @@ -22,7 +22,7 @@ LL | x.expect("an error message"); // unnecessary | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this call to `unwrap()` will always panic - --> $DIR/simple_conditionals.rs:43:9 + --> $DIR/simple_conditionals.rs:42:9 | LL | if x.is_some() { | ----------- because of this check @@ -31,13 +31,13 @@ LL | x.unwrap(); // will panic | ^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/simple_conditionals.rs:2:9 + --> $DIR/simple_conditionals.rs:1:9 | LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: this call to `expect()` will always panic - --> $DIR/simple_conditionals.rs:44:9 + --> $DIR/simple_conditionals.rs:43:9 | LL | if x.is_some() { | ----------- because of this check @@ -46,7 +46,7 @@ LL | x.expect("an error message"); // will panic | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this call to `unwrap()` will always panic - --> $DIR/simple_conditionals.rs:47:9 + --> $DIR/simple_conditionals.rs:46:9 | LL | if x.is_none() { | ----------- because of this check @@ -54,7 +54,7 @@ LL | x.unwrap(); // will panic | ^^^^^^^^^^ error: called `unwrap` on `x` after checking its variant with `is_none` - --> $DIR/simple_conditionals.rs:49:9 + --> $DIR/simple_conditionals.rs:48:9 | LL | if x.is_none() { | -------------- help: try: `if let Some(..) = x` @@ -63,7 +63,7 @@ LL | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: called `unwrap` on `x` after checking its variant with `is_some` - --> $DIR/simple_conditionals.rs:8:13 + --> $DIR/simple_conditionals.rs:7:13 | LL | if $a.is_some() { | --------------- help: try: `if let Some(..) = x` @@ -76,7 +76,7 @@ LL | m!(x); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: called `unwrap` on `x` after checking its variant with `is_ok` - --> $DIR/simple_conditionals.rs:57:9 + --> $DIR/simple_conditionals.rs:56:9 | LL | if x.is_ok() { | ------------ help: try: `if let Ok(..) = x` @@ -84,7 +84,7 @@ LL | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: called `expect` on `x` after checking its variant with `is_ok` - --> $DIR/simple_conditionals.rs:58:9 + --> $DIR/simple_conditionals.rs:57:9 | LL | if x.is_ok() { | ------------ help: try: `if let Ok(..) = x` @@ -93,7 +93,7 @@ LL | x.expect("an error message"); // unnecessary | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this call to `unwrap_err()` will always panic - --> $DIR/simple_conditionals.rs:59:9 + --> $DIR/simple_conditionals.rs:58:9 | LL | if x.is_ok() { | --------- because of this check @@ -102,7 +102,7 @@ LL | x.unwrap_err(); // will panic | ^^^^^^^^^^^^^^ error: this call to `unwrap()` will always panic - --> $DIR/simple_conditionals.rs:61:9 + --> $DIR/simple_conditionals.rs:60:9 | LL | if x.is_ok() { | --------- because of this check @@ -111,7 +111,7 @@ LL | x.unwrap(); // will panic | ^^^^^^^^^^ error: this call to `expect()` will always panic - --> $DIR/simple_conditionals.rs:62:9 + --> $DIR/simple_conditionals.rs:61:9 | LL | if x.is_ok() { | --------- because of this check @@ -120,7 +120,7 @@ LL | x.expect("an error message"); // will panic | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `unwrap_err` on `x` after checking its variant with `is_ok` - --> $DIR/simple_conditionals.rs:63:9 + --> $DIR/simple_conditionals.rs:62:9 | LL | if x.is_ok() { | ------------ help: try: `if let Err(..) = x` @@ -129,7 +129,7 @@ LL | x.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: this call to `unwrap()` will always panic - --> $DIR/simple_conditionals.rs:66:9 + --> $DIR/simple_conditionals.rs:65:9 | LL | if x.is_err() { | ---------- because of this check @@ -137,7 +137,7 @@ LL | x.unwrap(); // will panic | ^^^^^^^^^^ error: called `unwrap_err` on `x` after checking its variant with `is_err` - --> $DIR/simple_conditionals.rs:67:9 + --> $DIR/simple_conditionals.rs:66:9 | LL | if x.is_err() { | ------------- help: try: `if let Err(..) = x` @@ -146,7 +146,7 @@ LL | x.unwrap_err(); // unnecessary | ^^^^^^^^^^^^^^ error: called `unwrap` on `x` after checking its variant with `is_err` - --> $DIR/simple_conditionals.rs:69:9 + --> $DIR/simple_conditionals.rs:68:9 | LL | if x.is_err() { | ------------- help: try: `if let Ok(..) = x` @@ -155,7 +155,7 @@ LL | x.unwrap(); // unnecessary | ^^^^^^^^^^ error: this call to `unwrap_err()` will always panic - --> $DIR/simple_conditionals.rs:70:9 + --> $DIR/simple_conditionals.rs:69:9 | LL | if x.is_err() { | ---------- because of this check diff --git a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.fixed b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.fixed index 55451cf2f7d0f..00a0c34bfecf2 100644 --- a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.fixed +++ b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.fixed @@ -1,7 +1,6 @@ // run-rustfix // aux-build:macro_rules.rs -#![feature(lint_reasons)] #![warn(clippy::default_numeric_fallback)] #![allow( unused, diff --git a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.rs b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.rs index 62d72f2febaaa..e63d733e3a7ea 100644 --- a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.rs +++ b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.rs @@ -1,7 +1,6 @@ // run-rustfix // aux-build:macro_rules.rs -#![feature(lint_reasons)] #![warn(clippy::default_numeric_fallback)] #![allow( unused, diff --git a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr index f7c5e724c403c..3cc84ff113232 100644 --- a/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr +++ b/src/tools/clippy/tests/ui/default_numeric_fallback_i32.stderr @@ -1,5 +1,5 @@ error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:21:17 + --> $DIR/default_numeric_fallback_i32.rs:20:17 | LL | let x = 22; | ^^ help: consider adding suffix: `22_i32` @@ -7,145 +7,145 @@ LL | let x = 22; = note: `-D clippy::default-numeric-fallback` implied by `-D warnings` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:22:18 + --> $DIR/default_numeric_fallback_i32.rs:21:18 | LL | let x = [1, 2, 3]; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:22:21 + --> $DIR/default_numeric_fallback_i32.rs:21:21 | LL | let x = [1, 2, 3]; | ^ help: consider adding suffix: `2_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:22:24 + --> $DIR/default_numeric_fallback_i32.rs:21:24 | LL | let x = [1, 2, 3]; | ^ help: consider adding suffix: `3_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:23:28 + --> $DIR/default_numeric_fallback_i32.rs:22:28 | LL | let x = if true { (1, 2) } else { (3, 4) }; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:23:31 + --> $DIR/default_numeric_fallback_i32.rs:22:31 | LL | let x = if true { (1, 2) } else { (3, 4) }; | ^ help: consider adding suffix: `2_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:23:44 + --> $DIR/default_numeric_fallback_i32.rs:22:44 | LL | let x = if true { (1, 2) } else { (3, 4) }; | ^ help: consider adding suffix: `3_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:23:47 + --> $DIR/default_numeric_fallback_i32.rs:22:47 | LL | let x = if true { (1, 2) } else { (3, 4) }; | ^ help: consider adding suffix: `4_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:24:23 + --> $DIR/default_numeric_fallback_i32.rs:23:23 | LL | let x = match 1 { | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:25:13 + --> $DIR/default_numeric_fallback_i32.rs:24:13 | LL | 1 => 1, | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:25:18 + --> $DIR/default_numeric_fallback_i32.rs:24:18 | LL | 1 => 1, | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:26:18 + --> $DIR/default_numeric_fallback_i32.rs:25:18 | LL | _ => 2, | ^ help: consider adding suffix: `2_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:43:21 + --> $DIR/default_numeric_fallback_i32.rs:42:21 | LL | let y = 1; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:51:21 + --> $DIR/default_numeric_fallback_i32.rs:50:21 | LL | let y = 1; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:57:21 + --> $DIR/default_numeric_fallback_i32.rs:56:21 | LL | let y = 1; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:69:9 + --> $DIR/default_numeric_fallback_i32.rs:68:9 | LL | 1 | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:75:27 + --> $DIR/default_numeric_fallback_i32.rs:74:27 | LL | let f = || -> _ { 1 }; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:79:29 + --> $DIR/default_numeric_fallback_i32.rs:78:29 | LL | let f = || -> i32 { 1 }; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:93:21 + --> $DIR/default_numeric_fallback_i32.rs:92:21 | LL | generic_arg(1); | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:96:32 + --> $DIR/default_numeric_fallback_i32.rs:95:32 | LL | let x: _ = generic_arg(1); | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:114:28 + --> $DIR/default_numeric_fallback_i32.rs:113:28 | LL | GenericStruct { x: 1 }; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:117:36 + --> $DIR/default_numeric_fallback_i32.rs:116:36 | LL | let _ = GenericStruct { x: 1 }; | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:135:24 + --> $DIR/default_numeric_fallback_i32.rs:134:24 | LL | GenericEnum::X(1); | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:155:23 + --> $DIR/default_numeric_fallback_i32.rs:154:23 | LL | s.generic_arg(1); | ^ help: consider adding suffix: `1_i32` error: default numeric fallback might occur - --> $DIR/default_numeric_fallback_i32.rs:162:21 + --> $DIR/default_numeric_fallback_i32.rs:161:21 | LL | let x = 22; | ^^ help: consider adding suffix: `22_i32` diff --git a/src/tools/clippy/tests/ui/expect_tool_lint_rfc_2383.rs b/src/tools/clippy/tests/ui/expect_tool_lint_rfc_2383.rs index 28b37f96e9118..8848d89c733fe 100644 --- a/src/tools/clippy/tests/ui/expect_tool_lint_rfc_2383.rs +++ b/src/tools/clippy/tests/ui/expect_tool_lint_rfc_2383.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(lint_reasons)] + //! This file tests the `#[expect]` attribute implementation for tool lints. The same //! file is used to test clippy and rustdoc. Any changes to this file should be synced //! to the other test files as well. diff --git a/src/tools/clippy/tests/ui/implicit_return.fixed b/src/tools/clippy/tests/ui/implicit_return.fixed index 5e55b8b673919..c5ec77c806868 100644 --- a/src/tools/clippy/tests/ui/implicit_return.fixed +++ b/src/tools/clippy/tests/ui/implicit_return.fixed @@ -1,5 +1,4 @@ // run-rustfix -#![feature(lint_reasons)] #![warn(clippy::implicit_return)] #![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)] diff --git a/src/tools/clippy/tests/ui/implicit_return.rs b/src/tools/clippy/tests/ui/implicit_return.rs index 76f0a98035209..a34b9c9171c48 100644 --- a/src/tools/clippy/tests/ui/implicit_return.rs +++ b/src/tools/clippy/tests/ui/implicit_return.rs @@ -1,5 +1,4 @@ // run-rustfix -#![feature(lint_reasons)] #![warn(clippy::implicit_return)] #![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)] diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index 522bc3bf895a7..a761b42739530 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -1,5 +1,5 @@ error: missing `return` statement - --> $DIR/implicit_return.rs:12:5 + --> $DIR/implicit_return.rs:11:5 | LL | true | ^^^^ help: add `return` as shown: `return true` @@ -7,85 +7,85 @@ LL | true = note: `-D clippy::implicit-return` implied by `-D warnings` error: missing `return` statement - --> $DIR/implicit_return.rs:16:15 + --> $DIR/implicit_return.rs:15:15 | LL | if true { true } else { false } | ^^^^ help: add `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:16:29 + --> $DIR/implicit_return.rs:15:29 | LL | if true { true } else { false } | ^^^^^ help: add `return` as shown: `return false` error: missing `return` statement - --> $DIR/implicit_return.rs:22:17 + --> $DIR/implicit_return.rs:21:17 | LL | true => false, | ^^^^^ help: add `return` as shown: `return false` error: missing `return` statement - --> $DIR/implicit_return.rs:23:20 + --> $DIR/implicit_return.rs:22:20 | LL | false => { true }, | ^^^^ help: add `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:36:9 + --> $DIR/implicit_return.rs:35:9 | LL | break true; | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:43:13 + --> $DIR/implicit_return.rs:42:13 | LL | break true; | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:51:13 + --> $DIR/implicit_return.rs:50:13 | LL | break true; | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:69:18 + --> $DIR/implicit_return.rs:68:18 | LL | let _ = || { true }; | ^^^^ help: add `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:70:16 + --> $DIR/implicit_return.rs:69:16 | LL | let _ = || true; | ^^^^ help: add `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:78:5 + --> $DIR/implicit_return.rs:77:5 | LL | format!("test {}", "test") | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")` error: missing `return` statement - --> $DIR/implicit_return.rs:87:5 + --> $DIR/implicit_return.rs:86:5 | LL | m!(true, false) | ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)` error: missing `return` statement - --> $DIR/implicit_return.rs:93:13 + --> $DIR/implicit_return.rs:92:13 | LL | break true; | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` error: missing `return` statement - --> $DIR/implicit_return.rs:98:17 + --> $DIR/implicit_return.rs:97:17 | LL | break 'outer false; | ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false` error: missing `return` statement - --> $DIR/implicit_return.rs:113:5 + --> $DIR/implicit_return.rs:112:5 | LL | / loop { LL | | m!(true); @@ -100,7 +100,7 @@ LL + } | error: missing `return` statement - --> $DIR/implicit_return.rs:127:5 + --> $DIR/implicit_return.rs:126:5 | LL | true | ^^^^ help: add `return` as shown: `return true` diff --git a/src/tools/clippy/tests/ui/logic_bug.rs b/src/tools/clippy/tests/ui/logic_bug.rs index dd6b1db5f70a0..76a1fea568d27 100644 --- a/src/tools/clippy/tests/ui/logic_bug.rs +++ b/src/tools/clippy/tests/ui/logic_bug.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![allow(unused, clippy::diverging_sub_expression)] #![warn(clippy::logic_bug)] diff --git a/src/tools/clippy/tests/ui/logic_bug.stderr b/src/tools/clippy/tests/ui/logic_bug.stderr index 4021fbf457053..8f55e1c8ad859 100644 --- a/src/tools/clippy/tests/ui/logic_bug.stderr +++ b/src/tools/clippy/tests/ui/logic_bug.stderr @@ -1,60 +1,60 @@ error: this boolean expression contains a logic bug - --> $DIR/logic_bug.rs:11:13 + --> $DIR/logic_bug.rs:10:13 | LL | let _ = a && b || a; | ^^^^^^^^^^^ help: it would look like the following: `a` | = note: `-D clippy::logic-bug` implied by `-D warnings` help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/logic_bug.rs:11:18 + --> $DIR/logic_bug.rs:10:18 | LL | let _ = a && b || a; | ^ error: this boolean expression contains a logic bug - --> $DIR/logic_bug.rs:13:13 + --> $DIR/logic_bug.rs:12:13 | LL | let _ = false && a; | ^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/logic_bug.rs:13:22 + --> $DIR/logic_bug.rs:12:22 | LL | let _ = false && a; | ^ error: this boolean expression contains a logic bug - --> $DIR/logic_bug.rs:23:13 + --> $DIR/logic_bug.rs:22:13 | LL | let _ = a == b && a != b; | ^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/logic_bug.rs:23:13 + --> $DIR/logic_bug.rs:22:13 | LL | let _ = a == b && a != b; | ^^^^^^ error: this boolean expression contains a logic bug - --> $DIR/logic_bug.rs:24:13 + --> $DIR/logic_bug.rs:23:13 | LL | let _ = a < b && a >= b; | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/logic_bug.rs:24:13 + --> $DIR/logic_bug.rs:23:13 | LL | let _ = a < b && a >= b; | ^^^^^ error: this boolean expression contains a logic bug - --> $DIR/logic_bug.rs:25:13 + --> $DIR/logic_bug.rs:24:13 | LL | let _ = a > b && a <= b; | ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | help: this expression can be optimized out by applying boolean operations to the outer expression - --> $DIR/logic_bug.rs:25:13 + --> $DIR/logic_bug.rs:24:13 | LL | let _ = a > b && a <= b; | ^^^^^ diff --git a/src/tools/clippy/tests/ui/macro_use_imports.fixed b/src/tools/clippy/tests/ui/macro_use_imports.fixed index e612480d264bd..a83c8ba0b6428 100644 --- a/src/tools/clippy/tests/ui/macro_use_imports.fixed +++ b/src/tools/clippy/tests/ui/macro_use_imports.fixed @@ -4,7 +4,6 @@ // run-rustfix // ignore-32bit -#![feature(lint_reasons)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(clippy::single_component_path_imports)] #![warn(clippy::macro_use_imports)] diff --git a/src/tools/clippy/tests/ui/macro_use_imports.rs b/src/tools/clippy/tests/ui/macro_use_imports.rs index b34817cc3b269..e26a7545ea6f8 100644 --- a/src/tools/clippy/tests/ui/macro_use_imports.rs +++ b/src/tools/clippy/tests/ui/macro_use_imports.rs @@ -4,7 +4,6 @@ // run-rustfix // ignore-32bit -#![feature(lint_reasons)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(clippy::single_component_path_imports)] #![warn(clippy::macro_use_imports)] diff --git a/src/tools/clippy/tests/ui/macro_use_imports.stderr b/src/tools/clippy/tests/ui/macro_use_imports.stderr index bf7b6edd0e314..e25b7519f2ec8 100644 --- a/src/tools/clippy/tests/ui/macro_use_imports.stderr +++ b/src/tools/clippy/tests/ui/macro_use_imports.stderr @@ -1,28 +1,28 @@ error: `macro_use` attributes are no longer needed in the Rust 2018 edition - --> $DIR/macro_use_imports.rs:23:5 + --> $DIR/macro_use_imports.rs:24:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::foofoo, inner::try_err};` + | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;` | = note: `-D clippy::macro-use-imports` implied by `-D warnings` error: `macro_use` attributes are no longer needed in the Rust 2018 edition - --> $DIR/macro_use_imports.rs:21:5 + --> $DIR/macro_use_imports.rs:18:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;` + | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, function_macro, ty_macro, inner_mod_macro, pub_in_private_macro};` error: `macro_use` attributes are no longer needed in the Rust 2018 edition - --> $DIR/macro_use_imports.rs:25:5 + --> $DIR/macro_use_imports.rs:22:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;` + | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::foofoo, inner::try_err};` error: `macro_use` attributes are no longer needed in the Rust 2018 edition - --> $DIR/macro_use_imports.rs:19:5 + --> $DIR/macro_use_imports.rs:20:5 | LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, function_macro, ty_macro, inner_mod_macro, pub_in_private_macro};` + | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;` error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/macro_use_imports_expect.rs b/src/tools/clippy/tests/ui/macro_use_imports_expect.rs index 8a1b05da9efc7..6524ff8e1966f 100644 --- a/src/tools/clippy/tests/ui/macro_use_imports_expect.rs +++ b/src/tools/clippy/tests/ui/macro_use_imports_expect.rs @@ -3,7 +3,6 @@ // aux-build:proc_macro_derive.rs // ignore-32bit -#![feature(lint_reasons)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(clippy::single_component_path_imports)] #![warn(clippy::macro_use_imports)] diff --git a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.rs b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.rs index 03b2433f6666b..1f05787803050 100644 --- a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.rs +++ b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![warn(clippy::manual_non_exhaustive)] #![allow(unused)] diff --git a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr index 144fe86df554b..317a45d2cbd59 100644 --- a/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr +++ b/src/tools/clippy/tests/ui/manual_non_exhaustive_enum.stderr @@ -1,5 +1,5 @@ error: this seems like a manual implementation of the non-exhaustive pattern - --> $DIR/manual_non_exhaustive_enum.rs:5:1 + --> $DIR/manual_non_exhaustive_enum.rs:4:1 | LL | enum E { | ^----- @@ -15,13 +15,13 @@ LL | | } | = note: `-D clippy::manual-non-exhaustive` implied by `-D warnings` help: remove this variant - --> $DIR/manual_non_exhaustive_enum.rs:9:5 + --> $DIR/manual_non_exhaustive_enum.rs:8:5 | LL | _C, | ^^ error: this seems like a manual implementation of the non-exhaustive pattern - --> $DIR/manual_non_exhaustive_enum.rs:14:1 + --> $DIR/manual_non_exhaustive_enum.rs:13:1 | LL | / enum Ep { LL | | A, @@ -32,7 +32,7 @@ LL | | } | |_^ | help: remove this variant - --> $DIR/manual_non_exhaustive_enum.rs:18:5 + --> $DIR/manual_non_exhaustive_enum.rs:17:5 | LL | _C, | ^^ diff --git a/src/tools/clippy/tests/ui/needless_borrow.fixed b/src/tools/clippy/tests/ui/needless_borrow.fixed index 09afe2ddbbf62..b5dfe42cdf706 100644 --- a/src/tools/clippy/tests/ui/needless_borrow.fixed +++ b/src/tools/clippy/tests/ui/needless_borrow.fixed @@ -1,7 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] - #[warn(clippy::all, clippy::needless_borrow)] #[allow(unused_variables, clippy::unnecessary_mut_passed)] fn main() { diff --git a/src/tools/clippy/tests/ui/needless_borrow.rs b/src/tools/clippy/tests/ui/needless_borrow.rs index 3ae4722a1f898..a10b46ec0b98c 100644 --- a/src/tools/clippy/tests/ui/needless_borrow.rs +++ b/src/tools/clippy/tests/ui/needless_borrow.rs @@ -1,7 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] - #[warn(clippy::all, clippy::needless_borrow)] #[allow(unused_variables, clippy::unnecessary_mut_passed)] fn main() { diff --git a/src/tools/clippy/tests/ui/needless_borrow.stderr b/src/tools/clippy/tests/ui/needless_borrow.stderr index 8a2e2b9895908..44cf4edbc59b1 100644 --- a/src/tools/clippy/tests/ui/needless_borrow.stderr +++ b/src/tools/clippy/tests/ui/needless_borrow.stderr @@ -1,5 +1,5 @@ error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:11:15 + --> $DIR/needless_borrow.rs:9:15 | LL | let _ = x(&&a); // warn | ^^^ help: change this to: `&a` @@ -7,115 +7,115 @@ LL | let _ = x(&&a); // warn = note: `-D clippy::needless-borrow` implied by `-D warnings` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:15:13 + --> $DIR/needless_borrow.rs:13:13 | LL | mut_ref(&mut &mut b); // warn | ^^^^^^^^^^^ help: change this to: `&mut b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:27:13 + --> $DIR/needless_borrow.rs:25:13 | LL | &&a | ^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:29:15 + --> $DIR/needless_borrow.rs:27:15 | LL | 46 => &&a, | ^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:35:27 + --> $DIR/needless_borrow.rs:33:27 | LL | break &ref_a; | ^^^^^^ help: change this to: `ref_a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:42:15 + --> $DIR/needless_borrow.rs:40:15 | LL | let _ = x(&&&a); | ^^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:43:15 + --> $DIR/needless_borrow.rs:41:15 | LL | let _ = x(&mut &&a); | ^^^^^^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:44:15 + --> $DIR/needless_borrow.rs:42:15 | LL | let _ = x(&&&mut b); | ^^^^^^^^ help: change this to: `&mut b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:45:15 + --> $DIR/needless_borrow.rs:43:15 | LL | let _ = x(&&ref_a); | ^^^^^^^ help: change this to: `ref_a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:48:11 + --> $DIR/needless_borrow.rs:46:11 | LL | x(&b); | ^^ help: change this to: `b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:55:13 + --> $DIR/needless_borrow.rs:53:13 | LL | mut_ref(&mut x); | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:56:13 + --> $DIR/needless_borrow.rs:54:13 | LL | mut_ref(&mut &mut x); | ^^^^^^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:57:23 + --> $DIR/needless_borrow.rs:55:23 | LL | let y: &mut i32 = &mut x; | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:58:23 + --> $DIR/needless_borrow.rs:56:23 | LL | let y: &mut i32 = &mut &mut x; | ^^^^^^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:67:14 + --> $DIR/needless_borrow.rs:65:14 | LL | 0 => &mut x, | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:73:14 + --> $DIR/needless_borrow.rs:71:14 | LL | 0 => &mut x, | ^^^^^^ help: change this to: `x` error: this expression borrows a value the compiler would automatically borrow - --> $DIR/needless_borrow.rs:85:13 + --> $DIR/needless_borrow.rs:83:13 | LL | let _ = (&x).0; | ^^^^ help: change this to: `x` error: this expression borrows a value the compiler would automatically borrow - --> $DIR/needless_borrow.rs:87:22 + --> $DIR/needless_borrow.rs:85:22 | LL | let _ = unsafe { (&*x).0 }; | ^^^^^ help: change this to: `(*x)` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:97:5 + --> $DIR/needless_borrow.rs:95:5 | LL | (&&()).foo(); | ^^^^^^ help: change this to: `(&())` error: this expression creates a reference which is immediately dereferenced by the compiler - --> $DIR/needless_borrow.rs:106:5 + --> $DIR/needless_borrow.rs:104:5 | LL | (&&5).foo(); | ^^^^^ help: change this to: `(&5)` diff --git a/src/tools/clippy/tests/ui/needless_return.fixed b/src/tools/clippy/tests/ui/needless_return.fixed index 0bc0d0011efe0..df43a704391c3 100644 --- a/src/tools/clippy/tests/ui/needless_return.fixed +++ b/src/tools/clippy/tests/ui/needless_return.fixed @@ -1,6 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] #![feature(let_else)] #![allow(unused)] #![allow( diff --git a/src/tools/clippy/tests/ui/needless_return.rs b/src/tools/clippy/tests/ui/needless_return.rs index eb9f72e8e7822..c18b3b60fe3ac 100644 --- a/src/tools/clippy/tests/ui/needless_return.rs +++ b/src/tools/clippy/tests/ui/needless_return.rs @@ -1,6 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] #![feature(let_else)] #![allow(unused)] #![allow( diff --git a/src/tools/clippy/tests/ui/needless_return.stderr b/src/tools/clippy/tests/ui/needless_return.stderr index 83ff07638693c..cadee6e00dff2 100644 --- a/src/tools/clippy/tests/ui/needless_return.stderr +++ b/src/tools/clippy/tests/ui/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded `return` statement - --> $DIR/needless_return.rs:27:5 + --> $DIR/needless_return.rs:26:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` @@ -7,217 +7,217 @@ LL | return true; = note: `-D clippy::needless-return` implied by `-D warnings` error: unneeded `return` statement - --> $DIR/needless_return.rs:31:5 + --> $DIR/needless_return.rs:30:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:36:9 + --> $DIR/needless_return.rs:35:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:38:9 + --> $DIR/needless_return.rs:37:9 | LL | return false; | ^^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded `return` statement - --> $DIR/needless_return.rs:44:17 + --> $DIR/needless_return.rs:43:17 | LL | true => return false, | ^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded `return` statement - --> $DIR/needless_return.rs:46:13 + --> $DIR/needless_return.rs:45:13 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:53:9 + --> $DIR/needless_return.rs:52:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:55:16 + --> $DIR/needless_return.rs:54:16 | LL | let _ = || return true; | ^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:59:5 + --> $DIR/needless_return.rs:58:5 | LL | return the_answer!(); | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()` error: unneeded `return` statement - --> $DIR/needless_return.rs:63:5 + --> $DIR/needless_return.rs:62:5 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:68:9 + --> $DIR/needless_return.rs:67:9 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:70:9 + --> $DIR/needless_return.rs:69:9 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:77:14 + --> $DIR/needless_return.rs:76:14 | LL | _ => return, | ^^^^^^ help: replace `return` with a unit value: `()` error: unneeded `return` statement - --> $DIR/needless_return.rs:86:13 + --> $DIR/needless_return.rs:85:13 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:88:14 + --> $DIR/needless_return.rs:87:14 | LL | _ => return, | ^^^^^^ help: replace `return` with a unit value: `()` error: unneeded `return` statement - --> $DIR/needless_return.rs:101:9 + --> $DIR/needless_return.rs:100:9 | LL | return String::from("test"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")` error: unneeded `return` statement - --> $DIR/needless_return.rs:103:9 + --> $DIR/needless_return.rs:102:9 | LL | return String::new(); | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()` error: unneeded `return` statement - --> $DIR/needless_return.rs:125:32 + --> $DIR/needless_return.rs:124:32 | LL | bar.unwrap_or_else(|_| return) | ^^^^^^ help: replace `return` with an empty block: `{}` error: unneeded `return` statement - --> $DIR/needless_return.rs:130:13 + --> $DIR/needless_return.rs:129:13 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:132:20 + --> $DIR/needless_return.rs:131:20 | LL | let _ = || return; | ^^^^^^ help: replace `return` with an empty block: `{}` error: unneeded `return` statement - --> $DIR/needless_return.rs:138:32 + --> $DIR/needless_return.rs:137:32 | LL | res.unwrap_or_else(|_| return Foo) | ^^^^^^^^^^ help: remove `return`: `Foo` error: unneeded `return` statement - --> $DIR/needless_return.rs:147:5 + --> $DIR/needless_return.rs:146:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:151:5 + --> $DIR/needless_return.rs:150:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:156:9 + --> $DIR/needless_return.rs:155:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:158:9 + --> $DIR/needless_return.rs:157:9 | LL | return false; | ^^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded `return` statement - --> $DIR/needless_return.rs:164:17 + --> $DIR/needless_return.rs:163:17 | LL | true => return false, | ^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded `return` statement - --> $DIR/needless_return.rs:166:13 + --> $DIR/needless_return.rs:165:13 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:173:9 + --> $DIR/needless_return.rs:172:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:175:16 + --> $DIR/needless_return.rs:174:16 | LL | let _ = || return true; | ^^^^^^^^^^^ help: remove `return`: `true` error: unneeded `return` statement - --> $DIR/needless_return.rs:179:5 + --> $DIR/needless_return.rs:178:5 | LL | return the_answer!(); | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()` error: unneeded `return` statement - --> $DIR/needless_return.rs:183:5 + --> $DIR/needless_return.rs:182:5 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:188:9 + --> $DIR/needless_return.rs:187:9 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:190:9 + --> $DIR/needless_return.rs:189:9 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded `return` statement - --> $DIR/needless_return.rs:197:14 + --> $DIR/needless_return.rs:196:14 | LL | _ => return, | ^^^^^^ help: replace `return` with a unit value: `()` error: unneeded `return` statement - --> $DIR/needless_return.rs:210:9 + --> $DIR/needless_return.rs:209:9 | LL | return String::from("test"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")` error: unneeded `return` statement - --> $DIR/needless_return.rs:212:9 + --> $DIR/needless_return.rs:211:9 | LL | return String::new(); | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()` error: unneeded `return` statement - --> $DIR/needless_return.rs:228:5 + --> $DIR/needless_return.rs:227:5 | LL | return format!("Hello {}", "world!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `format!("Hello {}", "world!")` diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.rs b/src/tools/clippy/tests/ui/nonminimal_bool.rs index 24ae62bb05884..95e574f93f135 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool.rs +++ b/src/tools/clippy/tests/ui/nonminimal_bool.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![allow(unused, clippy::diverging_sub_expression)] #![warn(clippy::nonminimal_bool)] diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.stderr b/src/tools/clippy/tests/ui/nonminimal_bool.stderr index fc6a5ce1dc2ee..bb93cbbd5e190 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool.stderr +++ b/src/tools/clippy/tests/ui/nonminimal_bool.stderr @@ -1,5 +1,5 @@ error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:11:13 + --> $DIR/nonminimal_bool.rs:10:13 | LL | let _ = !true; | ^^^^^ help: try: `false` @@ -7,43 +7,43 @@ LL | let _ = !true; = note: `-D clippy::nonminimal-bool` implied by `-D warnings` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:12:13 + --> $DIR/nonminimal_bool.rs:11:13 | LL | let _ = !false; | ^^^^^^ help: try: `true` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:13:13 + --> $DIR/nonminimal_bool.rs:12:13 | LL | let _ = !!a; | ^^^ help: try: `a` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:14:13 + --> $DIR/nonminimal_bool.rs:13:13 | LL | let _ = false || a; | ^^^^^^^^^^ help: try: `a` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:18:13 + --> $DIR/nonminimal_bool.rs:17:13 | LL | let _ = !(!a && b); | ^^^^^^^^^^ help: try: `a || !b` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:19:13 + --> $DIR/nonminimal_bool.rs:18:13 | LL | let _ = !(!a || b); | ^^^^^^^^^^ help: try: `a && !b` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:20:13 + --> $DIR/nonminimal_bool.rs:19:13 | LL | let _ = !a && !(b && c); | ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)` error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:28:13 + --> $DIR/nonminimal_bool.rs:27:13 | LL | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,7 +56,7 @@ LL | let _ = a == b && c == 5; | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:29:13 + --> $DIR/nonminimal_bool.rs:28:13 | LL | let _ = a == b || c == 5 || a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | let _ = a == b || c == 5; | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:30:13 + --> $DIR/nonminimal_bool.rs:29:13 | LL | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | let _ = a == b && c == 5; | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:31:13 + --> $DIR/nonminimal_bool.rs:30:13 | LL | let _ = a != b || !(a != b || c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | let _ = a != b || c != d; | ~~~~~~~~~~~~~~~~ error: this boolean expression can be simplified - --> $DIR/nonminimal_bool.rs:32:13 + --> $DIR/nonminimal_bool.rs:31:13 | LL | let _ = a != b && !(a != b && c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/ptr_arg.rs b/src/tools/clippy/tests/ui/ptr_arg.rs index fd15001e540c6..a563bd4cf7410 100644 --- a/src/tools/clippy/tests/ui/ptr_arg.rs +++ b/src/tools/clippy/tests/ui/ptr_arg.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![allow(unused, clippy::many_single_char_names, clippy::redundant_clone)] #![warn(clippy::ptr_arg)] diff --git a/src/tools/clippy/tests/ui/ptr_arg.stderr b/src/tools/clippy/tests/ui/ptr_arg.stderr index d64b5f454a5aa..84e1dd04cdf0d 100644 --- a/src/tools/clippy/tests/ui/ptr_arg.stderr +++ b/src/tools/clippy/tests/ui/ptr_arg.stderr @@ -1,5 +1,5 @@ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:8:14 + --> $DIR/ptr_arg.rs:7:14 | LL | fn do_vec(x: &Vec) { | ^^^^^^^^^ help: change this to: `&[i64]` @@ -7,43 +7,43 @@ LL | fn do_vec(x: &Vec) { = note: `-D clippy::ptr-arg` implied by `-D warnings` error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:12:18 + --> $DIR/ptr_arg.rs:11:18 | LL | fn do_vec_mut(x: &mut Vec) { | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]` error: writing `&String` instead of `&str` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:16:14 + --> $DIR/ptr_arg.rs:15:14 | LL | fn do_str(x: &String) { | ^^^^^^^ help: change this to: `&str` error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:20:18 + --> $DIR/ptr_arg.rs:19:18 | LL | fn do_str_mut(x: &mut String) { | ^^^^^^^^^^^ help: change this to: `&mut str` error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:24:15 + --> $DIR/ptr_arg.rs:23:15 | LL | fn do_path(x: &PathBuf) { | ^^^^^^^^ help: change this to: `&Path` error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:28:19 + --> $DIR/ptr_arg.rs:27:19 | LL | fn do_path_mut(x: &mut PathBuf) { | ^^^^^^^^^^^^ help: change this to: `&mut Path` error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:36:18 + --> $DIR/ptr_arg.rs:35:18 | LL | fn do_vec(x: &Vec); | ^^^^^^^^^ help: change this to: `&[i64]` error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:49:14 + --> $DIR/ptr_arg.rs:48:14 | LL | fn cloned(x: &Vec) -> Vec { | ^^^^^^^^ @@ -60,7 +60,7 @@ LL ~ x.to_owned() | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:58:18 + --> $DIR/ptr_arg.rs:57:18 | LL | fn str_cloned(x: &String) -> String { | ^^^^^^^ @@ -76,7 +76,7 @@ LL ~ x.to_owned() | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:66:19 + --> $DIR/ptr_arg.rs:65:19 | LL | fn path_cloned(x: &PathBuf) -> PathBuf { | ^^^^^^^^ @@ -92,7 +92,7 @@ LL ~ x.to_path_buf() | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:74:44 + --> $DIR/ptr_arg.rs:73:44 | LL | fn false_positive_capacity(x: &Vec, y: &String) { | ^^^^^^^ @@ -106,19 +106,19 @@ LL ~ let c = y; | error: using a reference to `Cow` is not recommended - --> $DIR/ptr_arg.rs:88:25 + --> $DIR/ptr_arg.rs:87:25 | LL | fn test_cow_with_ref(c: &Cow<[i32]>) {} | ^^^^^^^^^^^ help: change this to: `&[i32]` error: writing `&String` instead of `&str` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:117:66 + --> $DIR/ptr_arg.rs:116:66 | LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec, _s: &String) {} | ^^^^^^^ help: change this to: `&str` error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:146:21 + --> $DIR/ptr_arg.rs:145:21 | LL | fn foo_vec(vec: &Vec) { | ^^^^^^^^ @@ -131,7 +131,7 @@ LL ~ let _ = vec.to_owned().clone(); | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:151:23 + --> $DIR/ptr_arg.rs:150:23 | LL | fn foo_path(path: &PathBuf) { | ^^^^^^^^ @@ -144,7 +144,7 @@ LL ~ let _ = path.to_path_buf().clone(); | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:156:21 + --> $DIR/ptr_arg.rs:155:21 | LL | fn foo_str(str: &PathBuf) { | ^^^^^^^^ @@ -157,7 +157,7 @@ LL ~ let _ = str.to_path_buf().clone(); | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> $DIR/ptr_arg.rs:162:29 + --> $DIR/ptr_arg.rs:161:29 | LL | fn mut_vec_slice_methods(v: &mut Vec) { | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]` diff --git a/src/tools/clippy/tests/ui/redundant_clone.fixed b/src/tools/clippy/tests/ui/redundant_clone.fixed index da52c0acf93b0..eaa1a6e4d3252 100644 --- a/src/tools/clippy/tests/ui/redundant_clone.fixed +++ b/src/tools/clippy/tests/ui/redundant_clone.fixed @@ -1,7 +1,6 @@ // run-rustfix // rustfix-only-machine-applicable -#![feature(lint_reasons)] #![allow(clippy::implicit_clone, clippy::drop_non_drop)] use std::ffi::OsString; use std::path::Path; diff --git a/src/tools/clippy/tests/ui/redundant_clone.rs b/src/tools/clippy/tests/ui/redundant_clone.rs index 5867d019dbb7d..48a65185c0273 100644 --- a/src/tools/clippy/tests/ui/redundant_clone.rs +++ b/src/tools/clippy/tests/ui/redundant_clone.rs @@ -1,7 +1,6 @@ // run-rustfix // rustfix-only-machine-applicable -#![feature(lint_reasons)] #![allow(clippy::implicit_clone, clippy::drop_non_drop)] use std::ffi::OsString; use std::path::Path; diff --git a/src/tools/clippy/tests/ui/redundant_clone.stderr b/src/tools/clippy/tests/ui/redundant_clone.stderr index aa1dd7cbb45cd..7ff54ac731521 100644 --- a/src/tools/clippy/tests/ui/redundant_clone.stderr +++ b/src/tools/clippy/tests/ui/redundant_clone.stderr @@ -1,180 +1,180 @@ error: redundant clone - --> $DIR/redundant_clone.rs:10:42 + --> $DIR/redundant_clone.rs:9:42 | LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); | ^^^^^^^^^^^^ help: remove this | = note: `-D clippy::redundant-clone` implied by `-D warnings` note: this value is dropped without further use - --> $DIR/redundant_clone.rs:10:14 + --> $DIR/redundant_clone.rs:9:14 | LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:13:15 + --> $DIR/redundant_clone.rs:12:15 | LL | let _s = s.clone(); | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:13:14 + --> $DIR/redundant_clone.rs:12:14 | LL | let _s = s.clone(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:16:15 + --> $DIR/redundant_clone.rs:15:15 | LL | let _s = s.to_string(); | ^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:16:14 + --> $DIR/redundant_clone.rs:15:14 | LL | let _s = s.to_string(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:19:15 + --> $DIR/redundant_clone.rs:18:15 | LL | let _s = s.to_owned(); | ^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:19:14 + --> $DIR/redundant_clone.rs:18:14 | LL | let _s = s.to_owned(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:21:42 + --> $DIR/redundant_clone.rs:20:42 | LL | let _s = Path::new("/a/b/").join("c").to_owned(); | ^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:21:14 + --> $DIR/redundant_clone.rs:20:14 | LL | let _s = Path::new("/a/b/").join("c").to_owned(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:23:42 + --> $DIR/redundant_clone.rs:22:42 | LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); | ^^^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:23:14 + --> $DIR/redundant_clone.rs:22:14 | LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:25:29 + --> $DIR/redundant_clone.rs:24:29 | LL | let _s = OsString::new().to_owned(); | ^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:25:14 + --> $DIR/redundant_clone.rs:24:14 | LL | let _s = OsString::new().to_owned(); | ^^^^^^^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:27:29 + --> $DIR/redundant_clone.rs:26:29 | LL | let _s = OsString::new().to_os_string(); | ^^^^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:27:14 + --> $DIR/redundant_clone.rs:26:14 | LL | let _s = OsString::new().to_os_string(); | ^^^^^^^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:38:19 + --> $DIR/redundant_clone.rs:37:19 | LL | let _t = tup.0.clone(); | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:38:14 + --> $DIR/redundant_clone.rs:37:14 | LL | let _t = tup.0.clone(); | ^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:70:25 + --> $DIR/redundant_clone.rs:69:25 | LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:70:24 + --> $DIR/redundant_clone.rs:69:24 | LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } | ^ error: redundant clone - --> $DIR/redundant_clone.rs:127:15 + --> $DIR/redundant_clone.rs:126:15 | LL | let _s = s.clone(); | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:127:14 + --> $DIR/redundant_clone.rs:126:14 | LL | let _s = s.clone(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:128:15 + --> $DIR/redundant_clone.rs:127:15 | LL | let _t = t.clone(); | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:128:14 + --> $DIR/redundant_clone.rs:127:14 | LL | let _t = t.clone(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:138:19 + --> $DIR/redundant_clone.rs:137:19 | LL | let _f = f.clone(); | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:138:18 + --> $DIR/redundant_clone.rs:137:18 | LL | let _f = f.clone(); | ^ error: redundant clone - --> $DIR/redundant_clone.rs:150:14 + --> $DIR/redundant_clone.rs:149:14 | LL | let y = x.clone().join("matthias"); | ^^^^^^^^ help: remove this | note: cloned value is neither consumed nor mutated - --> $DIR/redundant_clone.rs:150:13 + --> $DIR/redundant_clone.rs:149:13 | LL | let y = x.clone().join("matthias"); | ^^^^^^^^^ error: redundant clone - --> $DIR/redundant_clone.rs:204:11 + --> $DIR/redundant_clone.rs:203:11 | LL | foo(&x.clone(), move || { | ^^^^^^^^ help: remove this | note: this value is dropped without further use - --> $DIR/redundant_clone.rs:204:10 + --> $DIR/redundant_clone.rs:203:10 | LL | foo(&x.clone(), move || { | ^ diff --git a/src/tools/clippy/tests/ui/ref_binding_to_reference.rs b/src/tools/clippy/tests/ui/ref_binding_to_reference.rs index c8d0e56b197f4..f038555452382 100644 --- a/src/tools/clippy/tests/ui/ref_binding_to_reference.rs +++ b/src/tools/clippy/tests/ui/ref_binding_to_reference.rs @@ -1,6 +1,5 @@ // FIXME: run-rustfix waiting on multi-span suggestions -#![feature(lint_reasons)] #![warn(clippy::ref_binding_to_reference)] #![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] diff --git a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr index eb36cd516a246..c5856e15fa987 100644 --- a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr +++ b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr @@ -1,5 +1,5 @@ error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:31:14 + --> $DIR/ref_binding_to_reference.rs:30:14 | LL | Some(ref x) => x, | ^^^^^ @@ -11,7 +11,7 @@ LL | Some(x) => &x, | ~ ~~ error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:37:14 + --> $DIR/ref_binding_to_reference.rs:36:14 | LL | Some(ref x) => { | ^^^^^ @@ -25,7 +25,7 @@ LL ~ &x | error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:47:14 + --> $DIR/ref_binding_to_reference.rs:46:14 | LL | Some(ref x) => m2!(x), | ^^^^^ @@ -36,7 +36,7 @@ LL | Some(x) => m2!(&x), | ~ ~~ error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:52:15 + --> $DIR/ref_binding_to_reference.rs:51:15 | LL | let _ = |&ref x: &&String| { | ^^^^^ @@ -48,7 +48,7 @@ LL ~ let _: &&String = &x; | error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:58:12 + --> $DIR/ref_binding_to_reference.rs:57:12 | LL | fn f2<'a>(&ref x: &&'a String) -> &'a String { | ^^^^^ @@ -61,7 +61,7 @@ LL ~ x | error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:65:11 + --> $DIR/ref_binding_to_reference.rs:64:11 | LL | fn f(&ref x: &&String) { | ^^^^^ @@ -73,7 +73,7 @@ LL ~ let _: &&String = &x; | error: this pattern creates a reference to a reference - --> $DIR/ref_binding_to_reference.rs:73:11 + --> $DIR/ref_binding_to_reference.rs:72:11 | LL | fn f(&ref x: &&String) { | ^^^^^ diff --git a/src/tools/clippy/tests/ui/same_name_method.rs b/src/tools/clippy/tests/ui/same_name_method.rs index daef95a425c92..5d2a4dcdb98a0 100644 --- a/src/tools/clippy/tests/ui/same_name_method.rs +++ b/src/tools/clippy/tests/ui/same_name_method.rs @@ -1,4 +1,3 @@ -#![feature(lint_reasons)] #![warn(clippy::same_name_method)] #![allow(dead_code, non_camel_case_types)] diff --git a/src/tools/clippy/tests/ui/same_name_method.stderr b/src/tools/clippy/tests/ui/same_name_method.stderr index f55ec9f3cc66b..cf06eb32e0c7f 100644 --- a/src/tools/clippy/tests/ui/same_name_method.stderr +++ b/src/tools/clippy/tests/ui/same_name_method.stderr @@ -1,61 +1,61 @@ error: method's name is the same as an existing method in a trait - --> $DIR/same_name_method.rs:21:13 + --> $DIR/same_name_method.rs:20:13 | LL | fn foo() {} | ^^^^^^^^^^^ | = note: `-D clippy::same-name-method` implied by `-D warnings` note: existing `foo` defined here - --> $DIR/same_name_method.rs:25:13 + --> $DIR/same_name_method.rs:24:13 | LL | fn foo() {} | ^^^^^^^^^^^ error: method's name is the same as an existing method in a trait - --> $DIR/same_name_method.rs:35:13 + --> $DIR/same_name_method.rs:34:13 | LL | fn clone() {} | ^^^^^^^^^^^^^ | note: existing `clone` defined here - --> $DIR/same_name_method.rs:31:18 + --> $DIR/same_name_method.rs:30:18 | LL | #[derive(Clone)] | ^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: method's name is the same as an existing method in a trait - --> $DIR/same_name_method.rs:45:13 + --> $DIR/same_name_method.rs:44:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here - --> $DIR/same_name_method.rs:49:13 + --> $DIR/same_name_method.rs:48:13 | LL | fn foo() {} | ^^^^^^^^^^^ error: method's name is the same as an existing method in a trait - --> $DIR/same_name_method.rs:59:13 + --> $DIR/same_name_method.rs:58:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here - --> $DIR/same_name_method.rs:62:9 + --> $DIR/same_name_method.rs:61:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ error: method's name is the same as an existing method in a trait - --> $DIR/same_name_method.rs:71:13 + --> $DIR/same_name_method.rs:70:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here - --> $DIR/same_name_method.rs:74:9 + --> $DIR/same_name_method.rs:73:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ From 7514dab30b0f1db1734bf3ba6593e3e79dc73dce Mon Sep 17 00:00:00 2001 From: xFrednet Date: Fri, 8 Jul 2022 21:08:46 +0200 Subject: [PATCH 4/6] Move reason tests to rfc-2383 test folder (RFC 2383) --- src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-erroneous.rs | 0 .../ui/lint/{ => rfc-2383-lint-reason}/reasons-erroneous.stderr | 0 src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-forbidden.rs | 0 .../ui/lint/{ => rfc-2383-lint-reason}/reasons-forbidden.stderr | 0 src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons.rs | 0 src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons.stderr | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-erroneous.rs (100%) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-erroneous.stderr (100%) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-forbidden.rs (100%) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons-forbidden.stderr (100%) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons.rs (100%) rename src/test/ui/lint/{ => rfc-2383-lint-reason}/reasons.stderr (100%) diff --git a/src/test/ui/lint/reasons-erroneous.rs b/src/test/ui/lint/rfc-2383-lint-reason/reasons-erroneous.rs similarity index 100% rename from src/test/ui/lint/reasons-erroneous.rs rename to src/test/ui/lint/rfc-2383-lint-reason/reasons-erroneous.rs diff --git a/src/test/ui/lint/reasons-erroneous.stderr b/src/test/ui/lint/rfc-2383-lint-reason/reasons-erroneous.stderr similarity index 100% rename from src/test/ui/lint/reasons-erroneous.stderr rename to src/test/ui/lint/rfc-2383-lint-reason/reasons-erroneous.stderr diff --git a/src/test/ui/lint/reasons-forbidden.rs b/src/test/ui/lint/rfc-2383-lint-reason/reasons-forbidden.rs similarity index 100% rename from src/test/ui/lint/reasons-forbidden.rs rename to src/test/ui/lint/rfc-2383-lint-reason/reasons-forbidden.rs diff --git a/src/test/ui/lint/reasons-forbidden.stderr b/src/test/ui/lint/rfc-2383-lint-reason/reasons-forbidden.stderr similarity index 100% rename from src/test/ui/lint/reasons-forbidden.stderr rename to src/test/ui/lint/rfc-2383-lint-reason/reasons-forbidden.stderr diff --git a/src/test/ui/lint/reasons.rs b/src/test/ui/lint/rfc-2383-lint-reason/reasons.rs similarity index 100% rename from src/test/ui/lint/reasons.rs rename to src/test/ui/lint/rfc-2383-lint-reason/reasons.rs diff --git a/src/test/ui/lint/reasons.stderr b/src/test/ui/lint/rfc-2383-lint-reason/reasons.stderr similarity index 100% rename from src/test/ui/lint/reasons.stderr rename to src/test/ui/lint/rfc-2383-lint-reason/reasons.stderr From 996564ba271cc40feccf2265051279951aa7f951 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Sat, 9 Jul 2022 16:45:07 +0200 Subject: [PATCH 5/6] Document RFC 2383 new functions in the rustc book --- src/doc/rustc/src/lints/levels.md | 64 ++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index 93892d6ade61b..de2cbfc7515bb 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -1,12 +1,13 @@ # Lint Levels -In `rustc`, lints are divided into five *levels*: +In `rustc`, lints are divided into six *levels*: 1. allow -2. warn -3. force-warn -4. deny -5. forbid +2. expect +3. warn +4. force-warn +5. deny +6. forbid Each lint has a default level (explained in the lint listing later in this chapter), and the compiler has a default warning level. First, let's explain @@ -33,6 +34,41 @@ But this code violates the `missing_docs` lint. These lints exist mostly to be manually turned on via configuration, as we'll talk about later in this section. +## expect + +Sometimes, it can be helpful to suppress lints, but at the same time ensure that +the code in question still emits them. The 'expect' level does exactly this, with +it a lint can be expected. If the lint in question is not an emitted, a new lint +`unfulfilled_lint_expectation` at the attribute notifying you that the expectation, +is no longer fulfilled. + +```rust +fn main() { + #[expect(unused_variables)] + let unused = "Everyone ignores me"; + + #[expect(unused_variables)] + let used = "I'm usefull"; + println!("The `used` value is equal to: {:?}", used); +} +``` + +This will produce the following warning: + +```txt +warning: this lint expectation is unfulfilled + --> src/main.rs:7:14 + | +7 | #[expect(unused_variables)] + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unfulfilled_lint_expectations)]` on by default +``` + +This level can only be defined via the `#[expect]` attribute and not via the +console. Lints with the special 'force-warn' lint will still be emitted as usual. +The fulfillment of expectations is still tracked. + ## warn The 'warn' lint level will produce a warning if you violate the lint. For example, @@ -240,6 +276,24 @@ And use multiple attributes together: pub fn foo() {} ``` +All lint attributes support an additional `reason` parameter, to give context why +a certain attribute was added. This reason will be displayed as part of the lint +message, if the lint is emitted at the defined level. + +```rust +use std::path::PathBuf; + +pub fn get_path() -> PathBuf { + #[allow(unused_mut, reason = "this is only modified on some platforms")] + let mut file_name = PathBuf::from("git"); + + #[cfg(target_os = "windows")] + file_name.set_extension("exe"); + + file_name +} +``` + ### Capping lints `rustc` supports a flag, `--cap-lints LEVEL` that sets the "lint cap level." From dbb93b9f6308cc7b210e6ec4d1f8ad756124142f Mon Sep 17 00:00:00 2001 From: xFrednet Date: Wed, 20 Jul 2022 00:17:15 +0200 Subject: [PATCH 6/6] Address review comments and (Hopefully) fix CI Thanks --- src/doc/rustc/src/lints/levels.md | 11 +++++------ src/tools/clippy/tests/ui/let_unit.fixed | 1 - src/tools/clippy/tests/ui/let_unit.rs | 1 - src/tools/clippy/tests/ui/let_unit.stderr | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index de2cbfc7515bb..4d1b10d25fc3e 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -37,10 +37,10 @@ talk about later in this section. ## expect Sometimes, it can be helpful to suppress lints, but at the same time ensure that -the code in question still emits them. The 'expect' level does exactly this, with -it a lint can be expected. If the lint in question is not an emitted, a new lint -`unfulfilled_lint_expectation` at the attribute notifying you that the expectation, -is no longer fulfilled. +the code in question still emits them. The 'expect' level does exactly this. If +the lint in question is not emitted, the `unfulfilled_lint_expectation` lint +triggers on the `expect` attribute, notifying you that the expectation is no +longer fulfilled. ```rust fn main() { @@ -48,7 +48,7 @@ fn main() { let unused = "Everyone ignores me"; #[expect(unused_variables)] - let used = "I'm usefull"; + let used = "I'm useful"; println!("The `used` value is equal to: {:?}", used); } ``` @@ -67,7 +67,6 @@ warning: this lint expectation is unfulfilled This level can only be defined via the `#[expect]` attribute and not via the console. Lints with the special 'force-warn' lint will still be emitted as usual. -The fulfillment of expectations is still tracked. ## warn diff --git a/src/tools/clippy/tests/ui/let_unit.fixed b/src/tools/clippy/tests/ui/let_unit.fixed index 6343cff0f7ff9..ccd4e95a185dd 100644 --- a/src/tools/clippy/tests/ui/let_unit.fixed +++ b/src/tools/clippy/tests/ui/let_unit.fixed @@ -1,6 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] #![warn(clippy::let_unit_value)] #![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)] diff --git a/src/tools/clippy/tests/ui/let_unit.rs b/src/tools/clippy/tests/ui/let_unit.rs index c9bb2849f5cf1..a4e833f8fc667 100644 --- a/src/tools/clippy/tests/ui/let_unit.rs +++ b/src/tools/clippy/tests/ui/let_unit.rs @@ -1,6 +1,5 @@ // run-rustfix -#![feature(lint_reasons)] #![warn(clippy::let_unit_value)] #![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)] diff --git a/src/tools/clippy/tests/ui/let_unit.stderr b/src/tools/clippy/tests/ui/let_unit.stderr index 49da74ca7e1c7..b2e698beadbf7 100644 --- a/src/tools/clippy/tests/ui/let_unit.stderr +++ b/src/tools/clippy/tests/ui/let_unit.stderr @@ -1,5 +1,5 @@ error: this let-binding has unit value - --> $DIR/let_unit.rs:14:5 + --> $DIR/let_unit.rs:13:5 | LL | let _x = println!("x"); | ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");` @@ -7,13 +7,13 @@ LL | let _x = println!("x"); = note: `-D clippy::let-unit-value` implied by `-D warnings` error: this let-binding has unit value - --> $DIR/let_unit.rs:18:9 + --> $DIR/let_unit.rs:17:9 | LL | let _a = (); | ^^^^^^^^^^^^ help: omit the `let` binding: `();` error: this let-binding has unit value - --> $DIR/let_unit.rs:53:5 + --> $DIR/let_unit.rs:52:5 | LL | / let _ = v LL | | .into_iter() @@ -36,7 +36,7 @@ LL + .unwrap(); | error: this let-binding has unit value - --> $DIR/let_unit.rs:80:5 + --> $DIR/let_unit.rs:79:5 | LL | let x: () = f(); // Lint. | ^^^^-^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | let x: () = f(); // Lint. | help: use a wild (`_`) binding: `_` error: this let-binding has unit value - --> $DIR/let_unit.rs:83:5 + --> $DIR/let_unit.rs:82:5 | LL | let x: () = f2(0i32); // Lint. | ^^^^-^^^^^^^^^^^^^^^^ @@ -52,19 +52,19 @@ LL | let x: () = f2(0i32); // Lint. | help: use a wild (`_`) binding: `_` error: this let-binding has unit value - --> $DIR/let_unit.rs:85:5 + --> $DIR/let_unit.rs:84:5 | LL | let _: () = f3(()); // Lint | ^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `f3(());` error: this let-binding has unit value - --> $DIR/let_unit.rs:86:5 + --> $DIR/let_unit.rs:85:5 | LL | let x: () = f3(()); // Lint | ^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `f3(());` error: this let-binding has unit value - --> $DIR/let_unit.rs:102:5 + --> $DIR/let_unit.rs:101:5 | LL | let x: () = if true { f() } else { f2(0) }; // Lint | ^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -72,7 +72,7 @@ LL | let x: () = if true { f() } else { f2(0) }; // Lint | help: use a wild (`_`) binding: `_` error: this let-binding has unit value - --> $DIR/let_unit.rs:113:5 + --> $DIR/let_unit.rs:112:5 | LL | / let _: () = match Some(0) { LL | | None => f2(1), @@ -93,7 +93,7 @@ LL + }; | error: this let-binding has unit value - --> $DIR/let_unit.rs:160:13 + --> $DIR/let_unit.rs:159:13 | LL | let _: () = z; | ^^^^^^^^^^^^^^ help: omit the `let` binding: `z;`