//@aux-build:proc_macros.rs #![allow(unused, clippy::multiple_bound_locations)] #![warn(clippy::needless_maybe_sized)] extern crate proc_macros; use proc_macros::external; fn directly(t: &T) {} trait A: Sized {} trait B: A {} fn depth_1(t: &T) {} fn depth_2(t: &T) {} // We only need to show one fn multiple_paths(t: &T) {} fn in_where(t: &T) where T: Sized, { } fn mixed_1(t: &T) { } fn mixed_2(t: &T) where T: Sized, { } fn mixed_3(t: &T) where T: Sized, { } struct Struct(T); impl Struct { fn method(&self) {} } enum Enum { Variant(&'static T), } union Union<'a, T: Sized> { a: &'a T, } trait Trait { fn trait_method() {} type GAT; type Assoc: Sized + ?Sized; // False negative } trait SecondInTrait: Send + Sized {} fn second_in_trait() {} fn impl_trait(_: &(impl Sized)) {} trait GenericTrait: Sized {} fn in_generic_trait, U>() {} mod larger_graph { // C1 C2 Sized // \ /\ / // B1 B2 // \ / // A1 trait C1 {} trait C2 {} trait B1: C1 + C2 {} trait B2: C2 + Sized {} trait A1: B1 + B2 {} fn larger_graph() {} } // Should not lint fn sized() {} fn maybe_sized() {} struct SeparateBounds(T); impl SeparateBounds {} trait P {} trait Q: P {} fn ok_depth_1() {} fn ok_depth_2() {} external! { fn in_macro(t: &T) {} fn with_local_clone(t: &T) {} } #[derive(Clone)] struct InDerive { t: T, } struct Refined(T); impl Refined {} fn main() {}