diff --git a/src/boxed.rs b/src/boxed.rs index 062f041..39b99d7 100644 --- a/src/boxed.rs +++ b/src/boxed.rs @@ -182,7 +182,7 @@ impl Box { /// # #[allow(unused_variables)] /// let five = Box::new_in(5, Global); /// ``` - #[allow(clippy::inline_always)] + #[allow(clippy::inline_always, clippy::needless_pass_by_value)] #[inline(always)] pub fn new_in(x: T, a: A) -> Self { unsafe { Self::try_new_in(x, a).unwrap_unchecked() } @@ -201,6 +201,7 @@ impl Box { /// let five = Box::try_new_in(5, Global)?; /// # Ok::<_, alloc_wg::alloc::AllocErr>(()) /// ``` + #[allow(clippy::needless_pass_by_value)] pub fn try_new_in(x: T, a: A) -> Result { let ptr = if let Ok(layout) = NonZeroLayout::new::() { let ptr = a.alloc(layout)?.cast::(); @@ -232,7 +233,7 @@ impl Box { /// /// assert_eq!(*five, 5) /// ``` - #[allow(clippy::inline_always)] + #[allow(clippy::inline_always, clippy::needless_pass_by_value)] #[inline(always)] pub fn new_uninit_in(a: A) -> Box, A> { unsafe { Self::try_new_uninit_in(a).unwrap_unchecked() } @@ -257,6 +258,7 @@ impl Box { /// assert_eq!(*five, 5); /// # Ok::<_, alloc_wg::alloc::AllocErr>(()) /// ``` + #[allow(clippy::needless_pass_by_value)] pub fn try_new_uninit_in(a: A) -> Result, A>, A::Error> { let ptr = if let Ok(layout) = NonZeroLayout::new::() { let ptr: NonNull> = a.alloc(layout)?.cast(); @@ -269,7 +271,7 @@ impl Box { /// Constructs a new `Pin>` with the specified allocator. If `T` does not implement /// `Unpin`, then `x` will be pinned in memory and unable to be moved. - #[allow(clippy::inline_always)] + #[allow(clippy::inline_always, clippy::needless_pass_by_value)] #[inline(always)] pub fn pin_in(x: T, a: A) -> Pin { unsafe { Self::try_pin_in(x, a).unwrap_unchecked() } @@ -277,6 +279,7 @@ impl Box { /// Constructs a new `Pin>` with the specified allocator. If `T` does not implement /// `Unpin`, then `x` will be pinned in memory and unable to be moved. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn try_pin_in(x: T, a: A) -> Result, A::Error> { Self::try_new_in(x, a).map(Pin::from) @@ -335,7 +338,7 @@ impl Box<[T], A> { /// /// assert_eq!(*values, [1, 2, 3]); /// ``` - #[allow(clippy::inline_always)] + #[allow(clippy::inline_always, clippy::needless_pass_by_value)] #[inline(always)] pub fn new_uninit_slice_in(len: usize, a: A) -> Box<[mem::MaybeUninit], A> { unsafe { Self::try_new_uninit_slice_in(len, a).unwrap_unchecked() } @@ -363,6 +366,7 @@ impl Box<[T], A> { /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<_, alloc_wg::collections::CollectionAllocErr>(()) /// ``` + #[allow(clippy::needless_pass_by_value)] pub fn try_new_uninit_slice_in( len: usize, a: A, diff --git a/src/raw_vec.rs b/src/raw_vec.rs index 56b348a..d1067e8 100644 --- a/src/raw_vec.rs +++ b/src/raw_vec.rs @@ -144,6 +144,7 @@ impl RawVec { impl RawVec { /// Like `new` but parameterized over the choice of allocator for the returned `RawVec`. + #[allow(clippy::needless_pass_by_value)] pub fn new_in(a: A) -> Self { let capacity = if mem::size_of::() == 0 { !0 } else { 0 }; Self { @@ -161,6 +162,7 @@ impl RawVec { /// /// * if the requested capacity exceeds `usize::MAX` bytes. /// * on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. + #[allow(clippy::needless_pass_by_value)] pub fn with_capacity_in(capacity: usize, a: A) -> Self where A: AllocRef, @@ -181,6 +183,7 @@ impl RawVec { /// * `CapacityOverflow` if the requested capacity exceeds `usize::MAX` bytes. /// * `CapacityOverflow` on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. /// * `AllocError` on OOM + #[allow(clippy::needless_pass_by_value)] pub fn try_with_capacity_in(capacity: usize, a: A) -> Result> where A: AllocRef, @@ -196,6 +199,7 @@ impl RawVec { /// /// * if the requested capacity exceeds `usize::MAX` bytes. /// * on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. + #[allow(clippy::needless_pass_by_value)] pub fn with_capacity_zeroed_in(capacity: usize, a: A) -> Self where A: AllocRef, @@ -216,6 +220,7 @@ impl RawVec { /// * `CapacityOverflow` if the requested capacity exceeds `usize::MAX` bytes. /// * `CapacityOverflow` on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. /// * `AllocError` on OOM + #[allow(clippy::needless_pass_by_value)] pub fn try_with_capacity_zeroed_in(capacity: usize, a: A) -> Result> where A: AllocRef, @@ -223,6 +228,7 @@ impl RawVec { Self::allocate_in(capacity, true, a) } + #[allow(clippy::needless_pass_by_value)] fn allocate_in(capacity: usize, zeroed: bool, alloc: A) -> Result> where A: AllocRef, diff --git a/src/string.rs b/src/string.rs index 980f798..b15b855 100644 --- a/src/string.rs +++ b/src/string.rs @@ -566,6 +566,7 @@ impl String { impl String { /// Like `new` but parameterized over the choice of allocator for the returned `String`. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn new_in(a: A) -> Self { Self { @@ -577,6 +578,7 @@ impl String { /// /// # Panics /// Panics if the allocation fails. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn with_capacity_in(capacity: usize, a: A) -> Self where @@ -588,6 +590,7 @@ impl String { } /// Like `with_capacity_in` but returns errors instead of panicking. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn try_with_capacity_in(capacity: usize, a: A) -> Result> where @@ -602,6 +605,7 @@ impl String { /// /// # Panics /// Panics if the allocation fails. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn from_str_in(s: &str, a: A) -> Self where @@ -613,6 +617,7 @@ impl String { } /// Like `from_str_in` but returns errors instead of panicking. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn try_from_str_in(s: &str, a: A) -> Result> where @@ -703,6 +708,7 @@ impl String { /// # Panics /// /// Panics if allocation fails. + #[allow(clippy::needless_pass_by_value)] pub fn from_utf8_lossy_in(v: &[u8], a: A) -> Self where A: ReallocRef, @@ -715,6 +721,7 @@ impl String { } /// Like `from_utf8_lossy_in` but returns errors instead of panicking. + #[allow(clippy::needless_pass_by_value)] pub fn try_from_utf8_lossy_in(v: &[u8], a: A) -> Result> where A: ReallocRef, @@ -751,6 +758,7 @@ impl String { } /// Like `from_utf16` but parameterized over the choice of allocator for the returned `String`. + #[allow(clippy::needless_pass_by_value)] pub fn from_utf16_in(v: &[u16], a: A) -> Result where A: ReallocRef, diff --git a/src/vec.rs b/src/vec.rs index de2c0e9..eee3c72 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -472,6 +472,7 @@ impl Vec { impl Vec { /// Like `new` but parameterized over the choice of allocator for the returned `Vec`. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn new_in(a: A) -> Self { Self { @@ -487,6 +488,7 @@ impl Vec { /// /// * if the requested capacity exceeds `usize::MAX` bytes. /// * on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn with_capacity_in(capacity: usize, a: A) -> Self where @@ -506,6 +508,7 @@ impl Vec { /// * `CapacityOverflow` if the requested capacity exceeds `usize::MAX` bytes. /// * `CapacityOverflow` on 32-bit platforms if the requested capacity exceeds `isize::MAX` bytes. /// * `AllocError` on OOM + #[allow(clippy::needless_pass_by_value)] #[inline] pub fn try_with_capacity_in(capacity: usize, a: A) -> Result> where