diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 882d1d4c4..17e37767d 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -24,7 +24,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.81.0 + toolchain: 1.82.0 components: clippy - run: cargo clippy --all --all-features --tests -- -D warnings diff --git a/aead/src/lib.rs b/aead/src/lib.rs index 63be73a7d..2a3560c21 100644 --- a/aead/src/lib.rs +++ b/aead/src/lib.rs @@ -487,7 +487,7 @@ pub struct Payload<'msg, 'aad> { } #[cfg(feature = "alloc")] -impl<'msg, 'aad> From<&'msg [u8]> for Payload<'msg, 'aad> { +impl<'msg> From<&'msg [u8]> for Payload<'msg, '_> { fn from(msg: &'msg [u8]) -> Self { Self { msg, aad: b"" } } diff --git a/cipher/src/block/ctx.rs b/cipher/src/block/ctx.rs index 7b0f04632..7a7634120 100644 --- a/cipher/src/block/ctx.rs +++ b/cipher/src/block/ctx.rs @@ -11,32 +11,32 @@ pub(super) struct BlockCtx<'inp, 'out, BS: BlockSizes> { pub block: InOut<'inp, 'out, Block>, } -impl<'inp, 'out, BS: BlockSizes> BlockSizeUser for BlockCtx<'inp, 'out, BS> { +impl BlockSizeUser for BlockCtx<'_, '_, BS> { type BlockSize = BS; } -impl<'inp, 'out, BS: BlockSizes> BlockCipherEncClosure for BlockCtx<'inp, 'out, BS> { +impl BlockCipherEncClosure for BlockCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &B) { backend.encrypt_block(self.block); } } -impl<'inp, 'out, BS: BlockSizes> BlockCipherDecClosure for BlockCtx<'inp, 'out, BS> { +impl BlockCipherDecClosure for BlockCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &B) { backend.decrypt_block(self.block); } } -impl<'inp, 'out, BS: BlockSizes> BlockModeEncClosure for BlockCtx<'inp, 'out, BS> { +impl BlockModeEncClosure for BlockCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { backend.encrypt_block(self.block); } } -impl<'inp, 'out, BS: BlockSizes> BlockModeDecClosure for BlockCtx<'inp, 'out, BS> { +impl BlockModeDecClosure for BlockCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { backend.decrypt_block(self.block); @@ -47,11 +47,11 @@ pub(super) struct BlocksCtx<'inp, 'out, BS: BlockSizes> { pub blocks: InOutBuf<'inp, 'out, Block>, } -impl<'inp, 'out, BS: BlockSizes> BlockSizeUser for BlocksCtx<'inp, 'out, BS> { +impl BlockSizeUser for BlocksCtx<'_, '_, BS> { type BlockSize = BS; } -impl<'inp, 'out, BS: BlockSizes> BlockCipherEncClosure for BlocksCtx<'inp, 'out, BS> { +impl BlockCipherEncClosure for BlocksCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &B) { if B::ParBlocksSize::USIZE > 1 { @@ -68,7 +68,7 @@ impl<'inp, 'out, BS: BlockSizes> BlockCipherEncClosure for BlocksCtx<'inp, 'out, } } -impl<'inp, 'out, BS: BlockSizes> BlockCipherDecClosure for BlocksCtx<'inp, 'out, BS> { +impl BlockCipherDecClosure for BlocksCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &B) { if B::ParBlocksSize::USIZE > 1 { @@ -85,7 +85,7 @@ impl<'inp, 'out, BS: BlockSizes> BlockCipherDecClosure for BlocksCtx<'inp, 'out, } } -impl<'inp, 'out, BS: BlockSizes> BlockModeEncClosure for BlocksCtx<'inp, 'out, BS> { +impl BlockModeEncClosure for BlocksCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { if B::ParBlocksSize::USIZE > 1 { @@ -102,7 +102,7 @@ impl<'inp, 'out, BS: BlockSizes> BlockModeEncClosure for BlocksCtx<'inp, 'out, B } } -impl<'inp, 'out, BS: BlockSizes> BlockModeDecClosure for BlocksCtx<'inp, 'out, BS> { +impl BlockModeDecClosure for BlocksCtx<'_, '_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { if B::ParBlocksSize::USIZE > 1 { diff --git a/cipher/src/stream/core_api.rs b/cipher/src/stream/core_api.rs index aab1c32b5..200c1fee0 100644 --- a/cipher/src/stream/core_api.rs +++ b/cipher/src/stream/core_api.rs @@ -190,10 +190,10 @@ impl_counter! { u32 u64 u128 } struct WriteBlockCtx<'a, BS: BlockSizes> { block: &'a mut Block, } -impl<'a, BS: BlockSizes> BlockSizeUser for WriteBlockCtx<'a, BS> { +impl BlockSizeUser for WriteBlockCtx<'_, BS> { type BlockSize = BS; } -impl<'a, BS: BlockSizes> StreamCipherClosure for WriteBlockCtx<'a, BS> { +impl StreamCipherClosure for WriteBlockCtx<'_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { backend.gen_ks_block(self.block); @@ -203,10 +203,10 @@ impl<'a, BS: BlockSizes> StreamCipherClosure for WriteBlockCtx<'a, BS> { struct WriteBlocksCtx<'a, BS: BlockSizes> { blocks: &'a mut [Block], } -impl<'a, BS: BlockSizes> BlockSizeUser for WriteBlocksCtx<'a, BS> { +impl BlockSizeUser for WriteBlocksCtx<'_, BS> { type BlockSize = BS; } -impl<'a, BS: BlockSizes> StreamCipherClosure for WriteBlocksCtx<'a, BS> { +impl StreamCipherClosure for WriteBlocksCtx<'_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { if B::ParBlocksSize::USIZE > 1 { @@ -227,11 +227,11 @@ struct ApplyBlockCtx<'inp, 'out, BS: BlockSizes> { block: InOut<'inp, 'out, Block>, } -impl<'inp, 'out, BS: BlockSizes> BlockSizeUser for ApplyBlockCtx<'inp, 'out, BS> { +impl BlockSizeUser for ApplyBlockCtx<'_, '_, BS> { type BlockSize = BS; } -impl<'inp, 'out, BS: BlockSizes> StreamCipherClosure for ApplyBlockCtx<'inp, 'out, BS> { +impl StreamCipherClosure for ApplyBlockCtx<'_, '_, BS> { #[inline(always)] fn call>(mut self, backend: &mut B) { let mut t = Default::default(); @@ -244,11 +244,11 @@ struct ApplyBlocksCtx<'inp, 'out, BS: BlockSizes> { blocks: InOutBuf<'inp, 'out, Block>, } -impl<'inp, 'out, BS: BlockSizes> BlockSizeUser for ApplyBlocksCtx<'inp, 'out, BS> { +impl BlockSizeUser for ApplyBlocksCtx<'_, '_, BS> { type BlockSize = BS; } -impl<'inp, 'out, BS: BlockSizes> StreamCipherClosure for ApplyBlocksCtx<'inp, 'out, BS> { +impl StreamCipherClosure for ApplyBlocksCtx<'_, '_, BS> { #[inline(always)] #[allow(clippy::needless_range_loop)] fn call>(self, backend: &mut B) { diff --git a/cipher/src/stream/wrapper.rs b/cipher/src/stream/wrapper.rs index abf4a9b04..16863a42c 100644 --- a/cipher/src/stream/wrapper.rs +++ b/cipher/src/stream/wrapper.rs @@ -106,8 +106,7 @@ impl StreamCipherCoreWrapper { }; let bs = T::BlockSize::USIZE; - // TODO: use div_ceil on 1.73+ MSRV bump - let blocks = (data_len + bs - 1) / bs; + let blocks = data_len.div_ceil(bs); if blocks > rem_blocks { Err(StreamCipherError) } else { diff --git a/password-hash/src/ident.rs b/password-hash/src/ident.rs index ce82b6a99..784270e6d 100644 --- a/password-hash/src/ident.rs +++ b/password-hash/src/ident.rs @@ -91,13 +91,13 @@ impl<'a> Ident<'a> { } } -impl<'a> AsRef for Ident<'a> { +impl AsRef for Ident<'_> { fn as_ref(&self) -> &str { self.as_str() } } -impl<'a> Deref for Ident<'a> { +impl Deref for Ident<'_> { type Target = str; fn deref(&self) -> &str { @@ -115,13 +115,13 @@ impl<'a> TryFrom<&'a str> for Ident<'a> { } } -impl<'a> fmt::Display for Ident<'a> { +impl fmt::Display for Ident<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self) } } -impl<'a> fmt::Debug for Ident<'a> { +impl fmt::Debug for Ident<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("Ident").field(&self.as_ref()).finish() } diff --git a/password-hash/src/lib.rs b/password-hash/src/lib.rs index 8b8f62ba1..8993cfa43 100644 --- a/password-hash/src/lib.rs +++ b/password-hash/src/lib.rs @@ -250,7 +250,7 @@ impl<'a> TryFrom<&'a str> for PasswordHash<'a> { } } -impl<'a> fmt::Display for PasswordHash<'a> { +impl fmt::Display for PasswordHash<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}{}", PASSWORD_HASH_SEPARATOR, self.algorithm)?; diff --git a/password-hash/src/salt.rs b/password-hash/src/salt.rs index a73288c3b..8ab8baf99 100644 --- a/password-hash/src/salt.rs +++ b/password-hash/src/salt.rs @@ -163,7 +163,7 @@ impl<'a> Salt<'a> { } } -impl<'a> AsRef for Salt<'a> { +impl AsRef for Salt<'_> { fn as_ref(&self) -> &str { self.as_str() } @@ -177,13 +177,13 @@ impl<'a> TryFrom<&'a str> for Salt<'a> { } } -impl<'a> fmt::Display for Salt<'a> { +impl fmt::Display for Salt<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } -impl<'a> fmt::Debug for Salt<'a> { +impl fmt::Debug for Salt<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Salt({:?})", self.as_str()) } diff --git a/password-hash/src/value.rs b/password-hash/src/value.rs index 5cac55919..aacc85d53 100644 --- a/password-hash/src/value.rs +++ b/password-hash/src/value.rs @@ -154,7 +154,7 @@ impl<'a> Value<'a> { } } -impl<'a> AsRef for Value<'a> { +impl AsRef for Value<'_> { fn as_ref(&self) -> &str { self.as_str() } @@ -184,7 +184,7 @@ impl<'a> TryFrom<&Value<'a>> for Decimal { } } -impl<'a> fmt::Display for Value<'a> { +impl fmt::Display for Value<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } diff --git a/universal-hash/src/lib.rs b/universal-hash/src/lib.rs index 44b59686c..d6d43aff3 100644 --- a/universal-hash/src/lib.rs +++ b/universal-hash/src/lib.rs @@ -64,11 +64,11 @@ pub trait UniversalHash: BlockSizeUser + Sized { blocks: &'a [Block], } - impl<'a, BS: BlockSizes> BlockSizeUser for Ctx<'a, BS> { + impl BlockSizeUser for Ctx<'_, BS> { type BlockSize = BS; } - impl<'a, BS: BlockSizes> UhfClosure for Ctx<'a, BS> { + impl UhfClosure for Ctx<'_, BS> { #[inline(always)] fn call>(self, backend: &mut B) { let pb = B::ParBlocksSize::USIZE;