diff --git a/rustfmt.toml b/rustfmt.toml index 22f32e2..6a34f55 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,2 @@ tab_spaces = 4 hard_tabs = true -normalize_comments = true diff --git a/src/accountmanager.rs b/src/accountmanager.rs index 969fbd3..440edec 100644 --- a/src/accountmanager.rs +++ b/src/accountmanager.rs @@ -476,7 +476,7 @@ mod tests { let tmp_dir = TempDir::new("steamguard-cli-test").unwrap(); let manifest_path = tmp_dir.path().join("manifest.json"); let manager = AccountManager::new(manifest_path.as_path()); - assert!(matches!(manager.save(), Ok(_))); + assert!(manager.save().is_ok()); } #[test] @@ -529,7 +529,7 @@ mod tests { manager.add_account(account); manager.manifest.entries[0].encryption = Some(EncryptionScheme::generate()); manager.submit_passkey(passkey.clone()); - assert!(matches!(manager.save(), Ok(_))); + assert!(manager.save().is_ok()); let mut loaded_manager = AccountManager::load(manifest_path.as_path()).unwrap(); loaded_manager.submit_passkey(passkey); @@ -542,7 +542,7 @@ mod tests { if _r.is_err() { eprintln!("{:?}", _r); } - assert!(matches!(_r, Ok(_))); + assert!(_r.is_ok()); assert_eq!( loaded_manager.manifest.entries.len(), loaded_manager.accounts.len() @@ -628,17 +628,16 @@ mod tests { std::fs::remove_file(&manifest_path)?; let mut loaded_manager = AccountManager::new(manifest_path.as_path()); - assert!(matches!( - loaded_manager.import_account( + assert!(loaded_manager + .import_account( &tmp_dir .path() .join("asdf1234.maFile") .into_os_string() .into_string() .unwrap() - ), - Ok(_) - )); + ) + .is_ok()); assert_eq!( loaded_manager.manifest.entries.len(), loaded_manager.accounts.len() diff --git a/src/commands/qr_login.rs b/src/commands/qr_login.rs index e3c2a53..884d5ff 100644 --- a/src/commands/qr_login.rs +++ b/src/commands/qr_login.rs @@ -42,7 +42,10 @@ where loop { let Some(tokens) = account.tokens.as_ref() else { - error!("No tokens found for {}. Can't approve login if we aren't logged in ourselves.", account.account_name); + error!( + "No tokens found for {}. Can't approve login if we aren't logged in ourselves.", + account.account_name + ); return Err(anyhow!("No tokens found for {}", account.account_name)); }; diff --git a/src/tui.rs b/src/tui.rs index d45cde6..600eaa5 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -288,7 +288,7 @@ mod prompt_char_tests { #[test] fn test_should_not_give_invalid() { let answer = prompt_char_impl("g", "yn"); - assert!(matches!(answer, Err(_))); + assert!(answer.is_err()); let answer = prompt_char_impl("n", "yn").unwrap(); assert_eq!(answer, 'n'); } @@ -296,6 +296,6 @@ mod prompt_char_tests { #[test] fn test_should_not_give_multichar() { let answer = prompt_char_impl("yy", "yn"); - assert!(matches!(answer, Err(_))); + assert!(answer.is_err()); } } diff --git a/steamguard/src/lib.rs b/steamguard/src/lib.rs index bb98fc3..d26138e 100644 --- a/steamguard/src/lib.rs +++ b/steamguard/src/lib.rs @@ -101,11 +101,13 @@ impl SteamGuardAccount { client: &TwoFactorClient, revocation_code: Option<&String>, ) -> Result<(), RemoveAuthenticatorError> { - if !matches!(revocation_code, Some(_)) && self.revocation_code.expose_secret().is_empty() { + if revocation_code.is_none() && self.revocation_code.expose_secret().is_empty() { return Err(RemoveAuthenticatorError::MissingRevocationCode); } let Some(tokens) = &self.tokens else { - return Err(RemoveAuthenticatorError::TransportError(TransportError::Unauthorized)); + return Err(RemoveAuthenticatorError::TransportError( + TransportError::Unauthorized, + )); }; let mut req = CTwoFactor_RemoveAuthenticator_Request::new(); req.set_revocation_code(