Auto merge of #120924 - xFrednet:rfc-2383-stabilization-party, r=Urgau,blyxyas

Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383)

Let's give this another try! The [previous stabilization attempt](https://github.com/rust-lang/rust/pull/99063) was stalled by some unresolved questions. These have been discussed in a [lang team](https://github.com/rust-lang/lang-team/issues/191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in https://github.com/rust-lang/rust/issues/115980

I've just updated the [stabilization report](https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation.

This hopefully covers everything. Let's hope that the CI will be green like the spring.

fixes #115980
fixes #54503

---

r? `@wesleywiser`

Tacking Issue: https://github.com/rust-lang/rust/issues/54503
Stabilization Report: https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964
Documentation Update: https://github.com/rust-lang/reference/pull/1237

<!--
For Clippy:

changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized
changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized
-->

---

Roses are red,
Violets are blue,
Let's expect lints,
With reason clues
This commit is contained in:
bors 2024-06-26 16:38:30 +00:00
commit 4bc39f028d
170 changed files with 917 additions and 870 deletions

View File

@ -5,6 +5,7 @@
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(lint_reasons))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(assert_matches)] #![feature(assert_matches)]
@ -12,7 +13,6 @@
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_quote)] #![feature(proc_macro_quote)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]

View File

@ -10,6 +10,7 @@
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::default_hash_types)] #![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(lint_reasons))]
#![cfg_attr(not(parallel_compiler), feature(cell_leak))] #![cfg_attr(not(parallel_compiler), feature(cell_leak))]
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
@ -24,7 +25,6 @@
#![feature(extend_one)] #![feature(extend_one)]
#![feature(hash_raw_entry)] #![feature(hash_raw_entry)]
#![feature(hasher_prefixfree_extras)] #![feature(hasher_prefixfree_extras)]
#![feature(lint_reasons)]
#![feature(macro_metavar_expr)] #![feature(macro_metavar_expr)]
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(min_specialization)] #![feature(min_specialization)]

View File

