1
Fork 0

RFC 2383: Stabilize lint_reasons in Clippy 🖇️

This commit is contained in:
xFrednet 2024-02-10 22:31:36 +00:00
parent dfaa53fd58
commit 1b4c281fe7
74 changed files with 620 additions and 582 deletions

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,3 +1,12 @@
error: the feature `lint_reasons` has been stable since 1.81.0-dev and no longer requires an attribute to enable
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:2:24
|
LL | #![feature(decl_macro, lint_reasons)]
| ^^^^^^^^^^^^
|
= note: `-D stable-features` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(stable_features)]`
error: this macro expands metavariables in an unsafe block error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:19:9 --> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:19:9
| |
@ -183,5 +192,5 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable = help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite = help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite
error: aborting due to 14 previous errors error: aborting due to 15 previous errors

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)]