1 // normalize-stderr-test "\(\d+ byte\)" -> "(N byte)"
2 // normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
4 #![warn(clippy::large_types_passed_by_value)]
6 pub struct Large([u8; 2048]);
9 pub struct LargeAndCopy([u8; 2048]);
11 pub struct Small([u8; 4]);
13 #[derive(Clone, Copy)]
14 pub struct SmallAndCopy([u8; 4]);
16 fn small(a: Small, b: SmallAndCopy) {}
17 fn not_copy(a: Large) {}
18 fn by_ref(a: &Large, b: &LargeAndCopy) {}
19 fn mutable(mut a: LargeAndCopy) {}
20 fn bad(a: LargeAndCopy) {}
21 pub fn bad_but_pub(a: LargeAndCopy) {}
24 fn self_is_ok(self) {}
25 fn other_is_not_ok(self, other: LargeAndCopy) {}
26 fn unless_other_can_change(self, mut other: LargeAndCopy) {}
27 pub fn or_were_in_public(self, other: LargeAndCopy) {}
30 trait LargeTypeDevourer {
31 fn devoure_array(&self, array: [u8; 6666]);
32 fn devoure_tuple(&self, tup: (LargeAndCopy, LargeAndCopy));
33 fn devoure_array_and_tuple_wow(&self, array: [u8; 6666], tup: (LargeAndCopy, LargeAndCopy));
36 pub trait PubLargeTypeDevourer {
37 fn devoure_array_in_public(&self, array: [u8; 6666]);
41 impl LargeTypeDevourer for S {
42 fn devoure_array(&self, array: [u8; 6666]) {
45 fn devoure_tuple(&self, tup: (LargeAndCopy, LargeAndCopy)) {
48 fn devoure_array_and_tuple_wow(&self, array: [u8; 6666], tup: (LargeAndCopy, LargeAndCopy)) {
54 fn foo_always(x: LargeAndCopy) {
58 fn foo_never(x: LargeAndCopy) {
62 fn foo(x: LargeAndCopy) {