@ -135,7 +135,12 @@ impl Emitter for JsonEmitter {
let data: Vec<FutureBreakageItem<'_>> = diags let data: Vec<FutureBreakageItem<'_>> = diags
.into_iter() .into_iter()
.map(|mut diag| { .map(|mut diag| {
if diag.level == crate::Level::Allow { // Allowed or expected lints don't normally (by definition) emit a lint
// but future incompat lints are special and are emitted anyway.
//
// So to avoid ICEs and confused users we "upgrade" the lint level for
// those `FutureBreakageItem` to warn.
if matches!(diag.level, crate::Level::Allow | crate::Level::Expect(..)) {
diag.level = crate::Level::Warning; diag.level = crate::Level::Warning;
} }
FutureBreakageItem { FutureBreakageItem {

View File

@ -232,6 +232,8 @@ declare_features! (
(accepted, label_break_value, "1.65.0", Some(48594)), (accepted, label_break_value, "1.65.0", Some(48594)),
/// Allows `let...else` statements. /// Allows `let...else` statements.
(accepted, let_else, "1.65.0", Some(87335)), (accepted, let_else, "1.65.0", Some(87335)),
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
(accepted, lint_reasons, "CURRENT_RUSTC_VERSION", Some(54503)),
/// Allows `break {expr}` with a value inside `loop`s. /// Allows `break {expr}` with a value inside `loop`s.
(accepted, loop_break_value, "1.19.0", Some(37339)), (accepted, loop_break_value, "1.19.0", Some(37339)),
/// Allows use of `?` as the Kleene "at most one" operator in macros. /// Allows use of `?` as the Kleene "at most one" operator in macros.

View File

@ -369,9 +369,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
DuplicatesOk, EncodeCrossCrate::No, DuplicatesOk, EncodeCrossCrate::No,
), ),
gated!( ungated!(
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk, expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
EncodeCrossCrate::No, lint_reasons, experimental!(expect) DuplicatesOk, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),

View File

@ -512,8 +512,6 @@ declare_features! (
/// Allows using `#[link(kind = "link-arg", name = "...")]` /// Allows using `#[link(kind = "link-arg", name = "...")]`
/// to pass custom arguments to the linker. /// to pass custom arguments to the linker.
(unstable, link_arg_attribute, "1.76.0", Some(99427)), (unstable, link_arg_attribute, "1.76.0", Some(99427)),
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
(unstable, lint_reasons, "1.31.0", Some(54503)),
/// Give access to additional metadata about declarative macro meta-variables. /// Give access to additional metadata about declarative macro meta-variables.
(unstable, macro_metavar_expr, "1.61.0", Some(83527)), (unstable, macro_metavar_expr, "1.61.0", Some(83527)),
/// Provides a way to concatenate identifiers using metavariable expressions. /// Provides a way to concatenate identifiers using metavariable expressions.

View File

@ -3,7 +3,6 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS; use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS;
use rustc_session::lint::LintExpectationId; use rustc_session::lint::LintExpectationId;
use rustc_span::symbol::sym;
use rustc_span::Symbol; use rustc_span::Symbol;
pub(crate) fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
@ -11,10 +10,6 @@ pub(crate) fn provide(providers: &mut Providers) {
} }
fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) { fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
if !tcx.features().active(sym::lint_reasons) {
return;
}
let lint_expectations = tcx.lint_expectations(()); let lint_expectations = tcx.lint_expectations(());
let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids(); let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids();

View File

@ -37,7 +37,6 @@ use rustc_session::lint::{
}, },
Level, Lint, LintExpectationId, LintId, Level, Lint, LintExpectationId, LintId,
}; };
use rustc_session::parse::feature_err;
use rustc_session::Session; use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
@ -788,15 +787,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
ast::MetaItemKind::NameValue(ref name_value) => { ast::MetaItemKind::NameValue(ref name_value) => {
if item.path == sym::reason { if item.path == sym::reason {
if let ast::LitKind::Str(rationale, _) = name_value.kind { if let ast::LitKind::Str(rationale, _) = name_value.kind {
if !self.features.lint_reasons {
feature_err(
&self.sess,
sym::lint_reasons,
item.span,
"lint reasons are experimental",
)
.emit();
}
reason = Some(rationale); reason = Some(rationale);
} else { } else {
sess.dcx().emit_err(MalformedAttribute { sess.dcx().emit_err(MalformedAttribute {

View File

@ -608,13 +608,13 @@ declare_lint! {
} }
declare_lint! { declare_lint! {
/// The `unfulfilled_lint_expectations` lint detects lint trigger expectations /// The `unfulfilled_lint_expectations` lint detects when a lint expectation is
/// that have not been fulfilled. /// unfulfilled.
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust /// ```rust
/// #![feature(lint_reasons)] /// #![cfg_attr(bootstrap, feature(lint_reasons))]
/// ///
/// #[expect(unused_variables)] /// #[expect(unused_variables)]
/// let x = 10; /// let x = 10;
@ -625,24 +625,14 @@ declare_lint! {
/// ///
/// ### Explanation /// ### Explanation
/// ///
/// It was expected that the marked code would emit a lint. This expectation /// The `#[expect]` attribute can be used to create a lint expectation. The
/// has not been fulfilled. /// expectation is fulfilled, if a `#[warn]` attribute at the same location
/// would result in a lint emission. If the expectation is unfulfilled,
/// because no lint was emitted, this lint will be emitted on the attribute.
/// ///
/// The `expect` attribute can be removed if this is intended behavior otherwise
/// it should be investigated why the expected lint is no longer issued.
///
/// In rare cases, the expectation might be emitted at a different location than
/// shown in the shown code snippet. In most cases, the `#[expect]` attribute
/// works when added to the outer scope. A few lints can only be expected
/// on a crate level.
///
/// Part of RFC 2383. The progress is being tracked in [#54503]
///
/// [#54503]: https://github.com/rust-lang/rust/issues/54503
pub UNFULFILLED_LINT_EXPECTATIONS, pub UNFULFILLED_LINT_EXPECTATIONS,
Warn, Warn,
"unfulfilled lint expectation", "unfulfilled lint expectation"
@feature_gate = rustc_span::sym::lint_reasons;
} }
declare_lint! { declare_lint! {

View File

@ -1,12 +1,13 @@
# Lint Levels # Lint Levels
In `rustc`, lints are divided into five *levels*: In `rustc`, lints are divided into six *levels*:
1. allow 1. allow
2. warn 2. expect
3. force-warn 3. warn
4. deny 4. force-warn
5. forbid 5. deny
6. forbid
Each lint has a default level (explained in the lint listing later in this 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 chapter), and the compiler has a default warning level. First, let's explain
@ -33,6 +34,40 @@ But this code violates the `missing_docs` lint.
These lints exist mostly to be manually turned on via configuration, as we'll These lints exist mostly to be manually turned on via configuration, as we'll
talk about later in this section. 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. 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() {
#[expect(unused_variables)]
let unused = "Everyone ignores me";
#[expect(unused_variables)] // `unused_variables` lint is not emitted
let used = "I'm useful"; // the expectation is therefore unfulfilled
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, there is no equivalent
flag. Lints with the special 'force-warn' level will still be emitted as usual.
## warn ## warn
The 'warn' lint level will produce a warning if you violate the lint. For example, The 'warn' lint level will produce a warning if you violate the lint. For example,
@ -240,6 +275,21 @@ And use multiple attributes together:
pub fn foo() {} 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 ### Capping lints
`rustc` supports a flag, `--cap-lints LEVEL` that sets the "lint cap level." `rustc` supports a flag, `--cap-lints LEVEL` that sets the "lint cap level."

View File

@ -1943,7 +1943,7 @@ Released 2022-05-19
[#8218](https://github.com/rust-lang/rust-clippy/pull/8218) [#8218](https://github.com/rust-lang/rust-clippy/pull/8218)
* [`needless_match`] * [`needless_match`]
[#8471](https://github.com/rust-lang/rust-clippy/pull/8471) [#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) [#8504](https://github.com/rust-lang/rust-clippy/pull/8504)
* [`print_in_format_impl`] * [`print_in_format_impl`]
[#8253](https://github.com/rust-lang/rust-clippy/pull/8253) [#8253](https://github.com/rust-lang/rust-clippy/pull/8253)

View File

@ -669,6 +669,8 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
--- ---
**Affected lints:** **Affected lints:**
* [`allow_attributes`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes)
* [`allow_attributes_without_reason`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason)
* [`almost_complete_range`](https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range) * [`almost_complete_range`](https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range)
* [`approx_constant`](https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant) * [`approx_constant`](https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant)
* [`assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones) * [`assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones)

View File

@ -265,7 +265,7 @@ define_Conf! {
/// ///
/// Suppress lints whenever the suggested change would cause breakage for other crates. /// Suppress lints whenever the suggested change would cause breakage for other crates.
(avoid_breaking_exported_api: bool = true), (avoid_breaking_exported_api: bool = true),
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS. /// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON.
/// ///
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml` /// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
#[default_text = ""] #[default_text = ""]

View File

@ -17,6 +17,7 @@ macro_rules! msrv_aliases {
// names may refer to stabilized feature flags or library items // names may refer to stabilized feature flags or library items
msrv_aliases! { msrv_aliases! {
1,81,0 { LINT_REASONS_STABILIZATION }
1,77,0 { C_STR_LITERALS } 1,77,0 { C_STR_LITERALS }
1,76,0 { PTR_FROM_REF } 1,76,0 { PTR_FROM_REF }
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE } 1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }

View File

@ -1,74 +0,0 @@
use ast::{AttrStyle, Attribute};
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::is_from_proc_macro;
use rustc_ast as ast;
use rustc_errors::Applicability;
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::declare_lint_pass;
declare_clippy_lint! {
/// ### What it does
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
///
/// The expect attribute is still unstable and requires the `lint_reasons`
/// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
/// the crate root.
///
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
///
/// ### Why restrict this?
/// `#[allow]` attributes can linger after their reason for existence is gone.
/// `#[expect]` attributes suppress the lint emission, but emit a warning if
/// the expectation is unfulfilled. This can be useful to be notified when the
/// lint is no longer triggered, which may indicate the attribute can be removed.
///
/// ### Example
/// ```rust,ignore
/// #[allow(unused_mut)]
/// fn foo() -> usize {
/// let mut a = Vec::new();
/// a.len()
/// }
/// ```
/// Use instead:
/// ```rust,ignore
/// #![feature(lint_reasons)]
/// #[expect(unused_mut)]
/// fn foo() -> usize {
/// let mut a = Vec::new();
/// a.len()
/// }
/// ```
#[clippy::version = "1.70.0"]
pub ALLOW_ATTRIBUTES,
restriction,
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
}
declare_lint_pass!(AllowAttribute => [ALLOW_ATTRIBUTES]);
impl LateLintPass<'_> for AllowAttribute {
// Separate each crate's features.
fn check_attribute<'cx>(&mut self, cx: &LateContext<'cx>, attr: &'cx Attribute) {
if !in_external_macro(cx.sess(), attr.span)
&& cx.tcx.features().lint_reasons
&& let AttrStyle::Outer = attr.style
&& let Some(ident) = attr.ident()
&& ident.name == rustc_span::symbol::sym::allow
&& !is_from_proc_macro(cx, &attr)
{
span_lint_and_sugg(
cx,
ALLOW_ATTRIBUTES,
ident.span,
"#[allow] attribute found",
"replace it with",
"expect".into(),
Applicability::MachineApplicable,
);
}
}
}

View File

@ -0,0 +1,26 @@
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::is_from_proc_macro;
use rustc_ast::{AttrStyle, Attribute};
use rustc_errors::Applicability;
use rustc_lint::{LateContext, LintContext};
use rustc_middle::lint::in_external_macro;
use super::ALLOW_ATTRIBUTES;
// Separate each crate's features.
pub fn check<'cx>(cx: &LateContext<'cx>, attr: &'cx Attribute) {
if !in_external_macro(cx.sess(), attr.span)
&& let AttrStyle::Outer = attr.style
&& let Some(ident) = attr.ident()
&& !is_from_proc_macro(cx, &attr)
{
span_lint_and_sugg(
cx,
ALLOW_ATTRIBUTES,
ident.span,
"#[allow] attribute found",
"replace it with",
"expect".into(),
Applicability::MachineApplicable,
);
}
}

View File

@ -8,11 +8,6 @@ use rustc_span::sym;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) { pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) {
// Check for the feature
if !cx.tcx.features().lint_reasons {
return;
}
// Check if the reason is present // Check if the reason is present
if let Some(item) = items.last().and_then(NestedMetaItem::meta_item) if let Some(item) = items.last().and_then(NestedMetaItem::meta_item)
&& let MetaItemKind::NameValue(_) = &item.kind && let MetaItemKind::NameValue(_) = &item.kind

View File

@ -1,6 +1,7 @@
//! checks for attributes //! checks for attributes
mod allow_attributes_without_reason; mod allow_attributes_without_reason;
mod allow_attributes;
mod blanket_clippy_restriction_lints; mod blanket_clippy_restriction_lints;
mod deprecated_cfg_attr; mod deprecated_cfg_attr;
mod deprecated_semver; mod deprecated_semver;
@ -14,11 +15,11 @@ mod unnecessary_clippy_cfg;
mod useless_attribute; mod useless_attribute;
mod utils; mod utils;
use clippy_config::msrvs::Msrv; use clippy_config::msrvs::{self, Msrv};
use rustc_ast::{Attribute, MetaItemKind, NestedMetaItem}; use rustc_ast::{Attribute, MetaItemKind, NestedMetaItem};
use rustc_hir::{ImplItem, Item, ItemKind, TraitItem}; use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass}; use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, impl_lint_pass}; use rustc_session::impl_lint_pass;
use rustc_span::sym; use rustc_span::sym;
use utils::{is_lint_level, is_relevant_impl, is_relevant_item, is_relevant_trait}; use utils::{is_lint_level, is_relevant_impl, is_relevant_item, is_relevant_trait};
@ -272,23 +273,17 @@ declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for attributes that allow lints without a reason. /// Checks for attributes that allow lints without a reason.
/// ///
/// (This requires the `lint_reasons` feature)
///
/// ### Why restrict this? /// ### Why restrict this?
/// Justifying each `allow` helps readers understand the reasoning, /// Justifying each `allow` helps readers understand the reasoning,
/// and may allow removing `allow` attributes if their purpose is obsolete. /// and may allow removing `allow` attributes if their purpose is obsolete.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
/// #![feature(lint_reasons)]
///
/// #![allow(clippy::some_lint)] /// #![allow(clippy::some_lint)]
/// ``` /// ```
/// ///
/// Use instead: /// Use instead:
/// ```no_run /// ```no_run
/// #![feature(lint_reasons)]
///
/// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")] /// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
/// ``` /// ```
#[clippy::version = "1.61.0"] #[clippy::version = "1.61.0"]
@ -297,6 +292,41 @@ declare_clippy_lint! {
"ensures that all `allow` and `expect` attributes have a reason" "ensures that all `allow` and `expect` attributes have a reason"
} }
declare_clippy_lint! {
/// ### What it does
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
///
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
///
/// ### Why is this bad?
/// `#[expect]` attributes suppress the lint emission, but emit a warning, if
/// the expectation is unfulfilled. This can be useful to be notified when the
/// lint is no longer triggered.
///
/// ### Example
/// ```rust,ignore
/// #[allow(unused_mut)]
/// fn foo() -> usize {
/// let mut a = Vec::new();
/// a.len()
/// }
/// ```
/// Use instead:
/// ```rust,ignore
/// #[expect(unused_mut)]
/// fn foo() -> usize {
/// let mut a = Vec::new();
/// a.len()
/// }
/// ```
#[clippy::version = "1.70.0"]
pub ALLOW_ATTRIBUTES,
restriction,
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
}
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for `#[should_panic]` attributes without specifying the expected panic message. /// Checks for `#[should_panic]` attributes without specifying the expected panic message.
@ -469,7 +499,12 @@ declare_clippy_lint! {
"duplicated attribute" "duplicated attribute"
} }
declare_lint_pass!(Attributes => [ #[derive(Clone)]
pub struct Attributes {
msrv: Msrv,
}
impl_lint_pass!(Attributes => [
ALLOW_ATTRIBUTES_WITHOUT_REASON, ALLOW_ATTRIBUTES_WITHOUT_REASON,
INLINE_ALWAYS, INLINE_ALWAYS,
DEPRECATED_SEMVER, DEPRECATED_SEMVER,
@ -480,6 +515,13 @@ declare_lint_pass!(Attributes => [
DUPLICATED_ATTRIBUTES, DUPLICATED_ATTRIBUTES,
]); ]);
impl Attributes {
#[must_use]
pub fn new(msrv: Msrv) -> Self {
Self { msrv }
}
}
impl<'tcx> LateLintPass<'tcx> for Attributes { impl<'tcx> LateLintPass<'tcx> for Attributes {
fn check_crate(&mut self, cx: &LateContext<'tcx>) { fn check_crate(&mut self, cx: &LateContext<'tcx>) {
blanket_clippy_restriction_lints::check_command_line(cx); blanket_clippy_restriction_lints::check_command_line(cx);
@ -492,8 +534,15 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
if is_lint_level(ident.name, attr.id) { if is_lint_level(ident.name, attr.id) {
blanket_clippy_restriction_lints::check(cx, ident.name, items); blanket_clippy_restriction_lints::check(cx, ident.name, items);
} }
if matches!(ident.name, sym::allow) {
if self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
allow_attributes::check(cx, attr);
}
}
if matches!(ident.name, sym::allow | sym::expect) { if matches!(ident.name, sym::allow | sym::expect) {
allow_attributes_without_reason::check(cx, ident.name, items, attr); if self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
allow_attributes_without_reason::check(cx, ident.name, items, attr);
}
} }
if items.is_empty() || !attr.has_name(sym::deprecated) { if items.is_empty() || !attr.has_name(sym::deprecated) {
return; return;
@ -537,6 +586,8 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
inline_always::check(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id())); inline_always::check(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
} }
} }
extract_msrv_attr!(LateContext);
} }
pub struct EarlyAttributes { pub struct EarlyAttributes {

View File

@ -38,7 +38,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
#[cfg(feature = "internal")] #[cfg(feature = "internal")]
crate::utils::internal_lints::unsorted_clippy_utils_paths::UNSORTED_CLIPPY_UTILS_PATHS_INFO, crate::utils::internal_lints::unsorted_clippy_utils_paths::UNSORTED_CLIPPY_UTILS_PATHS_INFO,
crate::absolute_paths::ABSOLUTE_PATHS_INFO, crate::absolute_paths::ABSOLUTE_PATHS_INFO,
crate::allow_attributes::ALLOW_ATTRIBUTES_INFO,
crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO, crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO,
crate::approx_const::APPROX_CONSTANT_INFO, crate::approx_const::APPROX_CONSTANT_INFO,
crate::arc_with_non_send_sync::ARC_WITH_NON_SEND_SYNC_INFO, crate::arc_with_non_send_sync::ARC_WITH_NON_SEND_SYNC_INFO,
@ -49,6 +48,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
crate::assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES_INFO, crate::assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES_INFO,
crate::assigning_clones::ASSIGNING_CLONES_INFO, crate::assigning_clones::ASSIGNING_CLONES_INFO,
crate::async_yields_async::ASYNC_YIELDS_ASYNC_INFO, crate::async_yields_async::ASYNC_YIELDS_ASYNC_INFO,
crate::attrs::ALLOW_ATTRIBUTES_INFO,
crate::attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON_INFO, crate::attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON_INFO,
crate::attrs::BLANKET_CLIPPY_RESTRICTION_LINTS_INFO, crate::attrs::BLANKET_CLIPPY_RESTRICTION_LINTS_INFO,
crate::attrs::DEPRECATED_CFG_ATTR_INFO, crate::attrs::DEPRECATED_CFG_ATTR_INFO,

View File

@ -6,7 +6,7 @@
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![cfg_attr(bootstrap, feature(lint_reasons))]
#![feature(never_type)] #![feature(never_type)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
@ -73,7 +73,6 @@ mod renamed_lints;
// begin lints modules, do not remove this comment, its used in `update_lints` // begin lints modules, do not remove this comment, its used in `update_lints`
mod absolute_paths; mod absolute_paths;
mod allow_attributes;
mod almost_complete_range; mod almost_complete_range;
mod approx_const; mod approx_const;
mod arc_with_non_send_sync; mod arc_with_non_send_sync;
@ -699,7 +698,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
store.register_late_pass(|_| Box::new(mut_reference::UnnecessaryMutPassed)); store.register_late_pass(|_| Box::new(mut_reference::UnnecessaryMutPassed));
store.register_late_pass(|_| Box::<significant_drop_tightening::SignificantDropTightening<'_>>::default()); store.register_late_pass(|_| Box::<significant_drop_tightening::SignificantDropTightening<'_>>::default());
store.register_late_pass(|_| Box::new(len_zero::LenZero)); store.register_late_pass(|_| Box::new(len_zero::LenZero));
store.register_late_pass(|_| Box::new(attrs::Attributes)); store.register_late_pass(move |_| Box::new(attrs::Attributes::new(msrv())));
store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions)); store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions));
store.register_late_pass(|_| Box::new(unicode::Unicode)); store.register_late_pass(|_| Box::new(unicode::Unicode));
store.register_late_pass(|_| Box::new(uninit_vec::UninitVec)); store.register_late_pass(|_| Box::new(uninit_vec::UninitVec));
@ -1065,7 +1064,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
store.register_late_pass(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized)); store.register_late_pass(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized));
store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock)); store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock));
store.register_late_pass(|_| Box::new(let_with_type_underscore::UnderscoreTyped)); store.register_late_pass(|_| Box::new(let_with_type_underscore::UnderscoreTyped));
store.register_late_pass(|_| Box::new(allow_attributes::AllowAttribute));
store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(msrv()))); store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(msrv())));
store.register_late_pass(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct)); store.register_late_pass(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct));
store.register_late_pass(move |_| { store.register_late_pass(move |_| {

View File

@ -5,7 +5,7 @@
#![feature(f16)] #![feature(f16)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![cfg_attr(bootstrap, feature(lint_reasons))]
#![feature(never_type)] #![feature(never_type)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(assert_matches)] #![feature(assert_matches)]

View File

@ -2,7 +2,7 @@
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![cfg_attr(bootstrap, feature(lint_reasons))]
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap // warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)] #![warn(rust_2018_idioms, unused_lifetimes)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
mod a; mod a;

View File

@ -1,5 +1,5 @@
//! Tests macro_metavars_in_unsafe with default configuration //! Tests macro_metavars_in_unsafe with default configuration
#![feature(decl_macro, lint_reasons)] #![feature(decl_macro)]
#![warn(clippy::macro_metavars_in_unsafe)] #![warn(clippy::macro_metavars_in_unsafe)]
#![allow(clippy::no_effect)] #![allow(clippy::no_effect)]

View File

@ -1,5 +1,5 @@
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
| |
LL | /* Safety: */ unsafe {} LL | /* Safety: */ unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]` = help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -17,7 +17,7 @@ LL | unsafe {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
| |
LL | let _ = (42, unsafe {}, "test", unsafe {}); LL | let _ = (42, unsafe {}, "test", unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
| |
LL | let _ = (42, unsafe {}, "test", unsafe {}); LL | let _ = (42, unsafe {}, "test", unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
| |
LL | let _ = *unsafe { &42 }; LL | let _ = *unsafe { &42 };
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
| |
LL | let _ = match unsafe {} { LL | let _ = match unsafe {} {
| ^^^^^^^^^ | ^^^^^^^^^
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
| |
LL | let _ = &unsafe {}; LL | let _ = &unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
| |
LL | let _ = [unsafe {}; 5]; LL | let _ = [unsafe {}; 5];
| ^^^^^^^^^ | ^^^^^^^^^
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
| |
LL | let _ = unsafe {}; LL | let _ = unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
| |
LL | t!(unsafe {}); LL | t!(unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -105,7 +105,7 @@ LL | t!(unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -117,7 +117,7 @@ LL | t!();
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
| |
LL | unsafe {} // SAFETY: LL | unsafe {} // SAFETY:
| ^^^^^^^^^ | ^^^^^^^^^
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
| |
LL | unsafe { LL | unsafe {
| ^^^^^^^^ | ^^^^^^^^
@ -133,7 +133,7 @@ LL | unsafe {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
| |
LL | unsafe {}; LL | unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -141,7 +141,7 @@ LL | unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
| |
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) }); LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
| |
LL | unsafe impl A for () {} LL | unsafe impl A for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
| |
LL | unsafe impl B for (u32) {} LL | unsafe impl B for (u32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
| |
LL | unsafe impl T for (i32) {} LL | unsafe impl T for (i32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
| |
LL | unsafe impl T for (bool) {} LL | unsafe impl T for (bool) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
| |
LL | unsafe impl NoComment for () {} LL | unsafe impl NoComment for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
| |
LL | /* SAFETY: */ unsafe impl InlineComment for () {} LL | /* SAFETY: */ unsafe impl InlineComment for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
| |
LL | unsafe impl TrailingComment for () {} // SAFETY: LL | unsafe impl TrailingComment for () {} // SAFETY:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: constant item has unnecessary safety comment error: constant item has unnecessary safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
| |
LL | const BIG_NUMBER: i32 = 1000000; LL | const BIG_NUMBER: i32 = 1000000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider removing the safety comment help: consider removing the safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
| |
LL | // SAFETY: LL | // SAFETY:
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -255,7 +255,7 @@ LL | // SAFETY:
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
| |
LL | unsafe impl Interference for () {} LL | unsafe impl Interference for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
| |
LL | unsafe impl ImplInFn for () {} LL | unsafe impl ImplInFn for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
| |
LL | unsafe impl CrateRoot for () {} LL | unsafe impl CrateRoot for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: statement has unnecessary safety comment error: statement has unnecessary safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
| |
LL | / let _ = { LL | / let _ = {
LL | | if unsafe { true } { LL | | if unsafe { true } {
@ -291,13 +291,13 @@ LL | | };
| |______^ | |______^
| |
help: consider removing the safety comment help: consider removing the safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
| |
LL | // SAFETY: this is more than one level away, so it should warn LL | // SAFETY: this is more than one level away, so it should warn
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
| |
LL | if unsafe { true } { LL | if unsafe { true } {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
@ -305,7 +305,7 @@ LL | if unsafe { true } {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
| |
LL | let bar = unsafe {}; LL | let bar = unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^

View File

@ -1,5 +1,5 @@
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
| |
LL | /* Safety: */ unsafe {} LL | /* Safety: */ unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]` = help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -17,7 +17,7 @@ LL | unsafe {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
| |
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }]; LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
| |
LL | let _ = (42, unsafe {}, "test", unsafe {}); LL | let _ = (42, unsafe {}, "test", unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
| |
LL | let _ = (42, unsafe {}, "test", unsafe {}); LL | let _ = (42, unsafe {}, "test", unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
| |
LL | let _ = *unsafe { &42 }; LL | let _ = *unsafe { &42 };
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
| |
LL | let _ = match unsafe {} { LL | let _ = match unsafe {} {
| ^^^^^^^^^ | ^^^^^^^^^
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
| |
LL | let _ = &unsafe {}; LL | let _ = &unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
| |
LL | let _ = [unsafe {}; 5]; LL | let _ = [unsafe {}; 5];
| ^^^^^^^^^ | ^^^^^^^^^
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
| |
LL | let _ = unsafe {}; LL | let _ = unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
| |
LL | t!(unsafe {}); LL | t!(unsafe {});
| ^^^^^^^^^ | ^^^^^^^^^
@ -105,7 +105,7 @@ LL | t!(unsafe {});
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -117,7 +117,7 @@ LL | t!();
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
| |
LL | unsafe {} // SAFETY: LL | unsafe {} // SAFETY:
| ^^^^^^^^^ | ^^^^^^^^^
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
| |
LL | unsafe { LL | unsafe {
| ^^^^^^^^ | ^^^^^^^^
@ -133,7 +133,7 @@ LL | unsafe {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
| |
LL | unsafe {}; LL | unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -141,7 +141,7 @@ LL | unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
| |
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) }); LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
| |
LL | unsafe impl A for () {} LL | unsafe impl A for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
| |
LL | unsafe impl B for (u32) {} LL | unsafe impl B for (u32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
| |
LL | unsafe impl T for (i32) {} LL | unsafe impl T for (i32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
| |
LL | unsafe impl T for $t {} LL | unsafe impl T for $t {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
| |
LL | unsafe impl T for (bool) {} LL | unsafe impl T for (bool) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
| |
LL | unsafe impl NoComment for () {} LL | unsafe impl NoComment for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
| |
LL | /* SAFETY: */ unsafe impl InlineComment for () {} LL | /* SAFETY: */ unsafe impl InlineComment for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
| |
LL | unsafe impl TrailingComment for () {} // SAFETY: LL | unsafe impl TrailingComment for () {} // SAFETY:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: constant item has unnecessary safety comment error: constant item has unnecessary safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
| |
LL | const BIG_NUMBER: i32 = 1000000; LL | const BIG_NUMBER: i32 = 1000000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider removing the safety comment help: consider removing the safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
| |
LL | // SAFETY: LL | // SAFETY:
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -255,7 +255,7 @@ LL | // SAFETY:
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
| |
LL | unsafe impl Interference for () {} LL | unsafe impl Interference for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
| |
LL | unsafe impl ImplInFn for () {} LL | unsafe impl ImplInFn for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe impl missing a safety comment error: unsafe impl missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
| |
LL | unsafe impl CrateRoot for () {} LL | unsafe impl CrateRoot for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:507:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:9
| |
LL | unsafe {}; LL | unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -287,7 +287,7 @@ LL | unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: statement has unnecessary safety comment error: statement has unnecessary safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
| |
LL | / let _ = { LL | / let _ = {
LL | | if unsafe { true } { LL | | if unsafe { true } {
@ -299,13 +299,13 @@ LL | | };
| |______^ | |______^
| |
help: consider removing the safety comment help: consider removing the safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
| |
LL | // SAFETY: this is more than one level away, so it should warn LL | // SAFETY: this is more than one level away, so it should warn
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
| |
LL | if unsafe { true } { LL | if unsafe { true } {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
@ -313,7 +313,7 @@ LL | if unsafe { true } {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
| |
LL | let bar = unsafe {}; LL | let bar = unsafe {};
| ^^^^^^^^^ | ^^^^^^^^^
@ -321,7 +321,7 @@ LL | let bar = unsafe {};
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:532:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:531:9
| |
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -329,7 +329,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:536:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:535:9
| |
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -337,7 +337,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:540:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:539:9
| |
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -345,7 +345,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:546:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:545:5
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -353,7 +353,7 @@ LL | unsafe {}
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:550:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:549:5
| |
LL | unsafe { LL | unsafe {
| ^^^^^^^^ | ^^^^^^^^
@ -361,7 +361,7 @@ LL | unsafe {
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:557:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:556:9
| |
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -369,7 +369,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:562:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:561:9
| |
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -377,7 +377,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:568:9 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:567:9
| |
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() }; LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -385,7 +385,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
= help: consider adding a safety comment on the preceding line = help: consider adding a safety comment on the preceding line
error: unsafe block missing a safety comment error: unsafe block missing a safety comment
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:573:5 --> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:572:5
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^^^^ | ^^^^^^^^^

View File

@ -10,7 +10,6 @@
clippy::let_unit_value, clippy::let_unit_value,
clippy::missing_safety_doc clippy::missing_safety_doc
)] )]
#![feature(lint_reasons)]
extern crate proc_macro_unsafe; extern crate proc_macro_unsafe;

View File

@ -1,7 +1,6 @@
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs
#![allow(unused)] #![allow(unused)]
#![warn(clippy::allow_attributes)] #![warn(clippy::allow_attributes)]
#![feature(lint_reasons)]
#![no_main] #![no_main]
extern crate proc_macros; extern crate proc_macros;
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
fn ignore_inner_attr() { fn ignore_inner_attr() {
#![allow(unused)] // Should not lint #![allow(unused)] // Should not lint
} }
#[clippy::msrv = "1.81"]
fn msrv_1_81() {
#[expect(unused)]
let x = 1;
}
#[clippy::msrv = "1.80"]
fn msrv_1_80() {
#[allow(unused)]
let x = 1;
}

View File

@ -1,7 +1,6 @@
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs
#![allow(unused)] #![allow(unused)]
#![warn(clippy::allow_attributes)] #![warn(clippy::allow_attributes)]
#![feature(lint_reasons)]
#![no_main] #![no_main]
extern crate proc_macros; extern crate proc_macros;
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
fn ignore_inner_attr() { fn ignore_inner_attr() {
#![allow(unused)] // Should not lint #![allow(unused)] // Should not lint
} }
#[clippy::msrv = "1.81"]
fn msrv_1_81() {
#[allow(unused)]
let x = 1;
}
#[clippy::msrv = "1.80"]
fn msrv_1_80() {
#[allow(unused)]
let x = 1;
}

View File

@ -1,5 +1,5 @@
error: #[allow] attribute found error: #[allow] attribute found
--> tests/ui/allow_attributes.rs:13:3 --> tests/ui/allow_attributes.rs:12:3
| |
LL | #[allow(dead_code)] LL | #[allow(dead_code)]
| ^^^^^ help: replace it with: `expect` | ^^^^^ help: replace it with: `expect`
@ -8,10 +8,24 @@ LL | #[allow(dead_code)]
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]` = help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
error: #[allow] attribute found error: #[allow] attribute found
--> tests/ui/allow_attributes.rs:22:30 --> tests/ui/allow_attributes.rs:21:30
| |
LL | #[cfg_attr(panic = "unwind", allow(dead_code))] LL | #[cfg_attr(panic = "unwind", allow(dead_code))]
| ^^^^^ help: replace it with: `expect` | ^^^^^ help: replace it with: `expect`
error: aborting due to 2 previous errors error: #[allow] attribute found
--> tests/ui/allow_attributes.rs:52:7
|
LL | #[allow(unused)]
| ^^^^^ help: replace it with: `expect`
error: #[allow] attribute found
--> tests/ui/allow_attributes.rs:52:7
|
LL | #[allow(unused)]
| ^^^^^ help: replace it with: `expect`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors

View File

@ -1,5 +1,4 @@
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs
#![feature(lint_reasons)]
#![deny(clippy::allow_attributes_without_reason)] #![deny(clippy::allow_attributes_without_reason)]
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)] #![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
@ -42,3 +41,15 @@ pub fn trigger_fp_result() -> Result<(), &'static str> {
Err("asdf")?; Err("asdf")?;
Ok(()) Ok(())
} }
#[clippy::msrv = "1.81"]
fn msrv_1_81() {
#[allow(unused)]
let _ = 1;
}
#[clippy::msrv = "1.80"]
fn msrv_1_80() {
#[allow(unused)]
let _ = 1;
}

View File

@ -1,18 +1,18 @@
error: `allow` attribute without specifying a reason error: `allow` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:4:1 --> tests/ui/allow_attributes_without_reason.rs:3:1
| |
LL | #![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)] LL | #![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: try adding a reason at the end with `, reason = ".."` = help: try adding a reason at the end with `, reason = ".."`
note: the lint level is defined here note: the lint level is defined here
--> tests/ui/allow_attributes_without_reason.rs:3:9 --> tests/ui/allow_attributes_without_reason.rs:2:9
| |
LL | #![deny(clippy::allow_attributes_without_reason)] LL | #![deny(clippy::allow_attributes_without_reason)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `allow` attribute without specifying a reason error: `allow` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:10:1 --> tests/ui/allow_attributes_without_reason.rs:9:1
| |
LL | #[allow(dead_code)] LL | #[allow(dead_code)]
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
@ -20,7 +20,7 @@ LL | #[allow(dead_code)]
= help: try adding a reason at the end with `, reason = ".."` = help: try adding a reason at the end with `, reason = ".."`
error: `allow` attribute without specifying a reason error: `allow` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:11:1 --> tests/ui/allow_attributes_without_reason.rs:10:1
| |
LL | #[allow(dead_code, deprecated)] LL | #[allow(dead_code, deprecated)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -28,12 +28,29 @@ LL | #[allow(dead_code, deprecated)]
= help: try adding a reason at the end with `, reason = ".."` = help: try adding a reason at the end with `, reason = ".."`
error: `expect` attribute without specifying a reason error: `expect` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:12:1 --> tests/ui/allow_attributes_without_reason.rs:11:1
| |
LL | #[expect(dead_code)] LL | #[expect(dead_code)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
= help: try adding a reason at the end with `, reason = ".."` = help: try adding a reason at the end with `, reason = ".."`
error: aborting due to 4 previous errors error: `allow` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
LL | #[allow(unused)]
| ^^^^^^^^^^^^^^^^
|
= help: try adding a reason at the end with `, reason = ".."`
error: `allow` attribute without specifying a reason
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
LL | #[allow(unused)]
| ^^^^^^^^^^^^^^^^
|
= help: try adding a reason at the end with `, reason = ".."`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![feature(async_closure)] #![feature(async_closure)]
#![warn(clippy::async_yields_async)] #![warn(clippy::async_yields_async)]
#![allow(clippy::redundant_async_block)] #![allow(clippy::redundant_async_block)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![feature(async_closure)] #![feature(async_closure)]
#![warn(clippy::async_yields_async)] #![warn(clippy::async_yields_async)]
#![allow(clippy::redundant_async_block)] #![allow(clippy::redundant_async_block)]

View File

@ -1,5 +1,5 @@
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:39:9 --> tests/ui/async_yields_async.rs:38:9
| |
LL | let _h = async { LL | let _h = async {
| _____________________- | _____________________-
@ -20,7 +20,7 @@ LL + }.await
| |
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:44:9 --> tests/ui/async_yields_async.rs:43:9
| |
LL | let _i = async { LL | let _i = async {
| ____________________- | ____________________-
@ -33,7 +33,7 @@ LL | | };
| |_____- outer async construct | |_____- outer async construct
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:50:9 --> tests/ui/async_yields_async.rs:49:9
| |
LL | let _j = async || { LL | let _j = async || {
| ________________________- | ________________________-
@ -52,7 +52,7 @@ LL + }.await
| |
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:55:9 --> tests/ui/async_yields_async.rs:54:9
| |
LL | let _k = async || { LL | let _k = async || {
| _______________________- | _______________________-
@ -65,7 +65,7 @@ LL | | };
| |_____- outer async construct | |_____- outer async construct
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:57:23 --> tests/ui/async_yields_async.rs:56:23
| |
LL | let _l = async || CustomFutureType; LL | let _l = async || CustomFutureType;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -75,7 +75,7 @@ LL | let _l = async || CustomFutureType;
| help: consider awaiting this value: `CustomFutureType.await` | help: consider awaiting this value: `CustomFutureType.await`
error: an async construct yields a type which is itself awaitable error: an async construct yields a type which is itself awaitable
--> tests/ui/async_yields_async.rs:63:9 --> tests/ui/async_yields_async.rs:62:9
| |
LL | let _m = async || { LL | let _m = async || {
| _______________________- | _______________________-

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow( #![allow(
clippy::borrowed_box, clippy::borrowed_box,
clippy::needless_pass_by_value, clippy::needless_pass_by_value,

View File

@ -1,5 +1,5 @@
error: local variable doesn't need to be boxed here error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:40:13 --> tests/ui/boxed_local.rs:39:13
| |
LL | fn warn_arg(x: Box<A>) { LL | fn warn_arg(x: Box<A>) {
| ^ | ^
@ -8,19 +8,19 @@ LL | fn warn_arg(x: Box<A>) {
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]` = help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
error: local variable doesn't need to be boxed here error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:123:12 --> tests/ui/boxed_local.rs:122:12
| |
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {} LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: local variable doesn't need to be boxed here error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:188:44 --> tests/ui/boxed_local.rs:187:44
| |
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 { LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
| ^ | ^
error: local variable doesn't need to be boxed here error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:196:16 --> tests/ui/boxed_local.rs:195:16
| |
LL | fn foo(x: Box<u32>) {} LL | fn foo(x: Box<u32>) {}
| ^ | ^

View File

@ -1,5 +1,4 @@
//@no-rustfix: overlapping suggestions //@no-rustfix: overlapping suggestions
#![feature(lint_reasons)]
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![allow( #![allow(
clippy::if_same_then_else, clippy::if_same_then_else,

View File

@ -1,5 +1,5 @@
error: called `unwrap` on `x` after checking its variant with `is_some` error: called `unwrap` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:47:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:46:9
| |
LL | if x.is_some() { LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x` | -------------- help: try: `if let Some(..) = x`
@ -8,13 +8,13 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35 --> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
| |
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_some` error: called `expect` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:50:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:49:9
| |
LL | if x.is_some() { LL | if x.is_some() {
| -------------- help: try: `if let Some(..) = x` | -------------- help: try: `if let Some(..) = x`
@ -23,7 +23,7 @@ LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:54:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
| |
LL | if x.is_some() { LL | if x.is_some() {
| ----------- because of this check | ----------- because of this check
@ -32,13 +32,13 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:2:9
| |
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)] LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `expect()` will always panic error: this call to `expect()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:57:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
| |
LL | if x.is_some() { LL | if x.is_some() {
| ----------- because of this check | ----------- because of this check
@ -47,7 +47,7 @@ LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:62:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
| |
LL | if x.is_none() { LL | if x.is_none() {
| ----------- because of this check | ----------- because of this check
@ -56,7 +56,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_none` error: called `unwrap` on `x` after checking its variant with `is_none`
--> tests/ui/checked_unwrap/simple_conditionals.rs:66:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:65:9
| |
LL | if x.is_none() { LL | if x.is_none() {
| -------------- help: try: `if let Some(..) = x` | -------------- help: try: `if let Some(..) = x`
@ -65,7 +65,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_some` error: called `unwrap` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:14:13 --> tests/ui/checked_unwrap/simple_conditionals.rs:13:13
| |
LL | if $a.is_some() { LL | if $a.is_some() {
| --------------- help: try: `if let Some(..) = x` | --------------- help: try: `if let Some(..) = x`
@ -79,7 +79,7 @@ LL | m!(x);
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) = 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` error: called `unwrap` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:79:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:78:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x` | ------------ help: try: `if let Ok(..) = x`
@ -88,7 +88,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_ok` error: called `expect` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:82:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:81:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| ------------ help: try: `if let Ok(..) = x` | ------------ help: try: `if let Ok(..) = x`
@ -97,7 +97,7 @@ LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap_err()` will always panic error: this call to `unwrap_err()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:85:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:84:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| --------- because of this check | --------- because of this check
@ -106,7 +106,7 @@ LL | x.unwrap_err();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:89:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| --------- because of this check | --------- because of this check
@ -115,7 +115,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: this call to `expect()` will always panic error: this call to `expect()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:92:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| --------- because of this check | --------- because of this check
@ -124,7 +124,7 @@ LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_ok` error: called `unwrap_err` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:95:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:94:9
| |
LL | if x.is_ok() { LL | if x.is_ok() {
| ------------ help: try: `if let Err(..) = x` | ------------ help: try: `if let Err(..) = x`
@ -133,7 +133,7 @@ LL | x.unwrap_err();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:100:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
| |
LL | if x.is_err() { LL | if x.is_err() {
| ---------- because of this check | ---------- because of this check
@ -142,7 +142,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_err` error: called `unwrap_err` on `x` after checking its variant with `is_err`
--> tests/ui/checked_unwrap/simple_conditionals.rs:103:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:102:9
| |
LL | if x.is_err() { LL | if x.is_err() {
| ------------- help: try: `if let Err(..) = x` | ------------- help: try: `if let Err(..) = x`
@ -151,7 +151,7 @@ LL | x.unwrap_err();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_err` error: called `unwrap` on `x` after checking its variant with `is_err`
--> tests/ui/checked_unwrap/simple_conditionals.rs:107:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:106:9
| |
LL | if x.is_err() { LL | if x.is_err() {
| ------------- help: try: `if let Ok(..) = x` | ------------- help: try: `if let Ok(..) = x`
@ -160,7 +160,7 @@ LL | x.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: this call to `unwrap_err()` will always panic error: this call to `unwrap_err()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:110:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:109:9
| |
LL | if x.is_err() { LL | if x.is_err() {
| ---------- because of this check | ---------- because of this check
@ -169,7 +169,7 @@ LL | x.unwrap_err();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some` error: called `unwrap` on `option` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:135:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
| |
LL | if option.is_some() { LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &option` | ------------------- help: try: `if let Some(..) = &option`
@ -177,7 +177,7 @@ LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:138:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
| |
LL | if option.is_some() { LL | if option.is_some() {
| ---------------- because of this check | ---------------- because of this check
@ -186,7 +186,7 @@ LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok` error: called `unwrap` on `result` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:145:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
| |
LL | if result.is_ok() { LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &result` | ----------------- help: try: `if let Ok(..) = &result`
@ -194,7 +194,7 @@ LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:148:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
| |
LL | if result.is_ok() { LL | if result.is_ok() {
| -------------- because of this check | -------------- because of this check
@ -203,7 +203,7 @@ LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some` error: called `unwrap` on `option` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:154:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:153:9
| |
LL | if option.is_some() { LL | if option.is_some() {
| ------------------- help: try: `if let Some(..) = &mut option` | ------------------- help: try: `if let Some(..) = &mut option`
@ -211,7 +211,7 @@ LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:157:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:156:9
| |
LL | if option.is_some() { LL | if option.is_some() {
| ---------------- because of this check | ---------------- because of this check
@ -220,7 +220,7 @@ LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap` on `result` after checking its variant with `is_ok` error: called `unwrap` on `result` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:163:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
| |
LL | if result.is_ok() { LL | if result.is_ok() {
| ----------------- help: try: `if let Ok(..) = &mut result` | ----------------- help: try: `if let Ok(..) = &mut result`
@ -228,7 +228,7 @@ LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:166:9 --> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
| |
LL | if result.is_ok() { LL | if result.is_ok() {
| -------------- because of this check | -------------- because of this check

View File

@ -1,6 +1,5 @@
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs
#![feature(lint_reasons)]
#![warn(clippy::default_numeric_fallback)] #![warn(clippy::default_numeric_fallback)]
#![allow( #![allow(
unused, unused,

View File

@ -1,6 +1,5 @@
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs
#![feature(lint_reasons)]
#![warn(clippy::default_numeric_fallback)] #![warn(clippy::default_numeric_fallback)]
#![allow( #![allow(
unused, unused,

View File

@ -1,5 +1,5 @@
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:21:17 --> tests/ui/default_numeric_fallback_i32.rs:20:17
| |
LL | let x = 22; LL | let x = 22;
| ^^ help: consider adding suffix: `22_i32` | ^^ help: consider adding suffix: `22_i32`
@ -8,145 +8,145 @@ LL | let x = 22;
= help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]` = help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:22:18 --> tests/ui/default_numeric_fallback_i32.rs:21:18
| |
LL | let x = [1, 2, 3]; LL | let x = [1, 2, 3];
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:22:21 --> tests/ui/default_numeric_fallback_i32.rs:21:21
| |
LL | let x = [1, 2, 3]; LL | let x = [1, 2, 3];
| ^ help: consider adding suffix: `2_i32` | ^ help: consider adding suffix: `2_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:22:24 --> tests/ui/default_numeric_fallback_i32.rs:21:24
| |
LL | let x = [1, 2, 3]; LL | let x = [1, 2, 3];
| ^ help: consider adding suffix: `3_i32` | ^ help: consider adding suffix: `3_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:23:28 --> tests/ui/default_numeric_fallback_i32.rs:22:28
| |
LL | let x = if true { (1, 2) } else { (3, 4) }; LL | let x = if true { (1, 2) } else { (3, 4) };
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:23:31 --> tests/ui/default_numeric_fallback_i32.rs:22:31
| |
LL | let x = if true { (1, 2) } else { (3, 4) }; LL | let x = if true { (1, 2) } else { (3, 4) };
| ^ help: consider adding suffix: `2_i32` | ^ help: consider adding suffix: `2_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:23:44 --> tests/ui/default_numeric_fallback_i32.rs:22:44
| |
LL | let x = if true { (1, 2) } else { (3, 4) }; LL | let x = if true { (1, 2) } else { (3, 4) };
| ^ help: consider adding suffix: `3_i32` | ^ help: consider adding suffix: `3_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:23:47 --> tests/ui/default_numeric_fallback_i32.rs:22:47
| |
LL | let x = if true { (1, 2) } else { (3, 4) }; LL | let x = if true { (1, 2) } else { (3, 4) };
| ^ help: consider adding suffix: `4_i32` | ^ help: consider adding suffix: `4_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:24:23 --> tests/ui/default_numeric_fallback_i32.rs:23:23
| |
LL | let x = match 1 { LL | let x = match 1 {
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:25:13 --> tests/ui/default_numeric_fallback_i32.rs:24:13
| |
LL | 1 => 1, LL | 1 => 1,
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:25:18 --> tests/ui/default_numeric_fallback_i32.rs:24:18
| |
LL | 1 => 1, LL | 1 => 1,
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:26:18 --> tests/ui/default_numeric_fallback_i32.rs:25:18
| |
LL | _ => 2, LL | _ => 2,
| ^ help: consider adding suffix: `2_i32` | ^ help: consider adding suffix: `2_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:45:21 --> tests/ui/default_numeric_fallback_i32.rs:44:21
| |
LL | let y = 1; LL | let y = 1;
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:53:21 --> tests/ui/default_numeric_fallback_i32.rs:52:21
| |
LL | let y = 1; LL | let y = 1;
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:59:21 --> tests/ui/default_numeric_fallback_i32.rs:58:21
| |
LL | let y = 1; LL | let y = 1;
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:67:21 --> tests/ui/default_numeric_fallback_i32.rs:66:21
| |
LL | let y = 1; LL | let y = 1;
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:83:27 --> tests/ui/default_numeric_fallback_i32.rs:82:27
| |
LL | let f = || -> _ { 1 }; LL | let f = || -> _ { 1 };
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:87:29 --> tests/ui/default_numeric_fallback_i32.rs:86:29
| |
LL | let f = || -> i32 { 1 }; LL | let f = || -> i32 { 1 };
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:101:21 --> tests/ui/default_numeric_fallback_i32.rs:100:21
| |
LL | generic_arg(1); LL | generic_arg(1);
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:104:32 --> tests/ui/default_numeric_fallback_i32.rs:103:32
| |
LL | let x: _ = generic_arg(1); LL | let x: _ = generic_arg(1);
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:122:28 --> tests/ui/default_numeric_fallback_i32.rs:121:28
| |
LL | GenericStruct { x: 1 }; LL | GenericStruct { x: 1 };
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:125:36 --> tests/ui/default_numeric_fallback_i32.rs:124:36
| |
LL | let _ = GenericStruct { x: 1 }; LL | let _ = GenericStruct { x: 1 };
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:143:24 --> tests/ui/default_numeric_fallback_i32.rs:142:24
| |
LL | GenericEnum::X(1); LL | GenericEnum::X(1);
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:163:23 --> tests/ui/default_numeric_fallback_i32.rs:162:23
| |
LL | s.generic_arg(1); LL | s.generic_arg(1);
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:173:25 --> tests/ui/default_numeric_fallback_i32.rs:172:25
| |
LL | inline!(let x = 22;); LL | inline!(let x = 22;);
| ^^ help: consider adding suffix: `22_i32` | ^^ help: consider adding suffix: `22_i32`
@ -154,19 +154,19 @@ LL | inline!(let x = 22;);
= note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:215:29 --> tests/ui/default_numeric_fallback_i32.rs:214:29
| |
LL | let data_i32 = vec![1, 2, 3]; LL | let data_i32 = vec![1, 2, 3];
| ^ help: consider adding suffix: `1_i32` | ^ help: consider adding suffix: `1_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:215:32 --> tests/ui/default_numeric_fallback_i32.rs:214:32
| |
LL | let data_i32 = vec![1, 2, 3]; LL | let data_i32 = vec![1, 2, 3];
| ^ help: consider adding suffix: `2_i32` | ^ help: consider adding suffix: `2_i32`
error: default numeric fallback might occur error: default numeric fallback might occur
--> tests/ui/default_numeric_fallback_i32.rs:215:35 --> tests/ui/default_numeric_fallback_i32.rs:214:35
| |
LL | let data_i32 = vec![1, 2, 3]; LL | let data_i32 = vec![1, 2, 3];
| ^ help: consider adding suffix: `3_i32` | ^ help: consider adding suffix: `3_i32`

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow(unused)] #![allow(unused)]
#![warn(clippy::derive_partial_eq_without_eq)] #![warn(clippy::derive_partial_eq_without_eq)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow(unused)] #![allow(unused)]
#![warn(clippy::derive_partial_eq_without_eq)] #![warn(clippy::derive_partial_eq_without_eq)]

View File

@ -1,5 +1,5 @@
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:12:17 --> tests/ui/derive_partial_eq_without_eq.rs:11:17
| |
LL | #[derive(Debug, PartialEq)] LL | #[derive(Debug, PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
@ -8,73 +8,73 @@ LL | #[derive(Debug, PartialEq)]
= help: to override `-D warnings` add `#[allow(clippy::derive_partial_eq_without_eq)]` = help: to override `-D warnings` add `#[allow(clippy::derive_partial_eq_without_eq)]`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:70:10 --> tests/ui/derive_partial_eq_without_eq.rs:69:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:76:10 --> tests/ui/derive_partial_eq_without_eq.rs:75:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:82:10 --> tests/ui/derive_partial_eq_without_eq.rs:81:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:85:10 --> tests/ui/derive_partial_eq_without_eq.rs:84:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:91:10 --> tests/ui/derive_partial_eq_without_eq.rs:90:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:97:10 --> tests/ui/derive_partial_eq_without_eq.rs:96:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:110:17 --> tests/ui/derive_partial_eq_without_eq.rs:109:17
| |
LL | #[derive(Debug, PartialEq, Clone)] LL | #[derive(Debug, PartialEq, Clone)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:113:10 --> tests/ui/derive_partial_eq_without_eq.rs:112:10
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:120:14 --> tests/ui/derive_partial_eq_without_eq.rs:119:14
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:123:14 --> tests/ui/derive_partial_eq_without_eq.rs:122:14
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:183:14 --> tests/ui/derive_partial_eq_without_eq.rs:182:14
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
error: you are deriving `PartialEq` and can implement `Eq` error: you are deriving `PartialEq` and can implement `Eq`
--> tests/ui/derive_partial_eq_without_eq.rs:191:14 --> tests/ui/derive_partial_eq_without_eq.rs:190:14
| |
LL | #[derive(PartialEq)] LL | #[derive(PartialEq)]
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
//! This file tests the `#[expect]` attribute implementation for tool lints. The same //! 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 //! file is used to test clippy and rustdoc. Any changes to this file should be synced
//! to the other test files as well. //! to the other test files as well.

View File

@ -1,5 +1,5 @@
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:31:14 --> tests/ui/expect_tool_lint_rfc_2383.rs:30:14
| |
LL | #[expect(dead_code)] LL | #[expect(dead_code)]
| ^^^^^^^^^ | ^^^^^^^^^
@ -8,31 +8,31 @@ LL | #[expect(dead_code)]
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]` = help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:37:18 --> tests/ui/expect_tool_lint_rfc_2383.rs:36:18
| |
LL | #[expect(invalid_nan_comparisons)] LL | #[expect(invalid_nan_comparisons)]
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:108:14 --> tests/ui/expect_tool_lint_rfc_2383.rs:107:14
| |
LL | #[expect(clippy::almost_swapped)] LL | #[expect(clippy::almost_swapped)]
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:116:14 --> tests/ui/expect_tool_lint_rfc_2383.rs:115:14
| |
LL | #[expect(clippy::bytes_nth)] LL | #[expect(clippy::bytes_nth)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:122:14 --> tests/ui/expect_tool_lint_rfc_2383.rs:121:14
| |
LL | #[expect(clippy::if_same_then_else)] LL | #[expect(clippy::if_same_then_else)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: this lint expectation is unfulfilled error: this lint expectation is unfulfilled
--> tests/ui/expect_tool_lint_rfc_2383.rs:128:14 --> tests/ui/expect_tool_lint_rfc_2383.rs:127:14
| |
LL | #[expect(clippy::overly_complex_bool_expr)] LL | #[expect(clippy::overly_complex_bool_expr)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::implicit_return)] #![warn(clippy::implicit_return)]
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)] #![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::implicit_return)] #![warn(clippy::implicit_return)]
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)] #![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]

View File

@ -1,5 +1,5 @@
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:11:5 --> tests/ui/implicit_return.rs:10:5
| |
LL | true LL | true
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
@ -8,85 +8,85 @@ LL | true
= help: to override `-D warnings` add `#[allow(clippy::implicit_return)]` = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:15:15 --> tests/ui/implicit_return.rs:14:15
| |
LL | if true { true } else { false } LL | if true { true } else { false }
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:15:29 --> tests/ui/implicit_return.rs:14:29
| |
LL | if true { true } else { false } LL | if true { true } else { false }
| ^^^^^ help: add `return` as shown: `return false` | ^^^^^ help: add `return` as shown: `return false`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:21:17 --> tests/ui/implicit_return.rs:20:17
| |
LL | true => false, LL | true => false,
| ^^^^^ help: add `return` as shown: `return false` | ^^^^^ help: add `return` as shown: `return false`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:22:20 --> tests/ui/implicit_return.rs:21:20
| |
LL | false => { true }, LL | false => { true },
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:35:9 --> tests/ui/implicit_return.rs:34:9
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:42:13 --> tests/ui/implicit_return.rs:41:13
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:50:13 --> tests/ui/implicit_return.rs:49:13
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:68:18 --> tests/ui/implicit_return.rs:67:18
| |
LL | let _ = || { true }; LL | let _ = || { true };
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:69:16 --> tests/ui/implicit_return.rs:68:16
| |
LL | let _ = || true; LL | let _ = || true;
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:77:5 --> tests/ui/implicit_return.rs:76:5
| |
LL | format!("test {}", "test") LL | format!("test {}", "test")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:86:5 --> tests/ui/implicit_return.rs:85:5
| |
LL | m!(true, false) LL | m!(true, false)
| ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)` | ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:92:13 --> tests/ui/implicit_return.rs:91:13
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:97:17 --> tests/ui/implicit_return.rs:96:17
| |
LL | break 'outer false; LL | break 'outer false;
| ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false` | ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false`
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:112:5 --> tests/ui/implicit_return.rs:111:5
| |
LL | / loop { LL | / loop {
LL | | m!(true); LL | | m!(true);
@ -101,7 +101,7 @@ LL + }
| |
error: missing `return` statement error: missing `return` statement
--> tests/ui/implicit_return.rs:126:5 --> tests/ui/implicit_return.rs:125:5
| |
LL | true LL | true
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::let_unit_value)] #![warn(clippy::let_unit_value)]
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)] #![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::let_unit_value)] #![warn(clippy::let_unit_value)]
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)] #![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]

View File

@ -1,5 +1,5 @@
error: this let-binding has unit value error: this let-binding has unit value
--> tests/ui/let_unit.rs:12:5 --> tests/ui/let_unit.rs:11:5
| |
LL | let _x = println!("x"); LL | let _x = println!("x");
| ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");` | ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");`
@ -8,7 +8,7 @@ LL | let _x = println!("x");
= help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]`
error: this let-binding has unit value error: this let-binding has unit value
--> tests/ui/let_unit.rs:60:5 --> tests/ui/let_unit.rs:59:5
| |
LL | / let _ = v LL | / let _ = v
LL | | .into_iter() LL | | .into_iter()
@ -31,7 +31,7 @@ LL + .unwrap();
| |
error: this let-binding has unit value error: this let-binding has unit value
--> tests/ui/let_unit.rs:109:5 --> tests/ui/let_unit.rs:108:5
| |
LL | / let x = match Some(0) { LL | / let x = match Some(0) {
LL | | None => f2(1), LL | | None => f2(1),
@ -52,7 +52,7 @@ LL + };
| |
error: this let-binding has unit value error: this let-binding has unit value
--> tests/ui/let_unit.rs:190:9 --> tests/ui/let_unit.rs:189:9
| |
LL | let res = returns_unit(); LL | let res = returns_unit();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -4,7 +4,6 @@
//@ignore-32bit //@ignore-32bit
#![feature(lint_reasons)]
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)] #![allow(clippy::single_component_path_imports)]
#![warn(clippy::macro_use_imports)] #![warn(clippy::macro_use_imports)]

View File

@ -4,7 +4,6 @@
//@ignore-32bit //@ignore-32bit
#![feature(lint_reasons)]
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)] #![allow(clippy::single_component_path_imports)]
#![warn(clippy::macro_use_imports)] #![warn(clippy::macro_use_imports)]

View File

@ -1,5 +1,5 @@
error: `macro_use` attributes are no longer needed in the Rust 2018 edition error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> tests/ui/macro_use_imports.rs:19:5 --> tests/ui/macro_use_imports.rs:18:5
| |
LL | #[macro_use] LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};` | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};`
@ -8,19 +8,19 @@ LL | #[macro_use]
= help: to override `-D warnings` add `#[allow(clippy::macro_use_imports)]` = help: to override `-D warnings` add `#[allow(clippy::macro_use_imports)]`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> tests/ui/macro_use_imports.rs:23:5 --> tests/ui/macro_use_imports.rs:22:5
| |
LL | #[macro_use] LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::mut_mut, inner::try_err};` | ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::mut_mut, inner::try_err};`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> tests/ui/macro_use_imports.rs:25:5 --> tests/ui/macro_use_imports.rs:24:5
| |
LL | #[macro_use] 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::nested::string_add;`
error: `macro_use` attributes are no longer needed in the Rust 2018 edition error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> tests/ui/macro_use_imports.rs:21:5 --> tests/ui/macro_use_imports.rs:20:5
| |
LL | #[macro_use] 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 mini_mac::ClippyMiniMacroTest;`

View File

@ -3,7 +3,6 @@
//@aux-build:proc_macro_derive.rs //@aux-build:proc_macro_derive.rs
//@ignore-32bit //@ignore-32bit
#![feature(lint_reasons)]
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)] #![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)] #![allow(clippy::single_component_path_imports)]
#![warn(clippy::macro_use_imports)] #![warn(clippy::macro_use_imports)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::manual_non_exhaustive)] #![warn(clippy::manual_non_exhaustive)]
#![allow(unused)] #![allow(unused)]
//@no-rustfix //@no-rustfix

View File

@ -1,5 +1,5 @@
error: this seems like a manual implementation of the non-exhaustive pattern error: this seems like a manual implementation of the non-exhaustive pattern
--> tests/ui/manual_non_exhaustive_enum.rs:5:1 --> tests/ui/manual_non_exhaustive_enum.rs:4:1
| |
LL | enum E { LL | enum E {
| ^----- | ^-----
@ -15,7 +15,7 @@ LL | | }
| |_^ | |_^
| |
help: remove this variant help: remove this variant
--> tests/ui/manual_non_exhaustive_enum.rs:10:5 --> tests/ui/manual_non_exhaustive_enum.rs:9:5
| |
LL | _C, LL | _C,
| ^^ | ^^
@ -23,7 +23,7 @@ LL | _C,
= help: to override `-D warnings` add `#[allow(clippy::manual_non_exhaustive)]` = help: to override `-D warnings` add `#[allow(clippy::manual_non_exhaustive)]`
error: this seems like a manual implementation of the non-exhaustive pattern error: this seems like a manual implementation of the non-exhaustive pattern
--> tests/ui/manual_non_exhaustive_enum.rs:30:1 --> tests/ui/manual_non_exhaustive_enum.rs:29:1
| |
LL | enum NoUnderscore { LL | enum NoUnderscore {
| ^---------------- | ^----------------
@ -38,7 +38,7 @@ LL | | }
| |_^ | |_^
| |
help: remove this variant help: remove this variant
--> tests/ui/manual_non_exhaustive_enum.rs:34:5 --> tests/ui/manual_non_exhaustive_enum.rs:33:5
| |
LL | C, LL | C,
| ^ | ^

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow( #![allow(
unused, unused,
non_local_definitions, non_local_definitions,

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow( #![allow(
unused, unused,
non_local_definitions, non_local_definitions,

View File

@ -1,5 +1,5 @@
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:16:15 --> tests/ui/needless_borrow.rs:15:15
| |
LL | let _ = x(&&a); // warn LL | let _ = x(&&a); // warn
| ^^^ help: change this to: `&a` | ^^^ help: change this to: `&a`
@ -8,163 +8,163 @@ LL | let _ = x(&&a); // warn
= help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:20:13 --> tests/ui/needless_borrow.rs:19:13
| |
LL | mut_ref(&mut &mut b); // warn LL | mut_ref(&mut &mut b); // warn
| ^^^^^^^^^^^ help: change this to: `&mut b` | ^^^^^^^^^^^ help: change this to: `&mut b`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:32:13 --> tests/ui/needless_borrow.rs:31:13
| |
LL | &&a LL | &&a
| ^^^ help: change this to: `&a` | ^^^ help: change this to: `&a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:34:15 --> tests/ui/needless_borrow.rs:33:15
| |
LL | 46 => &&a, LL | 46 => &&a,
| ^^^ help: change this to: `&a` | ^^^ help: change this to: `&a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:40:27 --> tests/ui/needless_borrow.rs:39:27
| |
LL | break &ref_a; LL | break &ref_a;
| ^^^^^^ help: change this to: `ref_a` | ^^^^^^ help: change this to: `ref_a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:47:15 --> tests/ui/needless_borrow.rs:46:15
| |
LL | let _ = x(&&&a); LL | let _ = x(&&&a);
| ^^^^ help: change this to: `&a` | ^^^^ help: change this to: `&a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:48:15 --> tests/ui/needless_borrow.rs:47:15
| |
LL | let _ = x(&mut &&a); LL | let _ = x(&mut &&a);
| ^^^^^^^^ help: change this to: `&a` | ^^^^^^^^ help: change this to: `&a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:49:15 --> tests/ui/needless_borrow.rs:48:15
| |
LL | let _ = x(&&&mut b); LL | let _ = x(&&&mut b);
| ^^^^^^^^ help: change this to: `&mut b` | ^^^^^^^^ help: change this to: `&mut b`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:50:15 --> tests/ui/needless_borrow.rs:49:15
| |
LL | let _ = x(&&ref_a); LL | let _ = x(&&ref_a);
| ^^^^^^^ help: change this to: `ref_a` | ^^^^^^^ help: change this to: `ref_a`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:53:11 --> tests/ui/needless_borrow.rs:52:11
| |
LL | x(&b); LL | x(&b);
| ^^ help: change this to: `b` | ^^ help: change this to: `b`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:60:13 --> tests/ui/needless_borrow.rs:59:13
| |
LL | mut_ref(&mut x); LL | mut_ref(&mut x);
| ^^^^^^ help: change this to: `x` | ^^^^^^ help: change this to: `x`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:61:13 --> tests/ui/needless_borrow.rs:60:13
| |
LL | mut_ref(&mut &mut x); LL | mut_ref(&mut &mut x);
| ^^^^^^^^^^^ help: change this to: `x` | ^^^^^^^^^^^ help: change this to: `x`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:62:23 --> tests/ui/needless_borrow.rs:61:23
| |
LL | let y: &mut i32 = &mut x; LL | let y: &mut i32 = &mut x;
| ^^^^^^ help: change this to: `x` | ^^^^^^ help: change this to: `x`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:63:23 --> tests/ui/needless_borrow.rs:62:23
| |
LL | let y: &mut i32 = &mut &mut x; LL | let y: &mut i32 = &mut &mut x;
| ^^^^^^^^^^^ help: change this to: `x` | ^^^^^^^^^^^ help: change this to: `x`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:72:14 --> tests/ui/needless_borrow.rs:71:14
| |
LL | 0 => &mut x, LL | 0 => &mut x,
| ^^^^^^ help: change this to: `x` | ^^^^^^ help: change this to: `x`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:78:14 --> tests/ui/needless_borrow.rs:77:14
| |
LL | 0 => &mut x, LL | 0 => &mut x,
| ^^^^^^ help: change this to: `x` | ^^^^^^ help: change this to: `x`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:90:13 --> tests/ui/needless_borrow.rs:89:13
| |
LL | let _ = (&x).0; LL | let _ = (&x).0;
| ^^^^ help: change this to: `x` | ^^^^ help: change this to: `x`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:92:22 --> tests/ui/needless_borrow.rs:91:22
| |
LL | let _ = unsafe { (&*x).0 }; LL | let _ = unsafe { (&*x).0 };
| ^^^^^ help: change this to: `(*x)` | ^^^^^ help: change this to: `(*x)`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:102:5 --> tests/ui/needless_borrow.rs:101:5
| |
LL | (&&()).foo(); LL | (&&()).foo();
| ^^^^^^ help: change this to: `(&())` | ^^^^^^ help: change this to: `(&())`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:111:5 --> tests/ui/needless_borrow.rs:110:5
| |
LL | (&&5).foo(); LL | (&&5).foo();
| ^^^^^ help: change this to: `(&5)` | ^^^^^ help: change this to: `(&5)`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:137:23 --> tests/ui/needless_borrow.rs:136:23
| |
LL | let x: (&str,) = (&"",); LL | let x: (&str,) = (&"",);
| ^^^ help: change this to: `""` | ^^^ help: change this to: `""`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:179:13 --> tests/ui/needless_borrow.rs:178:13
| |
LL | (&self.f)() LL | (&self.f)()
| ^^^^^^^^^ help: change this to: `(self.f)` | ^^^^^^^^^ help: change this to: `(self.f)`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:188:13 --> tests/ui/needless_borrow.rs:187:13
| |
LL | (&mut self.f)() LL | (&mut self.f)()
| ^^^^^^^^^^^^^ help: change this to: `(self.f)` | ^^^^^^^^^^^^^ help: change this to: `(self.f)`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:225:22 --> tests/ui/needless_borrow.rs:224:22
| |
LL | let _ = &mut (&mut { x.u }).x; LL | let _ = &mut (&mut { x.u }).x;
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:232:22 --> tests/ui/needless_borrow.rs:231:22
| |
LL | let _ = &mut (&mut { x.u }).x; LL | let _ = &mut (&mut { x.u }).x;
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:236:22 --> tests/ui/needless_borrow.rs:235:22
| |
LL | let _ = &mut (&mut x.u).x; LL | let _ = &mut (&mut x.u).x;
| ^^^^^^^^^^ help: change this to: `x.u` | ^^^^^^^^^^ help: change this to: `x.u`
error: this expression borrows a value the compiler would automatically borrow error: this expression borrows a value the compiler would automatically borrow
--> tests/ui/needless_borrow.rs:237:22 --> tests/ui/needless_borrow.rs:236:22
| |
LL | let _ = &mut (&mut { x.u }).x; LL | let _ = &mut (&mut { x.u }).x;
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
error: this expression creates a reference which is immediately dereferenced by the compiler error: this expression creates a reference which is immediately dereferenced by the compiler
--> tests/ui/needless_borrow.rs:258:23 --> tests/ui/needless_borrow.rs:257:23
| |
LL | option.unwrap_or((&x.0,)); LL | option.unwrap_or((&x.0,));
| ^^^^ help: change this to: `x.0` | ^^^^ help: change this to: `x.0`

View File

@ -5,7 +5,6 @@
clippy::ptr_arg clippy::ptr_arg
)] )]
#![warn(clippy::needless_pass_by_ref_mut)] #![warn(clippy::needless_pass_by_ref_mut)]
#![feature(lint_reasons)]
//@no-rustfix //@no-rustfix
use std::ptr::NonNull; use std::ptr::NonNull;

View File

@ -1,5 +1,5 @@
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:12:11 --> tests/ui/needless_pass_by_ref_mut.rs:11:11
| |
LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) { LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>` | ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
@ -8,79 +8,79 @@ LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
= help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:37:12 --> tests/ui/needless_pass_by_ref_mut.rs:36:12
| |
LL | fn foo6(s: &mut Vec<u32>) { LL | fn foo6(s: &mut Vec<u32>) {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>` | ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:47:12 --> tests/ui/needless_pass_by_ref_mut.rs:46:12
| |
LL | fn bar(&mut self) {} LL | fn bar(&mut self) {}
| ^^^^^^^^^ help: consider changing to: `&self` | ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:50:29 --> tests/ui/needless_pass_by_ref_mut.rs:49:29
| |
LL | fn mushroom(&self, vec: &mut Vec<i32>) -> usize { LL | fn mushroom(&self, vec: &mut Vec<i32>) -> usize {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<i32>` | ^^^^^^^^^^^^^ help: consider changing to: `&Vec<i32>`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:127:16 --> tests/ui/needless_pass_by_ref_mut.rs:126:16
| |
LL | async fn a1(x: &mut i32) { LL | async fn a1(x: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:131:16 --> tests/ui/needless_pass_by_ref_mut.rs:130:16
| |
LL | async fn a2(x: &mut i32, y: String) { LL | async fn a2(x: &mut i32, y: String) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:135:16 --> tests/ui/needless_pass_by_ref_mut.rs:134:16
| |
LL | async fn a3(x: &mut i32, y: String, z: String) { LL | async fn a3(x: &mut i32, y: String, z: String) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:139:16 --> tests/ui/needless_pass_by_ref_mut.rs:138:16
| |
LL | async fn a4(x: &mut i32, y: i32) { LL | async fn a4(x: &mut i32, y: i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:143:24 --> tests/ui/needless_pass_by_ref_mut.rs:142:24
| |
LL | async fn a5(x: i32, y: &mut i32) { LL | async fn a5(x: i32, y: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:147:24 --> tests/ui/needless_pass_by_ref_mut.rs:146:24
| |
LL | async fn a6(x: i32, y: &mut i32) { LL | async fn a6(x: i32, y: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:151:32 --> tests/ui/needless_pass_by_ref_mut.rs:150:32
| |
LL | async fn a7(x: i32, y: i32, z: &mut i32) { LL | async fn a7(x: i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:155:24 --> tests/ui/needless_pass_by_ref_mut.rs:154:24
| |
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:155:45 --> tests/ui/needless_pass_by_ref_mut.rs:154:45
| |
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:189:16 --> tests/ui/needless_pass_by_ref_mut.rs:188:16
| |
LL | fn cfg_warn(s: &mut u32) {} LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider changing to: `&u32` | ^^^^^^^^ help: consider changing to: `&u32`
@ -88,7 +88,7 @@ LL | fn cfg_warn(s: &mut u32) {}
= note: this is cfg-gated and may require further changes = note: this is cfg-gated and may require further changes
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:195:20 --> tests/ui/needless_pass_by_ref_mut.rs:194:20
| |
LL | fn cfg_warn(s: &mut u32) {} LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider changing to: `&u32` | ^^^^^^^^ help: consider changing to: `&u32`
@ -96,19 +96,19 @@ LL | fn cfg_warn(s: &mut u32) {}
= note: this is cfg-gated and may require further changes = note: this is cfg-gated and may require further changes
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:209:39 --> tests/ui/needless_pass_by_ref_mut.rs:208:39
| |
LL | async fn inner_async2(x: &mut i32, y: &mut u32) { LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32` | ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:217:26 --> tests/ui/needless_pass_by_ref_mut.rs:216:26
| |
LL | async fn inner_async3(x: &mut i32, y: &mut u32) { LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&i32` | ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:236:34 --> tests/ui/needless_pass_by_ref_mut.rs:235:34
| |
LL | pub async fn call_in_closure1(n: &mut str) { LL | pub async fn call_in_closure1(n: &mut str) {
| ^^^^^^^^ help: consider changing to: `&str` | ^^^^^^^^ help: consider changing to: `&str`
@ -116,7 +116,7 @@ LL | pub async fn call_in_closure1(n: &mut str) {
= warning: changing this function will impact semver compatibility = warning: changing this function will impact semver compatibility
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:255:20 --> tests/ui/needless_pass_by_ref_mut.rs:254:20
| |
LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize { LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
| ^^^^^^^^^^ help: consider changing to: `&usize` | ^^^^^^^^^^ help: consider changing to: `&usize`
@ -124,7 +124,7 @@ LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
= warning: changing this function will impact semver compatibility = warning: changing this function will impact semver compatibility
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:266:26 --> tests/ui/needless_pass_by_ref_mut.rs:265:26
| |
LL | pub async fn closure4(n: &mut usize) { LL | pub async fn closure4(n: &mut usize) {
| ^^^^^^^^^^ help: consider changing to: `&usize` | ^^^^^^^^^^ help: consider changing to: `&usize`
@ -132,85 +132,85 @@ LL | pub async fn closure4(n: &mut usize) {
= warning: changing this function will impact semver compatibility = warning: changing this function will impact semver compatibility
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:315:12 --> tests/ui/needless_pass_by_ref_mut.rs:314:12
| |
LL | fn bar(&mut self) {} LL | fn bar(&mut self) {}
| ^^^^^^^^^ help: consider changing to: `&self` | ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:317:18 --> tests/ui/needless_pass_by_ref_mut.rs:316:18
| |
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^^ help: consider changing to: `&self` | ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:317:45 --> tests/ui/needless_pass_by_ref_mut.rs:316:45
| |
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32` | ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:325:46 --> tests/ui/needless_pass_by_ref_mut.rs:324:46
| |
LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) { LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32` | ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:341:18 --> tests/ui/needless_pass_by_ref_mut.rs:340:18
| |
LL | fn _empty_tup(x: &mut (())) {} LL | fn _empty_tup(x: &mut (())) {}
| ^^^^^^^^^ help: consider changing to: `&()` | ^^^^^^^^^ help: consider changing to: `&()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:342:19 --> tests/ui/needless_pass_by_ref_mut.rs:341:19
| |
LL | fn _single_tup(x: &mut ((i32,))) {} LL | fn _single_tup(x: &mut ((i32,))) {}
| ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)` | ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:343:18 --> tests/ui/needless_pass_by_ref_mut.rs:342:18
| |
LL | fn _multi_tup(x: &mut ((i32, u32))) {} LL | fn _multi_tup(x: &mut ((i32, u32))) {}
| ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)` | ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:344:11 --> tests/ui/needless_pass_by_ref_mut.rs:343:11
| |
LL | fn _fn(x: &mut (fn())) {} LL | fn _fn(x: &mut (fn())) {}
| ^^^^^^^^^^^ help: consider changing to: `&fn()` | ^^^^^^^^^^^ help: consider changing to: `&fn()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:346:23 --> tests/ui/needless_pass_by_ref_mut.rs:345:23
| |
LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {} LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()` | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:347:20 --> tests/ui/needless_pass_by_ref_mut.rs:346:20
| |
LL | fn _extern_c_fn(x: &mut extern "C" fn()) {} LL | fn _extern_c_fn(x: &mut extern "C" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()` | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:348:18 --> tests/ui/needless_pass_by_ref_mut.rs:347:18
| |
LL | fn _unsafe_fn(x: &mut unsafe fn()) {} LL | fn _unsafe_fn(x: &mut unsafe fn()) {}
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()` | ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:349:25 --> tests/ui/needless_pass_by_ref_mut.rs:348:25
| |
LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {} LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:350:20 --> tests/ui/needless_pass_by_ref_mut.rs:349:20
| |
LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {} LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)`
error: this argument is a mutable reference, but not used mutably error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:351:20 --> tests/ui/needless_pass_by_ref_mut.rs:350:20
| |
LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {} LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)`

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![feature(yeet_expr)] #![feature(yeet_expr)]
#![allow(unused)] #![allow(unused)]
#![allow( #![allow(

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![feature(yeet_expr)] #![feature(yeet_expr)]
#![allow(unused)] #![allow(unused)]
#![allow( #![allow(

View File

@ -1,5 +1,5 @@
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:26:5 --> tests/ui/needless_return.rs:25:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -13,7 +13,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:30:5 --> tests/ui/needless_return.rs:29:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -25,7 +25,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:35:5 --> tests/ui/needless_return.rs:34:5
| |
LL | return true;;; LL | return true;;;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -37,7 +37,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:40:5 --> tests/ui/needless_return.rs:39:5
| |
LL | return true;; ; ; LL | return true;; ; ;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -49,7 +49,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:45:9 --> tests/ui/needless_return.rs:44:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -61,7 +61,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:47:9 --> tests/ui/needless_return.rs:46:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -73,7 +73,7 @@ LL + false
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:53:17 --> tests/ui/needless_return.rs:52:17
| |
LL | true => return false, LL | true => return false,
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -84,7 +84,7 @@ LL | true => false,
| ~~~~~ | ~~~~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:55:13 --> tests/ui/needless_return.rs:54:13
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -96,7 +96,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:62:9 --> tests/ui/needless_return.rs:61:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -108,7 +108,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:64:16 --> tests/ui/needless_return.rs:63:16
| |
LL | let _ = || return true; LL | let _ = || return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -119,7 +119,7 @@ LL | let _ = || true;
| ~~~~ | ~~~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:68:5 --> tests/ui/needless_return.rs:67:5
| |
LL | return the_answer!(); LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -131,7 +131,7 @@ LL + the_answer!()
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:71:21 --> tests/ui/needless_return.rs:70:21
| |
LL | fn test_void_fun() { LL | fn test_void_fun() {
| _____________________^ | _____________________^
@ -146,7 +146,7 @@ LL + fn test_void_fun() {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:76:11 --> tests/ui/needless_return.rs:75:11
| |
LL | if b { LL | if b {
| ___________^ | ___________^
@ -161,7 +161,7 @@ LL + if b {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:78:13 --> tests/ui/needless_return.rs:77:13
| |
LL | } else { LL | } else {
| _____________^ | _____________^
@ -176,7 +176,7 @@ LL + } else {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:86:14 --> tests/ui/needless_return.rs:85:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ | ^^^^^^
@ -187,7 +187,7 @@ LL | _ => (),
| ~~ | ~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:94:24 --> tests/ui/needless_return.rs:93:24
| |
LL | let _ = 42; LL | let _ = 42;
| ________________________^ | ________________________^
@ -202,7 +202,7 @@ LL + let _ = 42;
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:97:14 --> tests/ui/needless_return.rs:96:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ | ^^^^^^
@ -213,7 +213,7 @@ LL | _ => (),
| ~~ | ~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:110:9 --> tests/ui/needless_return.rs:109:9
| |
LL | return String::from("test"); LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -225,7 +225,7 @@ LL + String::from("test")
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:112:9 --> tests/ui/needless_return.rs:111:9
| |
LL | return String::new(); LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -237,7 +237,7 @@ LL + String::new()
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:134:32 --> tests/ui/needless_return.rs:133:32
| |
LL | bar.unwrap_or_else(|_| return) LL | bar.unwrap_or_else(|_| return)
| ^^^^^^ | ^^^^^^
@ -248,7 +248,7 @@ LL | bar.unwrap_or_else(|_| {})
| ~~ | ~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:138:21 --> tests/ui/needless_return.rs:137:21
| |
LL | let _ = || { LL | let _ = || {
| _____________________^ | _____________________^
@ -263,7 +263,7 @@ LL + let _ = || {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:141:20 --> tests/ui/needless_return.rs:140:20
| |
LL | let _ = || return; LL | let _ = || return;
| ^^^^^^ | ^^^^^^
@ -274,7 +274,7 @@ LL | let _ = || {};
| ~~ | ~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:147:32 --> tests/ui/needless_return.rs:146:32
| |
LL | res.unwrap_or_else(|_| return Foo) LL | res.unwrap_or_else(|_| return Foo)
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -285,7 +285,7 @@ LL | res.unwrap_or_else(|_| Foo)
| ~~~ | ~~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:156:5 --> tests/ui/needless_return.rs:155:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -297,7 +297,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:160:5 --> tests/ui/needless_return.rs:159:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -309,7 +309,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:165:9 --> tests/ui/needless_return.rs:164:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -321,7 +321,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:167:9 --> tests/ui/needless_return.rs:166:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -333,7 +333,7 @@ LL + false
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:173:17 --> tests/ui/needless_return.rs:172:17
| |
LL | true => return false, LL | true => return false,
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -344,7 +344,7 @@ LL | true => false,
| ~~~~~ | ~~~~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:175:13 --> tests/ui/needless_return.rs:174:13
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -356,7 +356,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:182:9 --> tests/ui/needless_return.rs:181:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -368,7 +368,7 @@ LL + true
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:184:16 --> tests/ui/needless_return.rs:183:16
| |
LL | let _ = || return true; LL | let _ = || return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -379,7 +379,7 @@ LL | let _ = || true;
| ~~~~ | ~~~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:188:5 --> tests/ui/needless_return.rs:187:5
| |
LL | return the_answer!(); LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -391,7 +391,7 @@ LL + the_answer!()
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:191:33 --> tests/ui/needless_return.rs:190:33
| |
LL | async fn async_test_void_fun() { LL | async fn async_test_void_fun() {
| _________________________________^ | _________________________________^
@ -406,7 +406,7 @@ LL + async fn async_test_void_fun() {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:196:11 --> tests/ui/needless_return.rs:195:11
| |
LL | if b { LL | if b {
| ___________^ | ___________^
@ -421,7 +421,7 @@ LL + if b {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:198:13 --> tests/ui/needless_return.rs:197:13
| |
LL | } else { LL | } else {
| _____________^ | _____________^
@ -436,7 +436,7 @@ LL + } else {
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:206:14 --> tests/ui/needless_return.rs:205:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ | ^^^^^^
@ -447,7 +447,7 @@ LL | _ => (),
| ~~ | ~~
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:219:9 --> tests/ui/needless_return.rs:218:9
| |
LL | return String::from("test"); LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -459,7 +459,7 @@ LL + String::from("test")
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:221:9 --> tests/ui/needless_return.rs:220:9
| |
LL | return String::new(); LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -471,7 +471,7 @@ LL + String::new()
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:237:5 --> tests/ui/needless_return.rs:236:5
| |
LL | return format!("Hello {}", "world!"); LL | return format!("Hello {}", "world!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -483,7 +483,7 @@ LL + format!("Hello {}", "world!")
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:249:9 --> tests/ui/needless_return.rs:248:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -497,7 +497,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:251:9 --> tests/ui/needless_return.rs:250:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -509,7 +509,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:258:13 --> tests/ui/needless_return.rs:257:13
| |
LL | return 10; LL | return 10;
| ^^^^^^^^^ | ^^^^^^^^^
@ -524,7 +524,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:261:13 --> tests/ui/needless_return.rs:260:13
| |
LL | return 100; LL | return 100;
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -537,7 +537,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:269:9 --> tests/ui/needless_return.rs:268:9
| |
LL | return 0; LL | return 0;
| ^^^^^^^^ | ^^^^^^^^
@ -549,7 +549,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:276:13 --> tests/ui/needless_return.rs:275:13
| |
LL | return *(x as *const isize); LL | return *(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -564,7 +564,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:278:13 --> tests/ui/needless_return.rs:277:13
| |
LL | return !*(x as *const isize); LL | return !*(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -577,7 +577,7 @@ LL ~ }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:285:20 --> tests/ui/needless_return.rs:284:20
| |
LL | let _ = 42; LL | let _ = 42;
| ____________________^ | ____________________^
@ -594,7 +594,7 @@ LL + let _ = 42;
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:292:20 --> tests/ui/needless_return.rs:291:20
| |
LL | let _ = 42; return; LL | let _ = 42; return;
| ^^^^^^^ | ^^^^^^^
@ -606,7 +606,7 @@ LL + let _ = 42;
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:304:9 --> tests/ui/needless_return.rs:303:9
| |
LL | return Ok(format!("ok!")); LL | return Ok(format!("ok!"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -618,7 +618,7 @@ LL + Ok(format!("ok!"))
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:306:9 --> tests/ui/needless_return.rs:305:9
| |
LL | return Err(format!("err!")); LL | return Err(format!("err!"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -630,7 +630,7 @@ LL + Err(format!("err!"))
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:312:9 --> tests/ui/needless_return.rs:311:9
| |
LL | return if true { 1 } else { 2 }; LL | return if true { 1 } else { 2 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -642,7 +642,7 @@ LL + if true { 1 } else { 2 }
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:316:9 --> tests/ui/needless_return.rs:315:9
| |
LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 }; LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -654,7 +654,7 @@ LL + (if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else
| |
error: unneeded `return` statement error: unneeded `return` statement
--> tests/ui/needless_return.rs:337:5 --> tests/ui/needless_return.rs:336:5
| |
LL | return { "a".to_string() } + "b" + { "c" }; LL | return { "a".to_string() } + "b" + { "c" };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,6 +1,4 @@
//@no-rustfix: overlapping suggestions //@no-rustfix: overlapping suggestions
#![feature(lint_reasons)]
#![allow( #![allow(
unused, unused,
clippy::diverging_sub_expression, clippy::diverging_sub_expression,

View File

@ -1,5 +1,5 @@
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:19:13 --> tests/ui/nonminimal_bool.rs:17:13
| |
LL | let _ = !true; LL | let _ = !true;
| ^^^^^ help: try: `false` | ^^^^^ help: try: `false`
@ -8,43 +8,43 @@ LL | let _ = !true;
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]` = help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:22:13 --> tests/ui/nonminimal_bool.rs:20:13
| |
LL | let _ = !false; LL | let _ = !false;
| ^^^^^^ help: try: `true` | ^^^^^^ help: try: `true`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:24:13 --> tests/ui/nonminimal_bool.rs:22:13
| |
LL | let _ = !!a; LL | let _ = !!a;
| ^^^ help: try: `a` | ^^^ help: try: `a`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:26:13 --> tests/ui/nonminimal_bool.rs:24:13
| |
LL | let _ = false || a; LL | let _ = false || a;
| ^^^^^^^^^^ help: try: `a` | ^^^^^^^^^^ help: try: `a`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:31:13 --> tests/ui/nonminimal_bool.rs:29:13
| |
LL | let _ = !(!a && b); LL | let _ = !(!a && b);
| ^^^^^^^^^^ help: try: `a || !b` | ^^^^^^^^^^ help: try: `a || !b`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:33:13 --> tests/ui/nonminimal_bool.rs:31:13
| |
LL | let _ = !(!a || b); LL | let _ = !(!a || b);
| ^^^^^^^^^^ help: try: `a && !b` | ^^^^^^^^^^ help: try: `a && !b`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:35:13 --> tests/ui/nonminimal_bool.rs:33:13
| |
LL | let _ = !a && !(b && c); LL | let _ = !a && !(b && c);
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)` | ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:44:13 --> tests/ui/nonminimal_bool.rs:42:13
| |
LL | let _ = a == b && c == 5 && a == b; LL | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -57,7 +57,7 @@ LL | let _ = a == b && c == 5;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:46:13 --> tests/ui/nonminimal_bool.rs:44:13
| |
LL | let _ = a == b || c == 5 || a == b; LL | let _ = a == b || c == 5 || a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -70,7 +70,7 @@ LL | let _ = a == b || c == 5;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:48:13 --> tests/ui/nonminimal_bool.rs:46:13
| |
LL | let _ = a == b && c == 5 && b == a; LL | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -83,7 +83,7 @@ LL | let _ = a == b && c == 5;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:50:13 --> tests/ui/nonminimal_bool.rs:48:13
| |
LL | let _ = a != b || !(a != b || c == d); LL | let _ = a != b || !(a != b || c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -96,7 +96,7 @@ LL | let _ = a != b || c != d;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:52:13 --> tests/ui/nonminimal_bool.rs:50:13
| |
LL | let _ = a != b && !(a != b && c == d); LL | let _ = a != b && !(a != b && c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -109,43 +109,43 @@ LL | let _ = a != b && c != d;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:83:8 --> tests/ui/nonminimal_bool.rs:81:8
| |
LL | if matches!(true, true) && true { LL | if matches!(true, true) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:163:8 --> tests/ui/nonminimal_bool.rs:161:8
| |
LL | if !(12 == a) {} LL | if !(12 == a) {}
| ^^^^^^^^^^ help: try: `12 != a` | ^^^^^^^^^^ help: try: `12 != a`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:164:8 --> tests/ui/nonminimal_bool.rs:162:8
| |
LL | if !(a == 12) {} LL | if !(a == 12) {}
| ^^^^^^^^^^ help: try: `a != 12` | ^^^^^^^^^^ help: try: `a != 12`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:165:8 --> tests/ui/nonminimal_bool.rs:163:8
| |
LL | if !(12 != a) {} LL | if !(12 != a) {}
| ^^^^^^^^^^ help: try: `12 == a` | ^^^^^^^^^^ help: try: `12 == a`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:166:8 --> tests/ui/nonminimal_bool.rs:164:8
| |
LL | if !(a != 12) {} LL | if !(a != 12) {}
| ^^^^^^^^^^ help: try: `a == 12` | ^^^^^^^^^^ help: try: `a == 12`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:170:8 --> tests/ui/nonminimal_bool.rs:168:8
| |
LL | if !b == true {} LL | if !b == true {}
| ^^^^^^^^^^ help: try: `b != true` | ^^^^^^^^^^ help: try: `b != true`
error: this comparison might be written more concisely error: this comparison might be written more concisely
--> tests/ui/nonminimal_bool.rs:170:8 --> tests/ui/nonminimal_bool.rs:168:8
| |
LL | if !b == true {} LL | if !b == true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `b != true` | ^^^^^^^^^^ help: try simplifying it as shown: `b != true`
@ -154,61 +154,61 @@ LL | if !b == true {}
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
error: equality checks against true are unnecessary error: equality checks against true are unnecessary
--> tests/ui/nonminimal_bool.rs:170:8 --> tests/ui/nonminimal_bool.rs:168:8
| |
LL | if !b == true {} LL | if !b == true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!b` | ^^^^^^^^^^ help: try simplifying it as shown: `!b`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:171:8 --> tests/ui/nonminimal_bool.rs:169:8
| |
LL | if !b != true {} LL | if !b != true {}
| ^^^^^^^^^^ help: try: `b == true` | ^^^^^^^^^^ help: try: `b == true`
error: inequality checks against true can be replaced by a negation error: inequality checks against true can be replaced by a negation
--> tests/ui/nonminimal_bool.rs:171:8 --> tests/ui/nonminimal_bool.rs:169:8
| |
LL | if !b != true {} LL | if !b != true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)` | ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:172:8 --> tests/ui/nonminimal_bool.rs:170:8
| |
LL | if true == !b {} LL | if true == !b {}
| ^^^^^^^^^^ help: try: `true != b` | ^^^^^^^^^^ help: try: `true != b`
error: this comparison might be written more concisely error: this comparison might be written more concisely
--> tests/ui/nonminimal_bool.rs:172:8 --> tests/ui/nonminimal_bool.rs:170:8
| |
LL | if true == !b {} LL | if true == !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `true != b` | ^^^^^^^^^^ help: try simplifying it as shown: `true != b`
error: equality checks against true are unnecessary error: equality checks against true are unnecessary
--> tests/ui/nonminimal_bool.rs:172:8 --> tests/ui/nonminimal_bool.rs:170:8
| |
LL | if true == !b {} LL | if true == !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!b` | ^^^^^^^^^^ help: try simplifying it as shown: `!b`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:173:8 --> tests/ui/nonminimal_bool.rs:171:8
| |
LL | if true != !b {} LL | if true != !b {}
| ^^^^^^^^^^ help: try: `true == b` | ^^^^^^^^^^ help: try: `true == b`
error: inequality checks against true can be replaced by a negation error: inequality checks against true can be replaced by a negation
--> tests/ui/nonminimal_bool.rs:173:8 --> tests/ui/nonminimal_bool.rs:171:8
| |
LL | if true != !b {} LL | if true != !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)` | ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:174:8 --> tests/ui/nonminimal_bool.rs:172:8
| |
LL | if !b == !c {} LL | if !b == !c {}
| ^^^^^^^^ help: try: `b == c` | ^^^^^^^^ help: try: `b == c`
error: this boolean expression can be simplified error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:175:8 --> tests/ui/nonminimal_bool.rs:173:8
| |
LL | if !b != !c {} LL | if !b != !c {}
| ^^^^^^^^ help: try: `b != c` | ^^^^^^^^ help: try: `b != c`

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow(unused, clippy::diverging_sub_expression)] #![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::overly_complex_bool_expr)] #![warn(clippy::overly_complex_bool_expr)]

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow(unused, clippy::diverging_sub_expression)] #![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::overly_complex_bool_expr)] #![warn(clippy::overly_complex_bool_expr)]

View File

@ -1,11 +1,11 @@
error: this boolean expression contains a logic bug error: this boolean expression contains a logic bug
--> tests/ui/overly_complex_bool_expr.rs:11:13 --> tests/ui/overly_complex_bool_expr.rs:10:13
| |
LL | let _ = a && b || a; LL | let _ = a && b || a;
| ^^^^^^^^^^^ help: it would look like the following: `a` | ^^^^^^^^^^^ help: it would look like the following: `a`
| |
help: this expression can be optimized out by applying boolean operations to the outer expression help: this expression can be optimized out by applying boolean operations to the outer expression
--> tests/ui/overly_complex_bool_expr.rs:11:18 --> tests/ui/overly_complex_bool_expr.rs:10:18
| |
LL | let _ = a && b || a; LL | let _ = a && b || a;
| ^ | ^
@ -13,49 +13,49 @@ LL | let _ = a && b || a;
= help: to override `-D warnings` add `#[allow(clippy::overly_complex_bool_expr)]` = help: to override `-D warnings` add `#[allow(clippy::overly_complex_bool_expr)]`
error: this boolean expression contains a logic bug error: this boolean expression contains a logic bug
--> tests/ui/overly_complex_bool_expr.rs:14:13 --> tests/ui/overly_complex_bool_expr.rs:13:13
| |
LL | let _ = false && a; LL | let _ = false && a;
| ^^^^^^^^^^ help: it would look like the following: `false` | ^^^^^^^^^^ help: it would look like the following: `false`
| |
help: this expression can be optimized out by applying boolean operations to the outer expression help: this expression can be optimized out by applying boolean operations to the outer expression
--> tests/ui/overly_complex_bool_expr.rs:14:22 --> tests/ui/overly_complex_bool_expr.rs:13:22
| |
LL | let _ = false && a; LL | let _ = false && a;
| ^ | ^
error: this boolean expression contains a logic bug error: this boolean expression contains a logic bug
--> tests/ui/overly_complex_bool_expr.rs:25:13 --> tests/ui/overly_complex_bool_expr.rs:24:13
| |
LL | let _ = a == b && a != b; LL | let _ = a == b && a != b;
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false` | ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
| |
help: this expression can be optimized out by applying boolean operations to the outer expression help: this expression can be optimized out by applying boolean operations to the outer expression
--> tests/ui/overly_complex_bool_expr.rs:25:13 --> tests/ui/overly_complex_bool_expr.rs:24:13
| |
LL | let _ = a == b && a != b; LL | let _ = a == b && a != b;
| ^^^^^^ | ^^^^^^
error: this boolean expression contains a logic bug error: this boolean expression contains a logic bug
--> tests/ui/overly_complex_bool_expr.rs:27:13 --> tests/ui/overly_complex_bool_expr.rs:26:13
| |
LL | let _ = a < b && a >= b; LL | let _ = a < b && a >= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
| |
help: this expression can be optimized out by applying boolean operations to the outer expression help: this expression can be optimized out by applying boolean operations to the outer expression
--> tests/ui/overly_complex_bool_expr.rs:27:13 --> tests/ui/overly_complex_bool_expr.rs:26:13
| |
LL | let _ = a < b && a >= b; LL | let _ = a < b && a >= b;
| ^^^^^ | ^^^^^
error: this boolean expression contains a logic bug error: this boolean expression contains a logic bug
--> tests/ui/overly_complex_bool_expr.rs:29:13 --> tests/ui/overly_complex_bool_expr.rs:28:13
| |
LL | let _ = a > b && a <= b; LL | let _ = a > b && a <= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false` | ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
| |
help: this expression can be optimized out by applying boolean operations to the outer expression help: this expression can be optimized out by applying boolean operations to the outer expression
--> tests/ui/overly_complex_bool_expr.rs:29:13 --> tests/ui/overly_complex_bool_expr.rs:28:13
| |
LL | let _ = a > b && a <= b; LL | let _ = a > b && a <= b;
| ^^^^^ | ^^^^^

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![allow( #![allow(
unused, unused,
clippy::many_single_char_names, clippy::many_single_char_names,

View File

@ -1,5 +1,5 @@
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:14:14 --> tests/ui/ptr_arg.rs:13:14
| |
LL | fn do_vec(x: &Vec<i64>) { LL | fn do_vec(x: &Vec<i64>) {
| ^^^^^^^^^ help: change this to: `&[i64]` | ^^^^^^^^^ help: change this to: `&[i64]`
@ -8,49 +8,49 @@ LL | fn do_vec(x: &Vec<i64>) {
= help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]`
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:20:18 --> tests/ui/ptr_arg.rs:19:18
| |
LL | fn do_vec_mut(x: &mut Vec<i64>) { LL | fn do_vec_mut(x: &mut Vec<i64>) {
| ^^^^^^^^^^^^^ help: change this to: `&mut [i64]` | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:25:19 --> tests/ui/ptr_arg.rs:24:19
| |
LL | fn do_vec_mut2(x: &mut Vec<i64>) { LL | fn do_vec_mut2(x: &mut Vec<i64>) {
| ^^^^^^^^^^^^^ help: change this to: `&mut [i64]` | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
error: writing `&String` instead of `&str` involves a new object where a slice will do error: writing `&String` instead of `&str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:31:14 --> tests/ui/ptr_arg.rs:30:14
| |
LL | fn do_str(x: &String) { LL | fn do_str(x: &String) {
| ^^^^^^^ help: change this to: `&str` | ^^^^^^^ help: change this to: `&str`
error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:36:18 --> tests/ui/ptr_arg.rs:35:18
| |
LL | fn do_str_mut(x: &mut String) { LL | fn do_str_mut(x: &mut String) {
| ^^^^^^^^^^^ help: change this to: `&mut str` | ^^^^^^^^^^^ help: change this to: `&mut str`
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:41:15 --> tests/ui/ptr_arg.rs:40:15
| |
LL | fn do_path(x: &PathBuf) { LL | fn do_path(x: &PathBuf) {
| ^^^^^^^^ help: change this to: `&Path` | ^^^^^^^^ help: change this to: `&Path`
error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:46:19 --> tests/ui/ptr_arg.rs:45:19
| |
LL | fn do_path_mut(x: &mut PathBuf) { LL | fn do_path_mut(x: &mut PathBuf) {
| ^^^^^^^^^^^^ help: change this to: `&mut Path` | ^^^^^^^^^^^^ help: change this to: `&mut Path`
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:55:18 --> tests/ui/ptr_arg.rs:54:18
| |
LL | fn do_vec(x: &Vec<i64>); LL | fn do_vec(x: &Vec<i64>);
| ^^^^^^^^^ help: change this to: `&[i64]` | ^^^^^^^^^ help: change this to: `&[i64]`
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:69:14 --> tests/ui/ptr_arg.rs:68:14
| |
LL | fn cloned(x: &Vec<u8>) -> Vec<u8> { LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
| ^^^^^^^^ | ^^^^^^^^
@ -68,7 +68,7 @@ LL ~ x.to_owned()
| |
error: writing `&String` instead of `&str` involves a new object where a slice will do error: writing `&String` instead of `&str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:79:18 --> tests/ui/ptr_arg.rs:78:18
| |
LL | fn str_cloned(x: &String) -> String { LL | fn str_cloned(x: &String) -> String {
| ^^^^^^^ | ^^^^^^^
@ -85,7 +85,7 @@ LL ~ x.to_owned()
| |
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:88:19 --> tests/ui/ptr_arg.rs:87:19
| |
LL | fn path_cloned(x: &PathBuf) -> PathBuf { LL | fn path_cloned(x: &PathBuf) -> PathBuf {
| ^^^^^^^^ | ^^^^^^^^
@ -102,7 +102,7 @@ LL ~ x.to_path_buf()
| |
error: writing `&String` instead of `&str` involves a new object where a slice will do error: writing `&String` instead of `&str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:97:44 --> tests/ui/ptr_arg.rs:96:44
| |
LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) { LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
| ^^^^^^^ | ^^^^^^^
@ -117,19 +117,19 @@ LL ~ let c = y;
| |
error: using a reference to `Cow` is not recommended error: using a reference to `Cow` is not recommended
--> tests/ui/ptr_arg.rs:112:25 --> tests/ui/ptr_arg.rs:111:25
| |
LL | fn test_cow_with_ref(c: &Cow<[i32]>) {} LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
| ^^^^^^^^^^^ help: change this to: `&[i32]` | ^^^^^^^^^^^ help: change this to: `&[i32]`
error: writing `&String` instead of `&str` involves a new object where a slice will do error: writing `&String` instead of `&str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:142:66 --> tests/ui/ptr_arg.rs:141:66
| |
LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec<u32>, _s: &String) {} LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec<u32>, _s: &String) {}
| ^^^^^^^ help: change this to: `&str` | ^^^^^^^ help: change this to: `&str`
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:172:21 --> tests/ui/ptr_arg.rs:171:21
| |
LL | fn foo_vec(vec: &Vec<u8>) { LL | fn foo_vec(vec: &Vec<u8>) {
| ^^^^^^^^ | ^^^^^^^^
@ -143,7 +143,7 @@ LL ~ let _ = vec.to_owned().clone();
| |
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:178:23 --> tests/ui/ptr_arg.rs:177:23
| |
LL | fn foo_path(path: &PathBuf) { LL | fn foo_path(path: &PathBuf) {
| ^^^^^^^^ | ^^^^^^^^
@ -157,7 +157,7 @@ LL ~ let _ = path.to_path_buf().clone();
| |
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:184:21 --> tests/ui/ptr_arg.rs:183:21
| |
LL | fn foo_str(str: &PathBuf) { LL | fn foo_str(str: &PathBuf) {
| ^^^^^^^^ | ^^^^^^^^
@ -171,43 +171,43 @@ LL ~ let _ = str.to_path_buf().clone();
| |
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:191:29 --> tests/ui/ptr_arg.rs:190:29
| |
LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) { LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) {
| ^^^^^^^^^^^^^ help: change this to: `&mut [u32]` | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:254:17 --> tests/ui/ptr_arg.rs:253:17
| |
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) { LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
| ^^^^^^^^^^^^^ help: change this to: `&mut [u32]` | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:254:35 --> tests/ui/ptr_arg.rs:253:35
| |
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) { LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
| ^^^^^^^^^^^ help: change this to: `&mut str` | ^^^^^^^^^^^ help: change this to: `&mut str`
error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
--> tests/ui/ptr_arg.rs:254:51 --> tests/ui/ptr_arg.rs:253:51
| |
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) { LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
| ^^^^^^^^^^^^ help: change this to: `&mut Path` | ^^^^^^^^^^^^ help: change this to: `&mut Path`
error: using a reference to `Cow` is not recommended error: using a reference to `Cow` is not recommended
--> tests/ui/ptr_arg.rs:280:39 --> tests/ui/ptr_arg.rs:279:39
| |
LL | fn cow_elided_lifetime<'a>(input: &'a Cow<str>) -> &'a str { LL | fn cow_elided_lifetime<'a>(input: &'a Cow<str>) -> &'a str {
| ^^^^^^^^^^^^ help: change this to: `&str` | ^^^^^^^^^^^^ help: change this to: `&str`
error: using a reference to `Cow` is not recommended error: using a reference to `Cow` is not recommended
--> tests/ui/ptr_arg.rs:286:36 --> tests/ui/ptr_arg.rs:285:36
| |
LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str { LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str {
| ^^^^^^^^^^^^^^^^ help: change this to: `&str` | ^^^^^^^^^^^^^^^^ help: change this to: `&str`
error: using a reference to `Cow` is not recommended error: using a reference to `Cow` is not recommended
--> tests/ui/ptr_arg.rs:290:40 --> tests/ui/ptr_arg.rs:289:40
| |
LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str { LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
| ^^^^^^^^^^^^^^^^ help: change this to: `&str` | ^^^^^^^^^^^^^^^^ help: change this to: `&str`

View File

@ -1,5 +1,4 @@
// rustfix-only-machine-applicable // rustfix-only-machine-applicable
#![feature(lint_reasons)]
#![warn(clippy::redundant_clone)] #![warn(clippy::redundant_clone)]
#![allow( #![allow(
clippy::drop_non_drop, clippy::drop_non_drop,

View File

@ -1,5 +1,4 @@
// rustfix-only-machine-applicable // rustfix-only-machine-applicable
#![feature(lint_reasons)]
#![warn(clippy::redundant_clone)] #![warn(clippy::redundant_clone)]
#![allow( #![allow(
clippy::drop_non_drop, clippy::drop_non_drop,

View File

@ -1,11 +1,11 @@
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:15:42 --> tests/ui/redundant_clone.rs:14:42
| |
LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
| ^^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:15:14 --> tests/ui/redundant_clone.rs:14:14
| |
LL | let _s = ["lorem", "ipsum"].join(" ").to_string(); LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -13,169 +13,169 @@ LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
= help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]` = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:18:15 --> tests/ui/redundant_clone.rs:17:15
| |
LL | let _s = s.clone(); LL | let _s = s.clone();
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:18:14 --> tests/ui/redundant_clone.rs:17:14
| |
LL | let _s = s.clone(); LL | let _s = s.clone();
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:21:15 --> tests/ui/redundant_clone.rs:20:15
| |
LL | let _s = s.to_string(); LL | let _s = s.to_string();
| ^^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:21:14 --> tests/ui/redundant_clone.rs:20:14
| |
LL | let _s = s.to_string(); LL | let _s = s.to_string();
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:24:15 --> tests/ui/redundant_clone.rs:23:15
| |
LL | let _s = s.to_owned(); LL | let _s = s.to_owned();
| ^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:24:14 --> tests/ui/redundant_clone.rs:23:14
| |
LL | let _s = s.to_owned(); LL | let _s = s.to_owned();
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:26:42 --> tests/ui/redundant_clone.rs:25:42
| |
LL | let _s = Path::new("/a/b/").join("c").to_owned(); LL | let _s = Path::new("/a/b/").join("c").to_owned();
| ^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:26:14 --> tests/ui/redundant_clone.rs:25:14
| |
LL | let _s = Path::new("/a/b/").join("c").to_owned(); LL | let _s = Path::new("/a/b/").join("c").to_owned();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:28:42 --> tests/ui/redundant_clone.rs:27:42
| |
LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
| ^^^^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:28:14 --> tests/ui/redundant_clone.rs:27:14
| |
LL | let _s = Path::new("/a/b/").join("c").to_path_buf(); LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:30:29 --> tests/ui/redundant_clone.rs:29:29
| |
LL | let _s = OsString::new().to_owned(); LL | let _s = OsString::new().to_owned();
| ^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:30:14 --> tests/ui/redundant_clone.rs:29:14
| |
LL | let _s = OsString::new().to_owned(); LL | let _s = OsString::new().to_owned();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:32:29 --> tests/ui/redundant_clone.rs:31:29
| |
LL | let _s = OsString::new().to_os_string(); LL | let _s = OsString::new().to_os_string();
| ^^^^^^^^^^^^^^^ help: remove this | ^^^^^^^^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:32:14 --> tests/ui/redundant_clone.rs:31:14
| |
LL | let _s = OsString::new().to_os_string(); LL | let _s = OsString::new().to_os_string();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:43:19 --> tests/ui/redundant_clone.rs:42:19
| |
LL | let _t = tup.0.clone(); LL | let _t = tup.0.clone();
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:43:14 --> tests/ui/redundant_clone.rs:42:14
| |
LL | let _t = tup.0.clone(); LL | let _t = tup.0.clone();
| ^^^^^ | ^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:75:25 --> tests/ui/redundant_clone.rs:74:25
| |
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:75:24 --> tests/ui/redundant_clone.rs:74:24
| |
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) } LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:132:15 --> tests/ui/redundant_clone.rs:131:15
| |
LL | let _s = s.clone(); LL | let _s = s.clone();
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:131:14
|
LL | let _s = s.clone();
| ^
error: redundant clone
--> tests/ui/redundant_clone.rs:132:15
|
LL | let _t = t.clone();
| ^^^^^^^^ help: remove this
|
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:132:14 --> tests/ui/redundant_clone.rs:132:14
| |
LL | let _s = s.clone();
| ^
error: redundant clone
--> tests/ui/redundant_clone.rs:133:15
|
LL | let _t = t.clone();
| ^^^^^^^^ help: remove this
|
note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:133:14
|
LL | let _t = t.clone(); LL | let _t = t.clone();
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:143:19 --> tests/ui/redundant_clone.rs:142:19
| |
LL | let _f = f.clone(); LL | let _f = f.clone();
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:143:18 --> tests/ui/redundant_clone.rs:142:18
| |
LL | let _f = f.clone(); LL | let _f = f.clone();
| ^ | ^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:155:14 --> tests/ui/redundant_clone.rs:154:14
| |
LL | let y = x.clone().join("matthias"); LL | let y = x.clone().join("matthias");
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: cloned value is neither consumed nor mutated note: cloned value is neither consumed nor mutated
--> tests/ui/redundant_clone.rs:155:13 --> tests/ui/redundant_clone.rs:154:13
| |
LL | let y = x.clone().join("matthias"); LL | let y = x.clone().join("matthias");
| ^^^^^^^^^ | ^^^^^^^^^
error: redundant clone error: redundant clone
--> tests/ui/redundant_clone.rs:209:11 --> tests/ui/redundant_clone.rs:208:11
| |
LL | foo(&x.clone(), move || { LL | foo(&x.clone(), move || {
| ^^^^^^^^ help: remove this | ^^^^^^^^ help: remove this
| |
note: this value is dropped without further use note: this value is dropped without further use
--> tests/ui/redundant_clone.rs:209:10 --> tests/ui/redundant_clone.rs:208:10
| |
LL | foo(&x.clone(), move || { LL | foo(&x.clone(), move || {
| ^ | ^

View File

@ -1,6 +1,5 @@
// FIXME: run-rustfix waiting on multi-span suggestions // FIXME: run-rustfix waiting on multi-span suggestions
//@no-rustfix //@no-rustfix
#![feature(lint_reasons)]
#![warn(clippy::ref_binding_to_reference)] #![warn(clippy::ref_binding_to_reference)]
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] #![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]

View File

@ -1,5 +1,5 @@
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:31:14 --> tests/ui/ref_binding_to_reference.rs:30:14
| |
LL | Some(ref x) => x, LL | Some(ref x) => x,
| ^^^^^ | ^^^^^
@ -12,7 +12,7 @@ LL | Some(x) => &x,
| ~ ~~ | ~ ~~
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:39:14 --> tests/ui/ref_binding_to_reference.rs:38:14
| |
LL | Some(ref x) => { LL | Some(ref x) => {
| ^^^^^ | ^^^^^
@ -27,7 +27,7 @@ LL ~ &x
| |
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:50:14 --> tests/ui/ref_binding_to_reference.rs:49:14
| |
LL | Some(ref x) => m2!(x), LL | Some(ref x) => m2!(x),
| ^^^^^ | ^^^^^
@ -38,7 +38,7 @@ LL | Some(x) => m2!(&x),
| ~ ~~ | ~ ~~
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:56:15 --> tests/ui/ref_binding_to_reference.rs:55:15
| |
LL | let _ = |&ref x: &&String| { LL | let _ = |&ref x: &&String| {
| ^^^^^ | ^^^^^
@ -51,7 +51,7 @@ LL ~ let _: &&String = &x;
| |
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:63:12 --> tests/ui/ref_binding_to_reference.rs:62:12
| |
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String { LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
| ^^^^^ | ^^^^^
@ -65,7 +65,7 @@ LL ~ x
| |
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:71:11 --> tests/ui/ref_binding_to_reference.rs:70:11
| |
LL | fn f(&ref x: &&String) { LL | fn f(&ref x: &&String) {
| ^^^^^ | ^^^^^
@ -78,7 +78,7 @@ LL ~ let _: &&String = &x;
| |
error: this pattern creates a reference to a reference error: this pattern creates a reference to a reference
--> tests/ui/ref_binding_to_reference.rs:80:11 --> tests/ui/ref_binding_to_reference.rs:79:11
| |
LL | fn f(&ref x: &&String) { LL | fn f(&ref x: &&String) {
| ^^^^^ | ^^^^^

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::same_name_method)] #![warn(clippy::same_name_method)]
#![allow(dead_code, non_camel_case_types)] #![allow(dead_code, non_camel_case_types)]

View File

@ -1,11 +1,11 @@
error: method's name is the same as an existing method in a trait error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:21:13 --> tests/ui/same_name_method.rs:20:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: existing `foo` defined here note: existing `foo` defined here
--> tests/ui/same_name_method.rs:26:13 --> tests/ui/same_name_method.rs:25:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -13,62 +13,62 @@ LL | fn foo() {}
= help: to override `-D warnings` add `#[allow(clippy::same_name_method)]` = help: to override `-D warnings` add `#[allow(clippy::same_name_method)]`
error: method's name is the same as an existing method in a trait error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:36:13 --> tests/ui/same_name_method.rs:35:13
| |
LL | fn clone() {} LL | fn clone() {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
note: existing `clone` defined here note: existing `clone` defined here
--> tests/ui/same_name_method.rs:32:18 --> tests/ui/same_name_method.rs:31:18
| |
LL | #[derive(Clone)] LL | #[derive(Clone)]
| ^^^^^ | ^^^^^
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) = 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 error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:47:13 --> tests/ui/same_name_method.rs:46:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: existing `foo` defined here note: existing `foo` defined here
--> tests/ui/same_name_method.rs:52:13 --> tests/ui/same_name_method.rs:51:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: method's name is the same as an existing method in a trait error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:62:13 --> tests/ui/same_name_method.rs:61:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: existing `foo` defined here note: existing `foo` defined here
--> tests/ui/same_name_method.rs:66:9 --> tests/ui/same_name_method.rs:65:9
| |
LL | impl T1 for S {} LL | impl T1 for S {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: method's name is the same as an existing method in a trait error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:75:13 --> tests/ui/same_name_method.rs:74:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: existing `foo` defined here note: existing `foo` defined here
--> tests/ui/same_name_method.rs:80:9 --> tests/ui/same_name_method.rs:79:9
| |
LL | impl T1 for S {} LL | impl T1 for S {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: method's name is the same as an existing method in a trait error: method's name is the same as an existing method in a trait
--> tests/ui/same_name_method.rs:75:13 --> tests/ui/same_name_method.rs:74:13
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: existing `foo` defined here note: existing `foo` defined here
--> tests/ui/same_name_method.rs:82:9 --> tests/ui/same_name_method.rs:81:9
| |
LL | impl T2 for S {} LL | impl T2 for S {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,3 @@
#![feature(lint_reasons)]
#![warn(clippy::unsafe_derive_deserialize)] #![warn(clippy::unsafe_derive_deserialize)]
#![allow(unused, clippy::missing_safety_doc)] #![allow(unused, clippy::missing_safety_doc)]

View File

@ -1,5 +1,5 @@
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe` error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> tests/ui/unsafe_derive_deserialize.rs:9:10 --> tests/ui/unsafe_derive_deserialize.rs:8:10
| |
LL | #[derive(Deserialize)] LL | #[derive(Deserialize)]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | #[derive(Deserialize)]
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe` error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> tests/ui/unsafe_derive_deserialize.rs:18:10 --> tests/ui/unsafe_derive_deserialize.rs:17:10
| |
LL | #[derive(Deserialize)] LL | #[derive(Deserialize)]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -19,7 +19,7 @@ LL | #[derive(Deserialize)]
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe` error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> tests/ui/unsafe_derive_deserialize.rs:25:10 --> tests/ui/unsafe_derive_deserialize.rs:24:10
| |
LL | #[derive(Deserialize)] LL | #[derive(Deserialize)]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -28,7 +28,7 @@ LL | #[derive(Deserialize)]
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe` error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
--> tests/ui/unsafe_derive_deserialize.rs:34:10 --> tests/ui/unsafe_derive_deserialize.rs:33:10
| |
LL | #[derive(Deserialize)] LL | #[derive(Deserialize)]
| ^^^^^^^^^^^ | ^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
//@aux-build:proc_macro_derive.rs //@aux-build:proc_macro_derive.rs
#![feature(rustc_private, lint_reasons)] #![feature(rustc_private)]
#![warn(clippy::used_underscore_binding)] #![warn(clippy::used_underscore_binding)]
#![allow(clippy::disallowed_names, clippy::eq_op, clippy::uninlined_format_args)] #![allow(clippy::disallowed_names, clippy::eq_op, clippy::uninlined_format_args)]

View File

@ -10,7 +10,7 @@
#![feature(yeet_expr)] #![feature(yeet_expr)]
#![feature(nonzero_ops)] #![feature(nonzero_ops)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![cfg_attr(bootstrap, feature(lint_reasons))]
#![feature(trait_upcasting)] #![feature(trait_upcasting)]
#![feature(strict_overflow_ops)] #![feature(strict_overflow_ops)]
#![feature(is_none_or)] #![feature(is_none_or)]

View File

@ -142,9 +142,9 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
DuplicatesOk, @only_local: true, DuplicatesOk, @only_local: true,
), ),
gated!( ungated!(
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk, expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
lint_reasons, experimental!(expect) DuplicatesOk, @only_local: true,
), ),
ungated!( ungated!(
forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),

View File

@ -1,5 +1,4 @@
//@ check-pass //@ check-pass
#![feature(lint_reasons)]
//! This file tests the `#[expect]` attribute implementation for tool lints. The same //! 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 //! file is used to test clippy and rustdoc. Any changes to this file should be synced

View File

@ -1,5 +1,5 @@
warning: this lint expectation is unfulfilled 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)] 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 = note: `#[warn(unfulfilled_lint_expectations)]` on by default
warning: this lint expectation is unfulfilled warning: this lint expectation is unfulfilled
--> $DIR/expect-tool-lint-rfc-2383.rs:70:14 --> $DIR/expect-tool-lint-rfc-2383.rs:69:14
| |
LL | #[expect(rustdoc::broken_intra_doc_links)] LL | #[expect(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: this lint expectation is unfulfilled warning: this lint expectation is unfulfilled
--> $DIR/expect-tool-lint-rfc-2383.rs:75:14 --> $DIR/expect-tool-lint-rfc-2383.rs:74:14
| |
LL | #[expect(rustdoc::invalid_html_tags)] LL | #[expect(rustdoc::invalid_html_tags)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: this lint expectation is unfulfilled warning: this lint expectation is unfulfilled
--> $DIR/expect-tool-lint-rfc-2383.rs:80:14 --> $DIR/expect-tool-lint-rfc-2383.rs:79:14
| |
LL | #[expect(rustdoc::bare_urls)] LL | #[expect(rustdoc::bare_urls)]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^

View File

@ -1,8 +1,6 @@
//@ check-pass //@ check-pass
//@ edition: 2021 //@ edition: 2021
#![feature(lint_reasons)]
use std::future::Future; use std::future::Future;
use std::pin::Pin; use std::pin::Pin;
use std::task::Poll; use std::task::Poll;

View File

@ -1,5 +1,3 @@
#![feature(lint_reasons)]
pub mod inner { pub mod inner {
#[expect(unexpected_cfgs)] #[expect(unexpected_cfgs)]
pub fn i_am_here() { pub fn i_am_here() {

View File

@ -1,5 +1,5 @@
error[E0425]: cannot find function `i_am_not` in module `inner` error[E0425]: cannot find function `i_am_not` in module `inner`
--> $DIR/diagnostics-not-a-def.rs:14:12 --> $DIR/diagnostics-not-a-def.rs:12:12
| |
LL | inner::i_am_not(); LL | inner::i_am_not();
| ^^^^^^^^ not found in `inner` | ^^^^^^^^ not found in `inner`

View File

@ -1,5 +1,3 @@
#![feature(lint_reasons)]
#![deny(unused_attributes)] #![deny(unused_attributes)]
#![allow()] //~ ERROR unused attribute #![allow()] //~ ERROR unused attribute
#![expect()] //~ ERROR unused attribute #![expect()] //~ ERROR unused attribute

View File

@ -1,18 +1,18 @@
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:11:1 --> $DIR/empty-attributes.rs:9:1
| |
LL | #[repr()] LL | #[repr()]
| ^^^^^^^^^ help: remove this attribute | ^^^^^^^^^ help: remove this attribute
| |
= note: attribute `repr` with an empty list has no effect = note: attribute `repr` with an empty list has no effect
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-attributes.rs:3:9 --> $DIR/empty-attributes.rs:1:9
| |
LL | #![deny(unused_attributes)] LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:14:1 --> $DIR/empty-attributes.rs:12:1
| |
LL | #[target_feature()] LL | #[target_feature()]
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
@ -20,7 +20,7 @@ LL | #[target_feature()]
= note: attribute `target_feature` with an empty list has no effect = note: attribute `target_feature` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:4:1 --> $DIR/empty-attributes.rs:2:1
| |
LL | #![allow()] LL | #![allow()]
| ^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^ help: remove this attribute
@ -28,7 +28,7 @@ LL | #![allow()]
= note: attribute `allow` with an empty list has no effect = note: attribute `allow` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:5:1 --> $DIR/empty-attributes.rs:3:1
| |
LL | #![expect()] LL | #![expect()]
| ^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^ help: remove this attribute
@ -36,7 +36,7 @@ LL | #![expect()]
= note: attribute `expect` with an empty list has no effect = note: attribute `expect` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:6:1 --> $DIR/empty-attributes.rs:4:1
| |
LL | #![warn()] LL | #![warn()]
| ^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^ help: remove this attribute
@ -44,7 +44,7 @@ LL | #![warn()]
= note: attribute `warn` with an empty list has no effect = note: attribute `warn` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:7:1 --> $DIR/empty-attributes.rs:5:1
| |
LL | #![deny()] LL | #![deny()]
| ^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^ help: remove this attribute
@ -52,7 +52,7 @@ LL | #![deny()]
= note: attribute `deny` with an empty list has no effect = note: attribute `deny` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:8:1 --> $DIR/empty-attributes.rs:6:1
| |
LL | #![forbid()] LL | #![forbid()]
| ^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^ help: remove this attribute
@ -60,7 +60,7 @@ LL | #![forbid()]
= note: attribute `forbid` with an empty list has no effect = note: attribute `forbid` with an empty list has no effect
error: unused attribute error: unused attribute
--> $DIR/empty-attributes.rs:9:1 --> $DIR/empty-attributes.rs:7:1
| |
LL | #![feature()] LL | #![feature()]
| ^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^ help: remove this attribute

View File

@ -13,6 +13,11 @@ warning[E0602]: unknown lint: `bogus`
= note: requested on the command line with `-D bogus` = note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 4 warnings emitted
For more information about this error, try `rustc --explain E0602`. For more information about this error, try `rustc --explain E0602`.

View File

@ -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() {}

View File

@ -1,24 +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 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
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 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,5 +1,3 @@
#![feature(lint_reasons)]
use std::ops::Deref; use std::ops::Deref;
pub trait Foo { pub trait Foo {

View File

@ -1,7 +1,5 @@
//@ check-pass //@ check-pass
#![feature(lint_reasons)]
pub struct Wrapper<T>(T); pub struct Wrapper<T>(T);
pub trait Foo { pub trait Foo {

View File

@ -5,7 +5,7 @@ LL | let _: &dyn rpitit::Foo = todo!();
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
| |
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/auxiliary/rpitit.rs:6:21 --> $DIR/auxiliary/rpitit.rs:4:21
| |
LL | fn bar(self) -> impl Deref<Target = impl Sized>; LL | fn bar(self) -> impl Deref<Target = impl Sized>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type

View File

@ -1,8 +1,6 @@
//@ check-pass //@ check-pass
//@ aux-build: rpitit.rs //@ aux-build: rpitit.rs
#![feature(lint_reasons)]
extern crate rpitit; extern crate rpitit;
use rpitit::{Foo, Foreign}; use rpitit::{Foo, Foreign};

Some files were not shown because too many files have changed in this diff Show More