#![warn(clippy::mismatching_type_param_order)] #![allow(clippy::blacklisted_name)] fn main() { struct Foo { x: A, y: B, } // lint on both params impl Foo {} // lint on the 2nd param impl Foo {} // should not lint impl Foo {} struct FooLifetime<'l, 'm, A, B> { x: &'l A, y: &'m B, } // should not lint on lifetimes impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {} struct Bar { x: i32, } // should not lint impl Bar {} // also works for enums enum FooEnum { X(A), Y(B), Z(C), } impl FooEnum {} // also works for unions union FooUnion where B: Copy, { x: A, y: B, } impl FooUnion where A: Copy {} impl FooUnion where A: Copy, B: Copy, { } // if the types are complicated, do not lint impl Foo<(K, V), B> {} impl Foo<(K, V), A> {} }