Skip to content

Commit 9160974

Browse files
authored
inout: fix needless_lifetimes lint (#1167)
1 parent f2dc127 commit 9160974

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

inout/src/inout.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct InOut<'inp, 'out, T> {
1313
impl<'inp, 'out, T> InOut<'inp, 'out, T> {
1414
/// Reborrow `self`.
1515
#[inline(always)]
16-
pub fn reborrow<'a>(&'a mut self) -> InOut<'a, 'a, T> {
16+
pub fn reborrow(&mut self) -> InOut<'_, '_, T> {
1717
Self {
1818
in_ptr: self.in_ptr,
1919
out_ptr: self.out_ptr,
@@ -23,13 +23,13 @@ impl<'inp, 'out, T> InOut<'inp, 'out, T> {
2323

2424
/// Get immutable reference to the input value.
2525
#[inline(always)]
26-
pub fn get_in<'a>(&'a self) -> &'a T {
26+
pub fn get_in(&self) -> &T {
2727
unsafe { &*self.in_ptr }
2828
}
2929

3030
/// Get mutable reference to the output value.
3131
#[inline(always)]
32-
pub fn get_out<'a>(&'a mut self) -> &'a mut T {
32+
pub fn get_out(&mut self) -> &mut T {
3333
unsafe { &mut *self.out_ptr }
3434
}
3535

@@ -73,7 +73,7 @@ impl<'inp, 'out, T> InOut<'inp, 'out, T> {
7373
}
7474
}
7575

76-
impl<'inp, 'out, T: Clone> InOut<'inp, 'out, T> {
76+
impl<T: Clone> InOut<'_, '_, T> {
7777
/// Clone input value and return it.
7878
#[inline(always)]
7979
pub fn clone_in(&self) -> T {
@@ -110,7 +110,7 @@ impl<'inp, 'out, T, N: ArraySize> InOut<'inp, 'out, Array<T, N>> {
110110
/// # Panics
111111
/// If `pos` greater or equal to array length.
112112
#[inline(always)]
113-
pub fn get<'a>(&'a mut self, pos: usize) -> InOut<'a, 'a, T> {
113+
pub fn get(&mut self, pos: usize) -> InOut<'_, '_, T> {
114114
assert!(pos < N::USIZE);
115115
unsafe {
116116
InOut {
@@ -133,7 +133,7 @@ impl<'inp, 'out, T, N: ArraySize> InOut<'inp, 'out, Array<T, N>> {
133133
}
134134
}
135135

136-
impl<'inp, 'out, N: ArraySize> InOut<'inp, 'out, Array<u8, N>> {
136+
impl<N: ArraySize> InOut<'_, '_, Array<u8, N>> {
137137
/// XOR `data` with values behind the input slice and write
138138
/// result to the output slice.
139139
///
@@ -153,7 +153,7 @@ impl<'inp, 'out, N: ArraySize> InOut<'inp, 'out, Array<u8, N>> {
153153
}
154154
}
155155

156-
impl<'inp, 'out, N, M> InOut<'inp, 'out, Array<Array<u8, N>, M>>
156+
impl<N, M> InOut<'_, '_, Array<Array<u8, N>, M>>
157157
where
158158
N: ArraySize,
159159
M: ArraySize,

inout/src/inout_buf.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'inp, 'out, T> InOutBuf<'inp, 'out, T> {
9898
/// # Panics
9999
/// If `pos` greater or equal to buffer length.
100100
#[inline(always)]
101-
pub fn get<'a>(&'a mut self, pos: usize) -> InOut<'a, 'a, T> {
101+
pub fn get(&mut self, pos: usize) -> InOut<'_, '_, T> {
102102
assert!(pos < self.len);
103103
unsafe {
104104
InOut {
@@ -111,13 +111,13 @@ impl<'inp, 'out, T> InOutBuf<'inp, 'out, T> {
111111

112112
/// Get input slice.
113113
#[inline(always)]
114-
pub fn get_in<'a>(&'a self) -> &'a [T] {
114+
pub fn get_in(&self) -> &[T] {
115115
unsafe { slice::from_raw_parts(self.in_ptr, self.len) }
116116
}
117117

118118
/// Get output slice.
119119
#[inline(always)]
120-
pub fn get_out<'a>(&'a mut self) -> &'a mut [T] {
120+
pub fn get_out(&mut self) -> &mut [T] {
121121
unsafe { slice::from_raw_parts_mut(self.out_ptr, self.len) }
122122
}
123123

@@ -135,7 +135,7 @@ impl<'inp, 'out, T> InOutBuf<'inp, 'out, T> {
135135

136136
/// Reborrow `self`.
137137
#[inline(always)]
138-
pub fn reborrow<'a>(&'a mut self) -> InOutBuf<'a, 'a, T> {
138+
pub fn reborrow(&mut self) -> InOutBuf<'_, '_, T> {
139139
Self {
140140
in_ptr: self.in_ptr,
141141
out_ptr: self.out_ptr,
@@ -233,7 +233,7 @@ impl<'inp, 'out, T> InOutBuf<'inp, 'out, T> {
233233
}
234234
}
235235

236-
impl<'inp, 'out> InOutBuf<'inp, 'out, u8> {
236+
impl InOutBuf<'_, '_, u8> {
237237
/// XORs `data` with values behind the input slice and write
238238
/// result to the output slice.
239239
///

inout/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
88
)]
99
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
10-
#![allow(clippy::needless_lifetimes)]
1110
#![warn(missing_docs)]
1211

1312
#[cfg(feature = "block-padding")]

inout/src/reserved.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<T> InOutBufReserved<'_, '_, T> {
9696

9797
/// Split buffer into `InOutBuf` with input length and mutable slice pointing to
9898
/// the reamining reserved suffix.
99-
pub fn split_reserved<'a>(&'a mut self) -> (InOutBuf<'a, 'a, T>, &'a mut [T]) {
99+
pub fn split_reserved(&mut self) -> (InOutBuf<'_, '_, T>, &mut [T]) {
100100
let in_len = self.get_in_len();
101101
let out_len = self.get_out_len();
102102
let in_ptr = self.get_in().as_ptr();
@@ -132,13 +132,13 @@ impl<'inp, 'out, T> InOutBufReserved<'inp, 'out, T> {
132132

133133
/// Get input slice.
134134
#[inline(always)]
135-
pub fn get_in<'a>(&'a self) -> &'a [T] {
135+
pub fn get_in(&self) -> &[T] {
136136
unsafe { slice::from_raw_parts(self.in_ptr, self.in_len) }
137137
}
138138

139139
/// Get output slice.
140140
#[inline(always)]
141-
pub fn get_out<'a>(&'a mut self) -> &'a mut [T] {
141+
pub fn get_out(&mut self) -> &mut [T] {
142142
unsafe { slice::from_raw_parts_mut(self.out_ptr, self.out_len) }
143143
}
144144

@@ -212,10 +212,10 @@ pub struct PaddedInOutBuf<'inp, 'out, BS: ArraySize> {
212212
}
213213

214214
#[cfg(feature = "block-padding")]
215-
impl<'inp, 'out, BS: ArraySize> PaddedInOutBuf<'inp, 'out, BS> {
215+
impl<'out, BS: ArraySize> PaddedInOutBuf<'_, 'out, BS> {
216216
/// Get full blocks.
217217
#[inline(always)]
218-
pub fn get_blocks<'a>(&'a mut self) -> InOutBuf<'a, 'a, Array<u8, BS>> {
218+
pub fn get_blocks(&mut self) -> InOutBuf<'_, '_, Array<u8, BS>> {
219219
self.blocks.reborrow()
220220
}
221221

@@ -224,7 +224,7 @@ impl<'inp, 'out, BS: ArraySize> PaddedInOutBuf<'inp, 'out, BS> {
224224
/// For paddings with `P::TYPE = PadType::Reversible` it always returns `Some`.
225225
#[inline(always)]
226226
#[allow(clippy::needless_option_as_deref)]
227-
pub fn get_tail_block<'a>(&'a mut self) -> Option<InOut<'a, 'a, Array<u8, BS>>> {
227+
pub fn get_tail_block(&mut self) -> Option<InOut<'_, '_, Array<u8, BS>>> {
228228
match self.tail_out.as_deref_mut() {
229229
Some(out_block) => Some((&self.tail_in, out_block).into()),
230230
None => None,

0 commit comments

Comments
 (0)