Skip to content

Commit 4e14bb4

Browse files
committed
Use now-available Copy impls
1 parent 2c59f4c commit 4e14bb4

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

aead/src/aes_ctr_hmac_aead_key_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,5 @@ fn validate_key_format(
226226
)
227227
.into());
228228
}
229-
Ok((aes_ctr_format.clone(), hmac_key_format.clone()))
229+
Ok((*aes_ctr_format, *hmac_key_format))
230230
}

prf/src/hmac_prf_key_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn validate_key(
9292
};
9393
let hash = HashType::try_from(params.hash).unwrap_or(HashType::UnknownHash);
9494
subtle::validate_hmac_prf_params(hash, key_size)?;
95-
Ok((params.clone(), hash))
95+
Ok((*params, hash))
9696
}
9797

9898
/// Validates the given [`HmacPrfKeyFormat`](tink_proto::HmacPrfKeyFormat).

signature/src/ecdsa_signer_key_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,5 @@ fn validate_key_format(
172172
.ok_or_else(|| TinkError::new("no public key parameters"))?;
173173
let (hash, curve, encoding) = crate::get_ecdsa_param_ids(params);
174174
crate::subtle::validate_ecdsa_params(hash, curve, encoding)?;
175-
Ok((params.clone(), curve))
175+
Ok((*params, curve))
176176
}

signature/src/ecdsa_verifier_key_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ pub(crate) fn validate_ecdsa_public_key(
7171
.ok_or_else(|| TinkError::new("no public key parameters"))?;
7272
let (hash, curve, encoding) = crate::get_ecdsa_param_ids(params);
7373
crate::subtle::validate_ecdsa_params(hash, curve, encoding)?;
74-
Ok(params.clone())
74+
Ok(*params)
7575
}

streaming/src/aes_ctr_hmac_key_manager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn validate_key(
100100
.params
101101
.as_ref()
102102
.ok_or_else(|| TinkError::new("AesCtrHmacKeyManager: no params"))?;
103-
Ok(key_params.clone())
103+
Ok(*key_params)
104104
}
105105

106106
/// Validate the given [`tink_proto::AesCtrHmacStreamingKeyFormat`].
@@ -114,7 +114,7 @@ fn validate_key_format(
114114
.as_ref()
115115
.ok_or_else(|| TinkError::new("AesCtrHmacKeyManager: no params"))?;
116116
validate_params(key_params)?;
117-
Ok(key_params.clone())
117+
Ok(*key_params)
118118
}
119119

120120
/// Validate the given [`tink_proto::AesCtrHmacStreamingParams`].
@@ -151,5 +151,5 @@ fn validate_params(
151151
if (params.ciphertext_segment_size as usize) < min_segment_size {
152152
return Err("AesCtrHmacKeyManager: ciphertext segment size must be at least (derived_key_size + nonce_prefix_in_bytes + tag_size_in_bytes + 2)".into());
153153
}
154-
Ok((hmac_params.clone(), hkdf_hash, hmac_hash))
154+
Ok((*hmac_params, hkdf_hash, hmac_hash))
155155
}

streaming/src/aes_gcm_hkdf_key_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn validate_key(
9898
.as_ref()
9999
.ok_or_else(|| TinkError::new("no key params"))?;
100100
let hkdf_hash = validate_params(key_params)?;
101-
Ok((key_params.clone(), hkdf_hash))
101+
Ok((*key_params, hkdf_hash))
102102
}
103103

104104
/// Validate the given [`tink_proto::AesGcmHkdfStreamingKeyFormat`].
@@ -111,7 +111,7 @@ fn validate_key_format(
111111
.as_ref()
112112
.ok_or_else(|| TinkError::new("no format params"))?;
113113
validate_params(format_params).map_err(|e| wrap_err("AesGcmHkdfKeyManager", e))?;
114-
Ok(format_params.clone())
114+
Ok(*format_params)
115115
}
116116

117117
/// Validate the given [`tink_proto::AesGcmHkdfStreamingParams`].

tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub fn new_ecdsa_params(
314314
/// Create an [`EcdsaKeyFormat`](tink_proto::EcdsaKeyFormat) with the specified parameters.
315315
pub fn new_ecdsa_key_format(params: &tink_proto::EcdsaParams) -> tink_proto::EcdsaKeyFormat {
316316
tink_proto::EcdsaKeyFormat {
317-
params: Some(params.clone()),
317+
params: Some(*params),
318318
}
319319
}
320320

0 commit comments

Comments
 (0)