Skip to content

Commit fa1c968

Browse files
faernzonyitoo
authored andcommitted
Annotate elided Ctr32BE lifetime on Sm4Gcm::init_ctr
`Ctr32BE<'_>` in the return type borrows from `&self`, matching the elided input lifetime. Clippy's `mismatched_lifetime_syntaxes` lint prefers the explicit `'_` on the return type so readers can see the borrow relationship without consulting the type definition.
1 parent b9aa6b9 commit fa1c968

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/v1/aeadcipher/sm4_gcm_cipher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Sm4Gcm {
128128
/// > If len(IV)=96, then J0 = IV || 0{31} || 1.
129129
/// > If len(IV) ≠ 96, then let s = 128 ⎡len(IV)/128⎤-len(IV), and
130130
/// > J0=GHASH(IV||0s+64||[len(IV)]64).
131-
fn init_ctr(&self, nonce: &Nonce) -> (Ctr32BE, Block) {
131+
fn init_ctr(&self, nonce: &Nonce) -> (Ctr32BE<'_>, Block) {
132132
let j0 = if <Self as AeadCore>::NonceSize::to_usize() == 12 {
133133
let mut block = ghash::Block::default();
134134
block[..12].copy_from_slice(nonce);

0 commit comments

Comments
 (0)