diff --git a/cryptoki/src/context/general_purpose.rs b/cryptoki/src/context/general_purpose.rs index be7ead9d..6177c3dd 100644 --- a/cryptoki/src/context/general_purpose.rs +++ b/cryptoki/src/context/general_purpose.rs @@ -145,7 +145,7 @@ pub enum Function { impl Display for Function { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "Function::{:?}", self) + write!(f, "Function::{self:?}") } } diff --git a/cryptoki/tests/basic.rs b/cryptoki/tests/basic.rs index 2cd3d4ab..dede2e93 100644 --- a/cryptoki/tests/basic.rs +++ b/cryptoki/tests/basic.rs @@ -774,7 +774,7 @@ fn session_find_objects() -> testresult::TestResult { let key_template = vec![ Attribute::Token(true), Attribute::Encrypt(true), - Attribute::Label(format!("key_{}", i).as_bytes().to_vec()), + Attribute::Label(format!("key_{i}").as_bytes().to_vec()), Attribute::ValueLen(32.into()), Attribute::Id("12345678".as_bytes().to_vec()), // reusing the same CKA_ID ]; @@ -826,7 +826,7 @@ fn session_objecthandle_iterator() -> testresult::TestResult { Attribute::Token(true), Attribute::Encrypt(true), Attribute::ValueLen(32.into()), - Attribute::Label(format!("key_{}", i).as_bytes().to_vec()), + Attribute::Label(format!("key_{i}").as_bytes().to_vec()), Attribute::Id("12345678".as_bytes().to_vec()), // reusing the same CKA_ID ]; @@ -1000,27 +1000,27 @@ fn login_feast() { let session = pkcs11.open_rw_session(slot).unwrap(); match session.login(UserType::User, Some(&AuthPin::new(USER_PIN.into()))) { Ok(_) | Err(Error::Pkcs11(RvError::UserAlreadyLoggedIn, Function::Login)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } match session.login(UserType::User, Some(&AuthPin::new(USER_PIN.into()))) { Ok(_) | Err(Error::Pkcs11(RvError::UserAlreadyLoggedIn, Function::Login)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } match session.login(UserType::User, Some(&AuthPin::new(USER_PIN.into()))) { Ok(_) | Err(Error::Pkcs11(RvError::UserAlreadyLoggedIn, Function::Login)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } match session.logout() { Ok(_) | Err(Error::Pkcs11(RvError::UserNotLoggedIn, Function::Logout)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } match session.logout() { Ok(_) | Err(Error::Pkcs11(RvError::UserNotLoggedIn, Function::Logout)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } match session.logout() { Ok(_) | Err(Error::Pkcs11(RvError::UserNotLoggedIn, Function::Logout)) => {} - Err(e) => panic!("Bad error response: {}", e), + Err(e) => panic!("Bad error response: {e}"), } })); } @@ -1317,7 +1317,7 @@ fn is_initialized_test() { match pkcs11.initialize(CInitializeArgs::OsThreads) { Err(Error::AlreadyInitialized) => (), - Err(e) => panic!("Got unexpected error when initializing: {}", e), + Err(e) => panic!("Got unexpected error when initializing: {e}"), Ok(()) => panic!("Initializing twice should not have been allowed"), } } @@ -1429,7 +1429,7 @@ fn ro_rw_session_test() -> TestResult { if let Error::Pkcs11(RvError::SessionReadOnly, _f) = e { // as expected } else { - panic!("Got wrong error code (expecting SessionReadOnly): {}", e); + panic!("Got wrong error code (expecting SessionReadOnly): {e}"); } ro_session.logout()?; } @@ -2075,8 +2075,7 @@ fn wait_for_slot_event() { Function::WaitForSlotEvent )) ), - "res = {:?}", - res + "res = {res:?}" ); }