Skip to content

Commit a855f7b

Browse files
hug-devmematthias
andcommitted
Use formatted strings
Co-authored-by: mematthias <[email protected]>
1 parent 00e13f2 commit a855f7b

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

cryptoki/src/context/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ impl Pkcs11Impl {
9393

9494
impl Drop for Pkcs11Impl {
9595
fn drop(&mut self) {
96-
if let Err(e) = self.finalize() {
97-
error!("Failed to finalize: {}", e);
96+
if let Err(err) = self.finalize() {
97+
error!("Failed to finalize: {err}");
9898
}
9999
}
100100
}

cryptoki/src/error/rv.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ impl From<CK_RV> for Rv {
120120
CKR_VENDOR_DEFINED..=CK_ULONG::MAX => Rv::Error(RvError::VendorDefined(ck_rv)),
121121
other => {
122122
error!(
123-
"Can not find a corresponding error for {}, converting to UnknownErrorCode.",
124-
other
123+
"Can not find a corresponding error for {other}, converting to UnknownErrorCode."
125124
);
126125
Rv::Error(RvError::UnknownErrorCode(other))
127126
}

cryptoki/src/mechanism/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ impl TryFrom<CK_MECHANISM_TYPE> for MechanismType {
10201020
CKM_HASH_SLH_DSA_SHA3_512 => Ok(MechanismType::HASH_SLH_DSA_SHA3_512),
10211021
CKM_HASH_SLH_DSA_SHAKE128 => Ok(MechanismType::HASH_SLH_DSA_SHAKE128),
10221022
other => {
1023-
error!("Mechanism type {} is not supported.", other);
1023+
error!("Mechanism type {other} is not supported.");
10241024
Err(Error::NotSupported)
10251025
}
10261026
}

cryptoki/src/mechanism/rsa.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ impl TryFrom<CK_RSA_PKCS_MGF_TYPE> for PkcsMgfType {
6666
CKG_MGF1_SHA384 => Ok(PkcsMgfType::MGF1_SHA384),
6767
CKG_MGF1_SHA512 => Ok(PkcsMgfType::MGF1_SHA512),
6868
other => {
69-
error!(
70-
"Mask Generation Function type {} is not one of the valid values.",
71-
other
72-
);
69+
error!("Mask Generation Function type {other} is not one of the valid values.");
7370
Err(Error::InvalidValue)
7471
}
7572
}

cryptoki/src/object.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ impl TryFrom<CK_ATTRIBUTE_TYPE> for AttributeType {
501501
CKA_WRAP_WITH_TRUSTED => Ok(AttributeType::WrapWithTrusted),
502502
CKA_VENDOR_DEFINED..=CK_ULONG::MAX => Ok(AttributeType::VendorDefined(attribute_type)),
503503
attr_type => {
504-
error!("Attribute type {} not supported.", attr_type);
504+
error!("Attribute type {attr_type} not supported.");
505505
Err(Error::NotSupported)
506506
}
507507
}
@@ -1347,7 +1347,7 @@ impl TryFrom<CK_ML_KEM_PARAMETER_SET_TYPE> for MlKemParameterSetType {
13471347
CKP_ML_KEM_768 => Ok(MlKemParameterSetType::ML_KEM_768),
13481348
CKP_ML_KEM_1024 => Ok(MlKemParameterSetType::ML_KEM_1024),
13491349
_ => {
1350-
error!("ML-KEM parameter set {} is not supported.", val);
1350+
error!("ML-KEM parameter set {val} is not supported.");
13511351
Err(Error::NotSupported)
13521352
}
13531353
}
@@ -1414,7 +1414,7 @@ impl TryFrom<CK_ML_DSA_PARAMETER_SET_TYPE> for MlDsaParameterSetType {
14141414
CKP_ML_DSA_65 => Ok(MlDsaParameterSetType::ML_DSA_65),
14151415
CKP_ML_DSA_87 => Ok(MlDsaParameterSetType::ML_DSA_87),
14161416
_ => {
1417-
error!("ML-DSA parameter set {} is not supported.", val);
1417+
error!("ML-DSA parameter set {val} is not supported.");
14181418
Err(Error::NotSupported)
14191419
}
14201420
}
@@ -1657,7 +1657,7 @@ impl TryFrom<CK_OBJECT_CLASS> for ObjectClass {
16571657
CKO_VALIDATION => Ok(ObjectClass::VALIDATION),
16581658

16591659
_ => {
1660-
error!("Object class {} is not supported.", object_class);
1660+
error!("Object class {object_class} is not supported.");
16611661
Err(Error::NotSupported)
16621662
}
16631663
}
@@ -1957,7 +1957,7 @@ impl TryFrom<CK_KEY_TYPE> for KeyType {
19571957
CKK_SLH_DSA => Ok(KeyType::SLH_DSA),
19581958
CKK_VENDOR_DEFINED..=CK_ULONG::MAX => KeyType::new_vendor_defined(key_type),
19591959
_ => {
1960-
error!("Key type {} is not supported.", key_type);
1960+
error!("Key type {key_type} is not supported.");
19611961
Err(Error::NotSupported)
19621962
}
19631963
}
@@ -2033,7 +2033,7 @@ impl TryFrom<CK_CERTIFICATE_TYPE> for CertificateType {
20332033
CKC_X_509_ATTR_CERT => Ok(CertificateType::X_509_ATTR),
20342034
CKC_WTLS => Ok(CertificateType::WTLS),
20352035
_ => {
2036-
error!("Certificate type {} is not supported.", certificate_type);
2036+
error!("Certificate type {certificate_type} is not supported.");
20372037
Err(Error::NotSupported)
20382038
}
20392039
}

cryptoki/src/session/object_management.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ impl Drop for ObjectHandleIterator<'_> {
197197
if let Some(f) = get_pkcs11_func!(self.session.client(), C_FindObjectsFinal) {
198198
// swallow the return value, as we can't do anything about it,
199199
// but log the error
200-
if let Rv::Error(error) = Rv::from(unsafe { f(self.session.handle()) }) {
201-
log::error!("C_FindObjectsFinal() failed with error: {:?}", error);
200+
if let Rv::Error(err) = Rv::from(unsafe { f(self.session.handle()) }) {
201+
log::error!("C_FindObjectsFinal() failed with error: {err:?}");
202202
}
203203
} else {
204204
// bark but pass if C_FindObjectsFinal() is not implemented

cryptoki/src/session/session_management.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl Drop for Session {
2626
}
2727
}
2828

29-
if let Err(e) = close(self) {
30-
error!("Failed to close session: {}", e);
29+
if let Err(err) = close(self) {
30+
error!("Failed to close session: {err}");
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)