diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 9bb53fea54a18..c2439abddf4de 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -71,6 +71,7 @@ mod passes; mod precedence; mod ptr_nulls; mod redundant_semicolon; +mod redundant_sizedness_bounds; mod reference_casting; mod shadowed_into_iter; mod static_mut_refs; @@ -111,6 +112,7 @@ use pass_by_value::*; use precedence::*; use ptr_nulls::*; use redundant_semicolon::*; +use redundant_sizedness_bounds::RedundantSizednessBounds; use reference_casting::*; use rustc_hir::def_id::LocalModDefId; use rustc_middle::query::Providers; @@ -246,6 +248,7 @@ late_lint_methods!( UnqualifiedLocalImports: UnqualifiedLocalImports, CheckTransmutes: CheckTransmutes, LifetimeSyntax: LifetimeSyntax, + RedundantSizednessBounds: RedundantSizednessBounds, ] ] ); diff --git a/compiler/rustc_lint/src/redundant_sizedness_bounds.rs b/compiler/rustc_lint/src/redundant_sizedness_bounds.rs new file mode 100644 index 0000000000000..9fd63a1d869a8 --- /dev/null +++ b/compiler/rustc_lint/src/redundant_sizedness_bounds.rs @@ -0,0 +1,241 @@ +use rustc_errors::Applicability; +use rustc_hir::def_id::{DefId, DefIdMap}; +use rustc_hir::{ + BoundPolarity, GenericBound, Generics, PolyTraitRef, TraitBoundModifiers, WherePredicateKind, +}; +use rustc_middle::ty::{ClauseKind, PredicatePolarity}; +use rustc_session::{declare_lint, declare_lint_pass}; +use rustc_span::symbol::Ident; + +use crate::{LateContext, LateLintPass, LintContext}; + +declare_lint! { + /// The `redundant_sizedness_bounds` lint detects redundant sizedness bounds + /// applied to type parameters that are already otherwise implied. + /// + /// ### Example + /// + /// ```rust + /// // `T` must be `Sized` due to the bound `Clone`, thus `?Sized` is redundant. + /// fn f(t: &T) {} + /// // `T` is `Sized` due to `Default` bound, thus the explicit `Sized` bound is redundant. + /// fn g(t: &T) {} + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// Sizedness bounds that have no effect, as another bound implies `Sized`, + /// are redundant and can be misleading. This lint notifies the user of + /// these redundant bounds. + pub REDUNDANT_SIZEDNESS_BOUNDS, + Warn, + "a sizedness bound that is redundant due to another bound" +} +declare_lint_pass!(RedundantSizednessBounds => [REDUNDANT_SIZEDNESS_BOUNDS]); + +struct Bound<'tcx> { + /// The [`DefId`] of the type parameter the bound refers to. + param: DefId, + /// Identifier of type parameter. + ident: Ident, + /// A reference to the trait bound applied to the parameter. + trait_bound: &'tcx PolyTraitRef<'tcx>, + /// The index of the predicate within the generics predicate list. + predicate_pos: usize, + /// Position of the bound in the bounds list of a predicate. + bound_pos: usize, +} + +/// Finds all of the [`Bound`]s that refer to a type parameter and are not from a macro expansion. +fn type_param_bounds<'tcx>(generics: &'tcx Generics<'tcx>) -> impl Iterator> { + generics + .predicates + .iter() + .enumerate() + .filter_map(|(predicate_pos, predicate)| { + let WherePredicateKind::BoundPredicate(bound_predicate) = &predicate.kind else { + return None; + }; + + let (param, ident) = bound_predicate.bounded_ty.as_generic_param()?; + + Some( + bound_predicate + .bounds + .iter() + .enumerate() + .filter_map(move |(bound_pos, bound)| match bound { + GenericBound::Trait(trait_bound) => { + Some(Bound { param, ident, trait_bound, predicate_pos, bound_pos }) + } + GenericBound::Outlives(_) | GenericBound::Use(..) => None, + }) + .filter(|bound| !bound.trait_bound.span.from_expansion()), + ) + }) + .flatten() +} + +/// Searches the supertraits of the trait referred to by `trait_bound` recursively, returning the +/// path taken to find the `target` bound if one is found. +fn path_to_bound( + cx: &LateContext<'_>, + trait_bound: &PolyTraitRef<'_>, + target: DefId, +) -> Option> { + fn search(cx: &LateContext<'_>, path: &mut Vec, target: DefId) -> bool { + let trait_def_id = *path.last().unwrap(); + + if trait_def_id == target { + return true; + } + + for (predicate, _) in + cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() + { + if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() + && trait_predicate.polarity == PredicatePolarity::Positive + && !path.contains(&trait_predicate.def_id()) + { + path.push(trait_predicate.def_id()); + if search(cx, path, target) { + return true; + } + path.pop(); + } + } + + false + } + + let mut path = vec![trait_bound.trait_ref.trait_def_id()?]; + search(cx, &mut path, target).then_some(path) +} + +// Checks if there exists a bound `redundant_bound` that is already implied by `implicit_bound`. +fn check_redundant_sizedness_bounds( + redundant_bound: DefId, + redundant_bound_polarity: BoundPolarity, + implicit_bound: DefId, + cx: &LateContext<'_>, + generics: &Generics<'_>, +) -> bool { + let redundant_sized_params: DefIdMap<_> = type_param_bounds(generics) + .filter(|bound| { + bound.trait_bound.trait_ref.trait_def_id() == Some(redundant_bound) + // Here we wish to compare the variant of the enum `BoundPolarity` whilst + // disregarding the contents of the variant. + && std::mem::discriminant(&bound.trait_bound.modifiers.polarity) + == std::mem::discriminant(&redundant_bound_polarity) + }) + .map(|bound| (bound.param, bound)) + .collect(); + + for bound in type_param_bounds(generics) { + if bound.trait_bound.modifiers == TraitBoundModifiers::NONE + && let Some(redundant_sized_bound) = redundant_sized_params.get(&bound.param) + && let Some(path) = path_to_bound(cx, bound.trait_bound, implicit_bound) + { + let redundant_bound_polarity_str = match redundant_bound_polarity { + BoundPolarity::Maybe(_) => "?", + _ => "", + }; + cx.span_lint( + REDUNDANT_SIZEDNESS_BOUNDS, + redundant_sized_bound.trait_bound.span, + |diag| { + let redundant_bound_str = cx.tcx.def_path_str(redundant_bound); + let implicit_bound_str = cx.tcx.def_path_str(implicit_bound); + + diag.primary_message(format!( + "`{}{}` bound is redundant because of a `{}` requirement", + redundant_bound_polarity_str, redundant_bound_str, implicit_bound_str, + )); + let ty_param = redundant_sized_bound.ident; + diag.span_note( + bound.trait_bound.span, + format!( + "`{ty_param}` is implied to be `{}` because of the bound", + implicit_bound_str, + ), + ); + + for &[current_id, next_id] in path.array_windows() { + let current = cx.tcx.item_name(current_id); + let next = cx.tcx.item_name(next_id); + diag.note(format!("...because `{current}` has the bound `{next}`")); + } + + diag.span_suggestion_verbose( + generics.span_for_bound_removal( + redundant_sized_bound.predicate_pos, + redundant_sized_bound.bound_pos, + ), + format!( + "change the bounds that require `{}`, or remove the `{}{}` bound", + implicit_bound_str, redundant_bound_polarity_str, redundant_bound_str, + ), + "", + Applicability::MaybeIncorrect, + ); + }, + ); + + return true; + } + } + false +} + +impl LateLintPass<'_> for RedundantSizednessBounds { + fn check_generics(&mut self, cx: &LateContext<'_>, generics: &Generics<'_>) { + let Some(sized_trait) = cx.tcx.lang_items().sized_trait() else { + return; + }; + let Some(meta_sized_trait) = cx.tcx.lang_items().meta_sized_trait() else { + return; + }; + let Some(pointee_sized_trait) = cx.tcx.lang_items().pointee_sized_trait() else { + return; + }; + + if check_redundant_sizedness_bounds( + sized_trait, + BoundPolarity::Maybe(Default::default()), + sized_trait, + cx, + generics, + ) { + return; + } + if check_redundant_sizedness_bounds( + meta_sized_trait, + BoundPolarity::Positive, + sized_trait, + cx, + generics, + ) { + return; + } + if check_redundant_sizedness_bounds( + pointee_sized_trait, + BoundPolarity::Positive, + sized_trait, + cx, + generics, + ) { + return; + } + if check_redundant_sizedness_bounds( + pointee_sized_trait, + BoundPolarity::Positive, + meta_sized_trait, + cx, + generics, + ) { + return; + } + } +} diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 7f2a40f753fa6..ce7e9471b8673 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -36,7 +36,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use crate::marker::{Destruct, PointeeSized}; +use crate::marker::Destruct; mod uninit; @@ -322,7 +322,7 @@ impl_use_cloned! { reason = "deriving hack, should not be public", issue = "none" )] -pub struct AssertParamIsClone { +pub struct AssertParamIsClone { _field: crate::marker::PhantomData, } #[doc(hidden)] @@ -332,7 +332,7 @@ pub struct AssertParamIsClone { reason = "deriving hack, should not be public", issue = "none" )] -pub struct AssertParamIsCopy { +pub struct AssertParamIsCopy { _field: crate::marker::PhantomData, } diff --git a/library/std/src/sync/nonpoison/mutex.rs b/library/std/src/sync/nonpoison/mutex.rs index ed3f8cfed821a..307bf8eaf512e 100644 --- a/library/std/src/sync/nonpoison/mutex.rs +++ b/library/std/src/sync/nonpoison/mutex.rs @@ -422,7 +422,7 @@ impl From for Mutex { } #[unstable(feature = "nonpoison_mutex", issue = "134645")] -impl Default for Mutex { +impl Default for Mutex { /// Creates a `Mutex`, with the `Default` value for T. fn default() -> Mutex { Mutex::new(Default::default()) diff --git a/library/std/src/sync/poison/mutex.rs b/library/std/src/sync/poison/mutex.rs index 6fdb4f6799ee5..2970c68eba0f1 100644 --- a/library/std/src/sync/poison/mutex.rs +++ b/library/std/src/sync/poison/mutex.rs @@ -683,7 +683,7 @@ impl From for Mutex { } #[stable(feature = "mutex_default", since = "1.10.0")] -impl Default for Mutex { +impl Default for Mutex { /// Creates a `Mutex`, with the `Default` value for T. fn default() -> Mutex { Mutex::new(Default::default()) diff --git a/src/tools/clippy/clippy_lints/src/declared_lints.rs b/src/tools/clippy/clippy_lints/src/declared_lints.rs index 0ec0aaaad4536..65cf432b76b1a 100644 --- a/src/tools/clippy/clippy_lints/src/declared_lints.rs +++ b/src/tools/clippy/clippy_lints/src/declared_lints.rs @@ -546,7 +546,6 @@ pub static LINTS: &[&::declare_clippy_lint::LintInfo] = &[ crate::needless_for_each::NEEDLESS_FOR_EACH_INFO, crate::needless_if::NEEDLESS_IF_INFO, crate::needless_late_init::NEEDLESS_LATE_INIT_INFO, - crate::needless_maybe_sized::NEEDLESS_MAYBE_SIZED_INFO, crate::needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS_INFO, crate::needless_pass_by_ref_mut::NEEDLESS_PASS_BY_REF_MUT_INFO, crate::needless_pass_by_value::NEEDLESS_PASS_BY_VALUE_INFO, diff --git a/src/tools/clippy/clippy_lints/src/deprecated_lints.rs b/src/tools/clippy/clippy_lints/src/deprecated_lints.rs index 2147f72889093..a458feedc3ead 100644 --- a/src/tools/clippy/clippy_lints/src/deprecated_lints.rs +++ b/src/tools/clippy/clippy_lints/src/deprecated_lints.rs @@ -138,6 +138,8 @@ declare_with_version! { RENAMED(RENAMED_VERSION) = [ ("clippy::mem_discriminant_non_enum", "enum_intrinsics_non_enums"), #[clippy::version = "1.80.0"] ("clippy::mismatched_target_os", "unexpected_cfgs"), + #[clippy::version = "1.91.0"] + ("clippy::needless_maybe_sized", "redundant_sizedness_bounds"), #[clippy::version = ""] ("clippy::new_without_default_derive", "clippy::new_without_default"), #[clippy::version = ""] diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 815411348aa66..7cc1a15a1ef35 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -262,7 +262,6 @@ mod needless_else; mod needless_for_each; mod needless_if; mod needless_late_init; -mod needless_maybe_sized; mod needless_parens_on_range_literals; mod needless_pass_by_ref_mut; mod needless_pass_by_value; @@ -740,7 +739,6 @@ pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Co store.register_late_pass(|_| Box::new(no_mangle_with_rust_abi::NoMangleWithRustAbi)); store.register_late_pass(|_| Box::new(collection_is_never_read::CollectionIsNeverRead)); store.register_late_pass(|_| Box::new(missing_assert_message::MissingAssertMessage)); - store.register_late_pass(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized)); store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock)); store.register_early_pass(|| Box::new(let_with_type_underscore::UnderscoreTyped)); store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(conf))); diff --git a/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs b/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs deleted file mode 100644 index ad6313e391bd9..0000000000000 --- a/src/tools/clippy/clippy_lints/src/needless_maybe_sized.rs +++ /dev/null @@ -1,162 +0,0 @@ -use clippy_utils::diagnostics::span_lint_and_then; -use rustc_errors::Applicability; -use rustc_hir::def_id::{DefId, DefIdMap}; -use rustc_hir::{BoundPolarity, GenericBound, Generics, PolyTraitRef, TraitBoundModifiers, WherePredicateKind}; -use rustc_lint::{LateContext, LateLintPass}; -use rustc_middle::ty::{ClauseKind, PredicatePolarity}; -use rustc_session::declare_lint_pass; -use rustc_span::symbol::Ident; - -declare_clippy_lint! { - /// ### What it does - /// Lints `?Sized` bounds applied to type parameters that cannot be unsized - /// - /// ### Why is this bad? - /// The `?Sized` bound is misleading because it cannot be satisfied by an - /// unsized type - /// - /// ### Example - /// ```rust - /// // `T` cannot be unsized because `Clone` requires it to be `Sized` - /// fn f(t: &T) {} - /// ``` - /// Use instead: - /// ```rust - /// fn f(t: &T) {} - /// - /// // or choose alternative bounds for `T` so that it can be unsized - /// ``` - #[clippy::version = "1.81.0"] - pub NEEDLESS_MAYBE_SIZED, - suspicious, - "a `?Sized` bound that is unusable due to a `Sized` requirement" -} -declare_lint_pass!(NeedlessMaybeSized => [NEEDLESS_MAYBE_SIZED]); - -#[allow(clippy::struct_field_names)] -struct Bound<'tcx> { - /// The [`DefId`] of the type parameter the bound refers to - param: DefId, - ident: Ident, - - trait_bound: &'tcx PolyTraitRef<'tcx>, - - predicate_pos: usize, - bound_pos: usize, -} - -/// Finds all of the [`Bound`]s that refer to a type parameter and are not from a macro expansion -fn type_param_bounds<'tcx>(generics: &'tcx Generics<'tcx>) -> impl Iterator> { - generics - .predicates - .iter() - .enumerate() - .filter_map(|(predicate_pos, predicate)| { - let WherePredicateKind::BoundPredicate(bound_predicate) = &predicate.kind else { - return None; - }; - - let (param, ident) = bound_predicate.bounded_ty.as_generic_param()?; - - Some( - bound_predicate - .bounds - .iter() - .enumerate() - .filter_map(move |(bound_pos, bound)| match bound { - GenericBound::Trait(trait_bound) => Some(Bound { - param, - ident, - trait_bound, - predicate_pos, - bound_pos, - }), - GenericBound::Outlives(_) | GenericBound::Use(..) => None, - }) - .filter(|bound| !bound.trait_bound.span.from_expansion()), - ) - }) - .flatten() -} - -/// Searches the supertraits of the trait referred to by `trait_bound` recursively, returning the -/// path taken to find a `Sized` bound if one is found -fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) -> Option> { - fn search(cx: &LateContext<'_>, path: &mut Vec) -> bool { - let trait_def_id = *path.last().unwrap(); - - if Some(trait_def_id) == cx.tcx.lang_items().sized_trait() { - return true; - } - - for (predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() { - if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() - && trait_predicate.polarity == PredicatePolarity::Positive - && !path.contains(&trait_predicate.def_id()) - { - path.push(trait_predicate.def_id()); - if search(cx, path) { - return true; - } - path.pop(); - } - } - - false - } - - let mut path = vec![trait_bound.trait_ref.trait_def_id()?]; - search(cx, &mut path).then_some(path) -} - -impl LateLintPass<'_> for NeedlessMaybeSized { - fn check_generics(&mut self, cx: &LateContext<'_>, generics: &Generics<'_>) { - let Some(sized_trait) = cx.tcx.lang_items().sized_trait() else { - return; - }; - - let maybe_sized_params: DefIdMap<_> = type_param_bounds(generics) - .filter(|bound| { - bound.trait_bound.trait_ref.trait_def_id() == Some(sized_trait) - && matches!(bound.trait_bound.modifiers.polarity, BoundPolarity::Maybe(_)) - }) - .map(|bound| (bound.param, bound)) - .collect(); - - for bound in type_param_bounds(generics) { - if bound.trait_bound.modifiers == TraitBoundModifiers::NONE - && let Some(sized_bound) = maybe_sized_params.get(&bound.param) - && let Some(path) = path_to_sized_bound(cx, bound.trait_bound) - { - span_lint_and_then( - cx, - NEEDLESS_MAYBE_SIZED, - sized_bound.trait_bound.span, - "`?Sized` bound is ignored because of a `Sized` requirement", - |diag| { - let ty_param = sized_bound.ident; - diag.span_note( - bound.trait_bound.span, - format!("`{ty_param}` cannot be unsized because of the bound"), - ); - - for &[current_id, next_id] in path.array_windows() { - let current = cx.tcx.item_name(current_id); - let next = cx.tcx.item_name(next_id); - diag.note(format!("...because `{current}` has the bound `{next}`")); - } - - diag.span_suggestion_verbose( - generics.span_for_bound_removal(sized_bound.predicate_pos, sized_bound.bound_pos), - "change the bounds that require `Sized`, or remove the `?Sized` bound", - "", - Applicability::MaybeIncorrect, - ); - }, - ); - - return; - } - } - } -} diff --git a/src/tools/clippy/tests/ui-toml/type_repetition_in_bounds/main.rs b/src/tools/clippy/tests/ui-toml/type_repetition_in_bounds/main.rs index b60cb7632e201..a10250b673f08 100644 --- a/src/tools/clippy/tests/ui-toml/type_repetition_in_bounds/main.rs +++ b/src/tools/clippy/tests/ui-toml/type_repetition_in_bounds/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::needless_maybe_sized)] +#![allow(redundant_sizedness_bounds)] #![warn(clippy::type_repetition_in_bounds)] fn f() diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index fdd851414746b..b7c2523569de4 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -42,6 +42,7 @@ #![allow(clippy::overly_complex_bool_expr)] #![allow(unexpected_cfgs)] #![allow(enum_intrinsics_non_enums)] +#![allow(redundant_sizedness_bounds)] #![allow(clippy::new_without_default)] #![allow(clippy::bind_instead_of_map)] #![allow(clippy::expect_used)] @@ -109,6 +110,7 @@ #![warn(unexpected_cfgs)] //~ ERROR: lint `clippy::maybe_misused_cfg` #![warn(enum_intrinsics_non_enums)] //~ ERROR: lint `clippy::mem_discriminant_non_enum` #![warn(unexpected_cfgs)] //~ ERROR: lint `clippy::mismatched_target_os` +#![warn(redundant_sizedness_bounds)] //~ ERROR: lint `clippy::needless_maybe_sized` #![warn(clippy::new_without_default)] //~ ERROR: lint `clippy::new_without_default_derive` #![warn(clippy::bind_instead_of_map)] //~ ERROR: lint `clippy::option_and_then_some` #![warn(clippy::expect_used)] //~ ERROR: lint `clippy::option_expect_used` diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index 591c8ca53ac22..3fedaa0d2ffc0 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -42,6 +42,7 @@ #![allow(clippy::overly_complex_bool_expr)] #![allow(unexpected_cfgs)] #![allow(enum_intrinsics_non_enums)] +#![allow(redundant_sizedness_bounds)] #![allow(clippy::new_without_default)] #![allow(clippy::bind_instead_of_map)] #![allow(clippy::expect_used)] @@ -109,6 +110,7 @@ #![warn(clippy::maybe_misused_cfg)] //~ ERROR: lint `clippy::maybe_misused_cfg` #![warn(clippy::mem_discriminant_non_enum)] //~ ERROR: lint `clippy::mem_discriminant_non_enum` #![warn(clippy::mismatched_target_os)] //~ ERROR: lint `clippy::mismatched_target_os` +#![warn(clippy::needless_maybe_sized)] //~ ERROR: lint `clippy::needless_maybe_sized` #![warn(clippy::new_without_default_derive)] //~ ERROR: lint `clippy::new_without_default_derive` #![warn(clippy::option_and_then_some)] //~ ERROR: lint `clippy::option_and_then_some` #![warn(clippy::option_expect_used)] //~ ERROR: lint `clippy::option_expect_used` diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index b54fec8c57949..edd048ea55615 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -1,5 +1,5 @@ error: lint `clippy::almost_complete_letter_range` has been renamed to `clippy::almost_complete_range` - --> tests/ui/rename.rs:68:9 + --> tests/ui/rename.rs:69:9 | LL | #![warn(clippy::almost_complete_letter_range)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::almost_complete_range` @@ -8,442 +8,448 @@ LL | #![warn(clippy::almost_complete_letter_range)] = help: to override `-D warnings` add `#[allow(renamed_and_removed_lints)]` error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names` - --> tests/ui/rename.rs:69:9 + --> tests/ui/rename.rs:70:9 | LL | #![warn(clippy::blacklisted_name)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names` error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_conditions` - --> tests/ui/rename.rs:70:9 + --> tests/ui/rename.rs:71:9 | LL | #![warn(clippy::block_in_if_condition_expr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_conditions` - --> tests/ui/rename.rs:71:9 + --> tests/ui/rename.rs:72:9 | LL | #![warn(clippy::block_in_if_condition_stmt)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` error: lint `clippy::blocks_in_if_conditions` has been renamed to `clippy::blocks_in_conditions` - --> tests/ui/rename.rs:72:9 + --> tests/ui/rename.rs:73:9 | LL | #![warn(clippy::blocks_in_if_conditions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_conditions` error: lint `clippy::box_vec` has been renamed to `clippy::box_collection` - --> tests/ui/rename.rs:73:9 + --> tests/ui/rename.rs:74:9 | LL | #![warn(clippy::box_vec)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection` error: lint `clippy::cast_ref_to_mut` has been renamed to `invalid_reference_casting` - --> tests/ui/rename.rs:74:9 + --> tests/ui/rename.rs:75:9 | LL | #![warn(clippy::cast_ref_to_mut)] | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_reference_casting` error: lint `clippy::clone_double_ref` has been renamed to `suspicious_double_ref_op` - --> tests/ui/rename.rs:75:9 + --> tests/ui/rename.rs:76:9 | LL | #![warn(clippy::clone_double_ref)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `suspicious_double_ref_op` error: lint `clippy::cmp_nan` has been renamed to `invalid_nan_comparisons` - --> tests/ui/rename.rs:76:9 + --> tests/ui/rename.rs:77:9 | LL | #![warn(clippy::cmp_nan)] | ^^^^^^^^^^^^^^^ help: use the new name: `invalid_nan_comparisons` error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes` - --> tests/ui/rename.rs:77:9 + --> tests/ui/rename.rs:78:9 | LL | #![warn(clippy::const_static_lifetime)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> tests/ui/rename.rs:78:9 + --> tests/ui/rename.rs:79:9 | LL | #![warn(clippy::cyclomatic_complexity)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` error: lint `clippy::derive_hash_xor_eq` has been renamed to `clippy::derived_hash_with_manual_eq` - --> tests/ui/rename.rs:79:9 + --> tests/ui/rename.rs:80:9 | LL | #![warn(clippy::derive_hash_xor_eq)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::derived_hash_with_manual_eq` error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods` - --> tests/ui/rename.rs:80:9 + --> tests/ui/rename.rs:81:9 | LL | #![warn(clippy::disallowed_method)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods` error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types` - --> tests/ui/rename.rs:81:9 + --> tests/ui/rename.rs:82:9 | LL | #![warn(clippy::disallowed_type)] | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types` error: lint `clippy::double_neg` has been renamed to `double_negations` - --> tests/ui/rename.rs:82:9 + --> tests/ui/rename.rs:83:9 | LL | #![warn(clippy::double_neg)] | ^^^^^^^^^^^^^^^^^^ help: use the new name: `double_negations` error: lint `clippy::drop_bounds` has been renamed to `drop_bounds` - --> tests/ui/rename.rs:83:9 + --> tests/ui/rename.rs:84:9 | LL | #![warn(clippy::drop_bounds)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds` error: lint `clippy::drop_copy` has been renamed to `dropping_copy_types` - --> tests/ui/rename.rs:84:9 + --> tests/ui/rename.rs:85:9 | LL | #![warn(clippy::drop_copy)] | ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types` error: lint `clippy::drop_ref` has been renamed to `dropping_references` - --> tests/ui/rename.rs:85:9 + --> tests/ui/rename.rs:86:9 | LL | #![warn(clippy::drop_ref)] | ^^^^^^^^^^^^^^^^ help: use the new name: `dropping_references` error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression` - --> tests/ui/rename.rs:86:9 + --> tests/ui/rename.rs:87:9 | LL | #![warn(clippy::eval_order_dependence)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression` error: lint `clippy::filter_map` has been renamed to `clippy::manual_filter_map` - --> tests/ui/rename.rs:87:9 + --> tests/ui/rename.rs:88:9 | LL | #![warn(clippy::filter_map)] | ^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::manual_filter_map` error: lint `clippy::find_map` has been renamed to `clippy::manual_find_map` - --> tests/ui/rename.rs:88:9 + --> tests/ui/rename.rs:89:9 | LL | #![warn(clippy::find_map)] | ^^^^^^^^^^^^^^^^ help: use the new name: `clippy::manual_find_map` error: lint `clippy::fn_address_comparisons` has been renamed to `unpredictable_function_pointer_comparisons` - --> tests/ui/rename.rs:89:9 + --> tests/ui/rename.rs:90:9 | LL | #![warn(clippy::fn_address_comparisons)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unpredictable_function_pointer_comparisons` error: lint `clippy::fn_null_check` has been renamed to `useless_ptr_null_checks` - --> tests/ui/rename.rs:90:9 + --> tests/ui/rename.rs:91:9 | LL | #![warn(clippy::fn_null_check)] | ^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `useless_ptr_null_checks` error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles` - --> tests/ui/rename.rs:91:9 + --> tests/ui/rename.rs:92:9 | LL | #![warn(clippy::for_loop_over_option)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles` - --> tests/ui/rename.rs:92:9 + --> tests/ui/rename.rs:93:9 | LL | #![warn(clippy::for_loop_over_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles` - --> tests/ui/rename.rs:93:9 + --> tests/ui/rename.rs:94:9 | LL | #![warn(clippy::for_loops_over_fallibles)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` - --> tests/ui/rename.rs:94:9 + --> tests/ui/rename.rs:95:9 | LL | #![warn(clippy::forget_copy)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` error: lint `clippy::forget_ref` has been renamed to `forgetting_references` - --> tests/ui/rename.rs:95:9 + --> tests/ui/rename.rs:96:9 | LL | #![warn(clippy::forget_ref)] | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references` error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion` - --> tests/ui/rename.rs:96:9 + --> tests/ui/rename.rs:97:9 | LL | #![warn(clippy::identity_conversion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion` error: lint `clippy::if_let_redundant_pattern_matching` has been renamed to `clippy::redundant_pattern_matching` - --> tests/ui/rename.rs:97:9 + --> tests/ui/rename.rs:98:9 | LL | #![warn(clippy::if_let_redundant_pattern_matching)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_pattern_matching` error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok` - --> tests/ui/rename.rs:98:9 + --> tests/ui/rename.rs:99:9 | LL | #![warn(clippy::if_let_some_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok` error: lint `clippy::incorrect_clone_impl_on_copy_type` has been renamed to `clippy::non_canonical_clone_impl` - --> tests/ui/rename.rs:99:9 + --> tests/ui/rename.rs:100:9 | LL | #![warn(clippy::incorrect_clone_impl_on_copy_type)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::non_canonical_clone_impl` error: lint `clippy::incorrect_partial_ord_impl_on_ord_type` has been renamed to `clippy::non_canonical_partial_ord_impl` - --> tests/ui/rename.rs:100:9 + --> tests/ui/rename.rs:101:9 | LL | #![warn(clippy::incorrect_partial_ord_impl_on_ord_type)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::non_canonical_partial_ord_impl` error: lint `clippy::integer_arithmetic` has been renamed to `clippy::arithmetic_side_effects` - --> tests/ui/rename.rs:101:9 + --> tests/ui/rename.rs:102:9 | LL | #![warn(clippy::integer_arithmetic)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::arithmetic_side_effects` error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` - --> tests/ui/rename.rs:102:9 + --> tests/ui/rename.rs:103:9 | LL | #![warn(clippy::into_iter_on_array)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter` error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering` - --> tests/ui/rename.rs:103:9 + --> tests/ui/rename.rs:104:9 | LL | #![warn(clippy::invalid_atomic_ordering)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering` error: lint `clippy::invalid_null_ptr_usage` has been renamed to `invalid_null_arguments` - --> tests/ui/rename.rs:104:9 + --> tests/ui/rename.rs:105:9 | LL | #![warn(clippy::invalid_null_ptr_usage)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_null_arguments` error: lint `clippy::invalid_ref` has been renamed to `invalid_value` - --> tests/ui/rename.rs:105:9 + --> tests/ui/rename.rs:106:9 | LL | #![warn(clippy::invalid_ref)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value` error: lint `clippy::invalid_utf8_in_unchecked` has been renamed to `invalid_from_utf8_unchecked` - --> tests/ui/rename.rs:106:9 + --> tests/ui/rename.rs:107:9 | LL | #![warn(clippy::invalid_utf8_in_unchecked)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_from_utf8_unchecked` error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop` - --> tests/ui/rename.rs:107:9 + --> tests/ui/rename.rs:108:9 | LL | #![warn(clippy::let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop` error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr` - --> tests/ui/rename.rs:108:9 + --> tests/ui/rename.rs:109:9 | LL | #![warn(clippy::logic_bug)] | ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr` error: lint `clippy::maybe_misused_cfg` has been renamed to `unexpected_cfgs` - --> tests/ui/rename.rs:109:9 + --> tests/ui/rename.rs:110:9 | LL | #![warn(clippy::maybe_misused_cfg)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unexpected_cfgs` error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums` - --> tests/ui/rename.rs:110:9 + --> tests/ui/rename.rs:111:9 | LL | #![warn(clippy::mem_discriminant_non_enum)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums` error: lint `clippy::mismatched_target_os` has been renamed to `unexpected_cfgs` - --> tests/ui/rename.rs:111:9 + --> tests/ui/rename.rs:112:9 | LL | #![warn(clippy::mismatched_target_os)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unexpected_cfgs` +error: lint `clippy::needless_maybe_sized` has been renamed to `redundant_sizedness_bounds` + --> tests/ui/rename.rs:113:9 + | +LL | #![warn(clippy::needless_maybe_sized)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `redundant_sizedness_bounds` + error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default` - --> tests/ui/rename.rs:112:9 + --> tests/ui/rename.rs:114:9 | LL | #![warn(clippy::new_without_default_derive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map` - --> tests/ui/rename.rs:113:9 + --> tests/ui/rename.rs:115:9 | LL | #![warn(clippy::option_and_then_some)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map` error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used` - --> tests/ui/rename.rs:114:9 + --> tests/ui/rename.rs:116:9 | LL | #![warn(clippy::option_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or` - --> tests/ui/rename.rs:115:9 + --> tests/ui/rename.rs:117:9 | LL | #![warn(clippy::option_map_unwrap_or)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> tests/ui/rename.rs:116:9 + --> tests/ui/rename.rs:118:9 | LL | #![warn(clippy::option_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used` - --> tests/ui/rename.rs:117:9 + --> tests/ui/rename.rs:119:9 | LL | #![warn(clippy::option_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::overflow_check_conditional` has been renamed to `clippy::panicking_overflow_checks` - --> tests/ui/rename.rs:118:9 + --> tests/ui/rename.rs:120:9 | LL | #![warn(clippy::overflow_check_conditional)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::panicking_overflow_checks` error: lint `clippy::panic_params` has been renamed to `non_fmt_panics` - --> tests/ui/rename.rs:119:9 + --> tests/ui/rename.rs:121:9 | LL | #![warn(clippy::panic_params)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics` error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally` - --> tests/ui/rename.rs:120:9 + --> tests/ui/rename.rs:122:9 | LL | #![warn(clippy::positional_named_format_parameters)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally` error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow` - --> tests/ui/rename.rs:121:9 + --> tests/ui/rename.rs:123:9 | LL | #![warn(clippy::ref_in_deref)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow` error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used` - --> tests/ui/rename.rs:122:9 + --> tests/ui/rename.rs:124:9 | LL | #![warn(clippy::result_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> tests/ui/rename.rs:123:9 + --> tests/ui/rename.rs:125:9 | LL | #![warn(clippy::result_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used` - --> tests/ui/rename.rs:124:9 + --> tests/ui/rename.rs:126:9 | LL | #![warn(clippy::result_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::reverse_range_loop` has been renamed to `clippy::reversed_empty_ranges` - --> tests/ui/rename.rs:125:9 + --> tests/ui/rename.rs:127:9 | LL | #![warn(clippy::reverse_range_loop)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::reversed_empty_ranges` error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str` - --> tests/ui/rename.rs:126:9 + --> tests/ui/rename.rs:128:9 | LL | #![warn(clippy::single_char_push_str)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str` error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` - --> tests/ui/rename.rs:127:9 + --> tests/ui/rename.rs:129:9 | LL | #![warn(clippy::stutter)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries` - --> tests/ui/rename.rs:128:9 + --> tests/ui/rename.rs:130:9 | LL | #![warn(clippy::temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `dangling_pointers_from_temporaries` error: lint `clippy::thread_local_initializer_can_be_made_const` has been renamed to `clippy::missing_const_for_thread_local` - --> tests/ui/rename.rs:129:9 + --> tests/ui/rename.rs:131:9 | LL | #![warn(clippy::thread_local_initializer_can_be_made_const)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::missing_const_for_thread_local` error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl` - --> tests/ui/rename.rs:130:9 + --> tests/ui/rename.rs:132:9 | LL | #![warn(clippy::to_string_in_display)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl` error: lint `clippy::transmute_float_to_int` has been renamed to `unnecessary_transmutes` - --> tests/ui/rename.rs:131:9 + --> tests/ui/rename.rs:133:9 | LL | #![warn(clippy::transmute_float_to_int)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unnecessary_transmutes` error: lint `clippy::transmute_int_to_char` has been renamed to `unnecessary_transmutes` - --> tests/ui/rename.rs:132:9 + --> tests/ui/rename.rs:134:9 | LL | #![warn(clippy::transmute_int_to_char)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unnecessary_transmutes` error: lint `clippy::transmute_int_to_float` has been renamed to `unnecessary_transmutes` - --> tests/ui/rename.rs:133:9 + --> tests/ui/rename.rs:135:9 | LL | #![warn(clippy::transmute_int_to_float)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unnecessary_transmutes` error: lint `clippy::transmute_num_to_bytes` has been renamed to `unnecessary_transmutes` - --> tests/ui/rename.rs:134:9 + --> tests/ui/rename.rs:136:9 | LL | #![warn(clippy::transmute_num_to_bytes)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unnecessary_transmutes` error: lint `clippy::unchecked_duration_subtraction` has been renamed to `clippy::unchecked_time_subtraction` - --> tests/ui/rename.rs:135:9 + --> tests/ui/rename.rs:137:9 | LL | #![warn(clippy::unchecked_duration_subtraction)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unchecked_time_subtraction` error: lint `clippy::undropped_manually_drops` has been renamed to `undropped_manually_drops` - --> tests/ui/rename.rs:136:9 + --> tests/ui/rename.rs:138:9 | LL | #![warn(clippy::undropped_manually_drops)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `undropped_manually_drops` error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints` - --> tests/ui/rename.rs:137:9 + --> tests/ui/rename.rs:139:9 | LL | #![warn(clippy::unknown_clippy_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints` error: lint `clippy::unused_label` has been renamed to `unused_labels` - --> tests/ui/rename.rs:138:9 + --> tests/ui/rename.rs:140:9 | LL | #![warn(clippy::unused_label)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels` error: lint `clippy::unwrap_or_else_default` has been renamed to `clippy::unwrap_or_default` - --> tests/ui/rename.rs:139:9 + --> tests/ui/rename.rs:141:9 | LL | #![warn(clippy::unwrap_or_else_default)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_or_default` error: lint `clippy::vtable_address_comparisons` has been renamed to `ambiguous_wide_pointer_comparisons` - --> tests/ui/rename.rs:140:9 + --> tests/ui/rename.rs:142:9 | LL | #![warn(clippy::vtable_address_comparisons)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `ambiguous_wide_pointer_comparisons` error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters` - --> tests/ui/rename.rs:141:9 + --> tests/ui/rename.rs:143:9 | LL | #![warn(clippy::zero_width_space)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters` -error: aborting due to 74 previous errors +error: aborting due to 75 previous errors diff --git a/src/tools/clippy/tests/ui/type_repetition_in_bounds.rs b/src/tools/clippy/tests/ui/type_repetition_in_bounds.rs index e75678d5fd93e..d9a9df9cc661a 100644 --- a/src/tools/clippy/tests/ui/type_repetition_in_bounds.rs +++ b/src/tools/clippy/tests/ui/type_repetition_in_bounds.rs @@ -2,7 +2,7 @@ #![allow( clippy::extra_unused_type_parameters, clippy::multiple_bound_locations, - clippy::needless_maybe_sized + redundant_sizedness_bounds )] use serde::Deserialize; diff --git a/tests/ui/issues/issue-48728.rs b/tests/ui/issues/issue-48728.rs index 8ad9289c65cf2..1dee1d03df231 100644 --- a/tests/ui/issues/issue-48728.rs +++ b/tests/ui/issues/issue-48728.rs @@ -5,7 +5,7 @@ #[derive(Clone)] struct Node(Box); -impl Clone for Node<[T]> { +impl Clone for Node<[T]> { fn clone(&self) -> Self { Node(Box::clone(&self.0)) } diff --git a/src/tools/clippy/tests/ui/needless_maybe_sized.fixed b/tests/ui/lint/lint-redundant-sizedness-bounds.fixed similarity index 53% rename from src/tools/clippy/tests/ui/needless_maybe_sized.fixed rename to tests/ui/lint/lint-redundant-sizedness-bounds.fixed index f8b1643969903..752545e3ff044 100644 --- a/src/tools/clippy/tests/ui/needless_maybe_sized.fixed +++ b/tests/ui/lint/lint-redundant-sizedness-bounds.fixed @@ -1,40 +1,38 @@ -//@aux-build:proc_macros.rs - -#![allow(unused, clippy::multiple_bound_locations)] -#![warn(clippy::needless_maybe_sized)] - -extern crate proc_macros; -use proc_macros::external; +//@ run-rustfix +#![deny(redundant_sizedness_bounds)] +#![feature(sized_hierarchy)] +#![allow(unused)] +use std::marker::{MetaSized, PointeeSized}; fn directly(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds trait A: Sized {} trait B: A {} fn depth_1(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn depth_2(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds // We only need to show one fn multiple_paths(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn in_where(t: &T) where T: Sized, - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } fn mixed_1(t: &T) - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } fn mixed_2(t: &T) -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds where T: Sized, { @@ -43,50 +41,50 @@ where fn mixed_3(t: &T) where T: Sized, - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } struct Struct(T); -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds impl Struct { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds fn method(&self) {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds } enum Enum { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds Variant(&'static T), } union Union<'a, T: Sized> { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds a: &'a T, } trait Trait { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds fn trait_method() {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds type GAT; - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds type Assoc: Sized + ?Sized; // False negative } trait SecondInTrait: Send + Sized {} fn second_in_trait() {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn impl_trait(_: &(impl Sized)) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds trait GenericTrait: Sized {} fn in_generic_trait, U>() {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds mod larger_graph { // C1 C2 Sized @@ -102,9 +100,18 @@ mod larger_graph { trait A1: B1 + B2 {} fn larger_graph() {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds } +trait S1: Sized {} +fn meta_sized() {} +//~^ ERROR redundant_sizedness_bounds +fn pointee_sized() {} +//~^ ERROR redundant_sizedness_bounds +trait M1: MetaSized {} +fn pointee_metasized() {} +//~^ ERROR redundant_sizedness_bounds + // Should not lint fn sized() {} @@ -119,11 +126,11 @@ trait Q: P {} fn ok_depth_1() {} fn ok_depth_2() {} -external! { - fn in_macro(t: &T) {} +//external! { +// fn in_macro(t: &T) {} - fn with_local_clone(t: &T) {} -} +// fn with_local_clone(t: &T) {} +//} #[derive(Clone)] struct InDerive { diff --git a/src/tools/clippy/tests/ui/needless_maybe_sized.rs b/tests/ui/lint/lint-redundant-sizedness-bounds.rs similarity index 55% rename from src/tools/clippy/tests/ui/needless_maybe_sized.rs rename to tests/ui/lint/lint-redundant-sizedness-bounds.rs index e4312b40563f1..b40244b4a10fa 100644 --- a/src/tools/clippy/tests/ui/needless_maybe_sized.rs +++ b/tests/ui/lint/lint-redundant-sizedness-bounds.rs @@ -1,42 +1,40 @@ -//@aux-build:proc_macros.rs - -#![allow(unused, clippy::multiple_bound_locations)] -#![warn(clippy::needless_maybe_sized)] - -extern crate proc_macros; -use proc_macros::external; +//@ run-rustfix +#![deny(redundant_sizedness_bounds)] +#![feature(sized_hierarchy)] +#![allow(unused)] +use std::marker::{MetaSized, PointeeSized}; fn directly(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds trait A: Sized {} trait B: A {} fn depth_1(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn depth_2(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds // We only need to show one fn multiple_paths(t: &T) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn in_where(t: &T) where T: Sized + ?Sized, - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } fn mixed_1(t: &T) where T: ?Sized, - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } fn mixed_2(t: &T) -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds where T: Sized, { @@ -46,50 +44,50 @@ fn mixed_3(t: &T) where T: Sized, T: ?Sized, - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds { } struct Struct(T); -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds impl Struct { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds fn method(&self) {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds } enum Enum { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds Variant(&'static T), } union Union<'a, T: Sized + ?Sized> { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds a: &'a T, } trait Trait { - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds fn trait_method() {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds type GAT; - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds type Assoc: Sized + ?Sized; // False negative } trait SecondInTrait: Send + Sized {} fn second_in_trait() {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds fn impl_trait(_: &(impl Sized + ?Sized)) {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds trait GenericTrait: Sized {} fn in_generic_trait + ?Sized, U>() {} -//~^ needless_maybe_sized +//~^ ERROR redundant_sizedness_bounds mod larger_graph { // C1 C2 Sized @@ -105,9 +103,18 @@ mod larger_graph { trait A1: B1 + B2 {} fn larger_graph() {} - //~^ needless_maybe_sized + //~^ ERROR redundant_sizedness_bounds } +trait S1: Sized {} +fn meta_sized() {} +//~^ ERROR redundant_sizedness_bounds +fn pointee_sized() {} +//~^ ERROR redundant_sizedness_bounds +trait M1: MetaSized {} +fn pointee_metasized() {} +//~^ ERROR redundant_sizedness_bounds + // Should not lint fn sized() {} @@ -122,11 +129,11 @@ trait Q: P {} fn ok_depth_1() {} fn ok_depth_2() {} -external! { - fn in_macro(t: &T) {} +//external! { +// fn in_macro(t: &T) {} - fn with_local_clone(t: &T) {} -} +// fn with_local_clone(t: &T) {} +//} #[derive(Clone)] struct InDerive { diff --git a/src/tools/clippy/tests/ui/needless_maybe_sized.stderr b/tests/ui/lint/lint-redundant-sizedness-bounds.stderr similarity index 50% rename from src/tools/clippy/tests/ui/needless_maybe_sized.stderr rename to tests/ui/lint/lint-redundant-sizedness-bounds.stderr index 30dcaa48e4292..7f5672d0f75e4 100644 --- a/src/tools/clippy/tests/ui/needless_maybe_sized.stderr +++ b/tests/ui/lint/lint-redundant-sizedness-bounds.stderr @@ -1,30 +1,33 @@ -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:9:24 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:7:24 | LL | fn directly(t: &T) {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:9:16 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:7:16 | LL | fn directly(t: &T) {} | ^^^^^ - = note: `-D clippy::needless-maybe-sized` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::needless_maybe_sized)]` +note: the lint level is defined here + --> $DIR/lint-redundant-sizedness-bounds.rs:2:9 + | +LL | #![deny(redundant_sizedness_bounds)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change the bounds that require `Sized`, or remove the `?Sized` bound | LL - fn directly(t: &T) {} LL + fn directly(t: &T) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:15:19 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:13:19 | LL | fn depth_1(t: &T) {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:15:15 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:13:15 | LL | fn depth_1(t: &T) {} | ^ @@ -35,14 +38,14 @@ LL - fn depth_1(t: &T) {} LL + fn depth_1(t: &T) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:17:19 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:15:19 | LL | fn depth_2(t: &T) {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:17:15 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:15:15 | LL | fn depth_2(t: &T) {} | ^ @@ -54,14 +57,14 @@ LL - fn depth_2(t: &T) {} LL + fn depth_2(t: &T) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:21:30 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:19:30 | LL | fn multiple_paths(t: &T) {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:21:22 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:19:22 | LL | fn multiple_paths(t: &T) {} | ^ @@ -72,14 +75,14 @@ LL - fn multiple_paths(t: &T) {} LL + fn multiple_paths(t: &T) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:26:16 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:24:16 | LL | T: Sized + ?Sized, | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:26:8 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:24:8 | LL | T: Sized + ?Sized, | ^^^^^ @@ -89,14 +92,14 @@ LL - T: Sized + ?Sized, LL + T: Sized, | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:33:8 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:31:8 | LL | T: ?Sized, | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:31:15 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:29:15 | LL | fn mixed_1(t: &T) | ^^^^^ @@ -106,14 +109,14 @@ LL - where LL - T: ?Sized, | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:38:15 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:36:15 | LL | fn mixed_2(t: &T) | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:41:8 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:39:8 | LL | T: Sized, | ^^^^^ @@ -123,14 +126,14 @@ LL - fn mixed_2(t: &T) LL + fn mixed_2(t: &T) | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:48:8 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:46:8 | LL | T: ?Sized, | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:47:8 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:45:8 | LL | T: Sized, | ^^^^^ @@ -141,14 +144,14 @@ LL - T: ?Sized, LL + T: Sized, | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:53:26 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:51:26 | LL | struct Struct(T); | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:53:18 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:51:18 | LL | struct Struct(T); | ^^^^^ @@ -158,14 +161,14 @@ LL - struct Struct(T); LL + struct Struct(T); | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:56:17 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:54:17 | LL | impl Struct { | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:56:9 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:54:9 | LL | impl Struct { | ^^^^^ @@ -175,14 +178,14 @@ LL - impl Struct { LL + impl Struct { | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:58:26 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:56:26 | LL | fn method(&self) {} | ^^^^^^ | -note: `U` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:58:18 +note: `U` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:56:18 | LL | fn method(&self) {} | ^^^^^ @@ -192,14 +195,14 @@ LL - fn method(&self) {} LL + fn method(&self) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:62:22 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:60:22 | LL | enum Enum { | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:62:14 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:60:14 | LL | enum Enum { | ^^^^^ @@ -209,14 +212,14 @@ LL - enum Enum { LL + enum Enum { | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:67:28 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:65:28 | LL | union Union<'a, T: Sized + ?Sized> { | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:67:20 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:65:20 | LL | union Union<'a, T: Sized + ?Sized> { | ^^^^^ @@ -226,14 +229,14 @@ LL - union Union<'a, T: Sized + ?Sized> { LL + union Union<'a, T: Sized> { | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:72:24 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:70:24 | LL | trait Trait { | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:72:16 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:70:16 | LL | trait Trait { | ^^^^^ @@ -243,14 +246,14 @@ LL - trait Trait { LL + trait Trait { | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:74:32 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:72:32 | LL | fn trait_method() {} | ^^^^^^ | -note: `U` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:74:24 +note: `U` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:72:24 | LL | fn trait_method() {} | ^^^^^ @@ -260,14 +263,14 @@ LL - fn trait_method() {} LL + fn trait_method() {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:77:25 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:75:25 | LL | type GAT; | ^^^^^^ | -note: `U` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:77:17 +note: `U` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:75:17 | LL | type GAT; | ^^^^^ @@ -277,14 +280,14 @@ LL - type GAT; LL + type GAT; | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:84:23 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:82:23 | LL | fn second_in_trait() {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:84:32 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:82:32 | LL | fn second_in_trait() {} | ^^^^^^^^^^^^^ @@ -295,14 +298,14 @@ LL - fn second_in_trait() {} LL + fn second_in_trait() {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:87:33 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:85:33 | LL | fn impl_trait(_: &(impl Sized + ?Sized)) {} | ^^^^^^ | -note: `impl Sized + ?Sized` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:87:25 +note: `impl Sized + ?Sized` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:85:25 | LL | fn impl_trait(_: &(impl Sized + ?Sized)) {} | ^^^^^ @@ -312,14 +315,14 @@ LL - fn impl_trait(_: &(impl Sized + ?Sized)) {} LL + fn impl_trait(_: &(impl Sized)) {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:91:42 +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:89:42 | LL | fn in_generic_trait + ?Sized, U>() {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:91:24 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:89:24 | LL | fn in_generic_trait + ?Sized, U>() {} | ^^^^^^^^^^^^^^^ @@ -330,14 +333,68 @@ LL - fn in_generic_trait + ?Sized, U>() {} LL + fn in_generic_trait, U>() {} | -error: `?Sized` bound is ignored because of a `Sized` requirement - --> tests/ui/needless_maybe_sized.rs:107:29 +error: `MetaSized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:110:18 + | +LL | fn meta_sized() {} + | ^^^^^^^^^ + | +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:110:30 + | +LL | fn meta_sized() {} + | ^^ + = note: ...because `S1` has the bound `Sized` +help: change the bounds that require `Sized`, or remove the `MetaSized` bound + | +LL - fn meta_sized() {} +LL + fn meta_sized() {} + | + +error: `PointeeSized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:112:21 + | +LL | fn pointee_sized() {} + | ^^^^^^^^^^^^ + | +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:112:36 + | +LL | fn pointee_sized() {} + | ^^ + = note: ...because `S1` has the bound `Sized` +help: change the bounds that require `Sized`, or remove the `PointeeSized` bound + | +LL - fn pointee_sized() {} +LL + fn pointee_sized() {} + | + +error: `PointeeSized` bound is redundant because of a `MetaSized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:115:25 + | +LL | fn pointee_metasized() {} + | ^^^^^^^^^^^^ + | +note: `T` is implied to be `MetaSized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:115:40 + | +LL | fn pointee_metasized() {} + | ^^ + = note: ...because `M1` has the bound `MetaSized` +help: change the bounds that require `MetaSized`, or remove the `PointeeSized` bound + | +LL - fn pointee_metasized() {} +LL + fn pointee_metasized() {} + | + +error: `?Sized` bound is redundant because of a `Sized` requirement + --> $DIR/lint-redundant-sizedness-bounds.rs:105:29 | LL | fn larger_graph() {} | ^^^^^^ | -note: `T` cannot be unsized because of the bound - --> tests/ui/needless_maybe_sized.rs:107:24 +note: `T` is implied to be `Sized` because of the bound + --> $DIR/lint-redundant-sizedness-bounds.rs:105:24 | LL | fn larger_graph() {} | ^^ @@ -349,5 +406,5 @@ LL - fn larger_graph() {} LL + fn larger_graph() {} | -error: aborting due to 20 previous errors +error: aborting due to 23 previous errors