Skip to content

Commit

Permalink
remove normalize_comments rustfmt rule (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Sep 10, 2023
1 parent 97a9040 commit f952ed5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
tab_spaces = 4
hard_tabs = true
normalize_comments = true
15 changes: 7 additions & 8 deletions src/accountmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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);
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion src/commands/qr_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};

Expand Down
4 changes: 2 additions & 2 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ 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');
}

#[test]
fn test_should_not_give_multichar() {
let answer = prompt_char_impl("yy", "yn");
assert!(matches!(answer, Err(_)));
assert!(answer.is_err());
}
}
6 changes: 4 additions & 2 deletions steamguard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ impl SteamGuardAccount {
client: &TwoFactorClient<T>,
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(
Expand Down

0 comments on commit f952ed5

Please sign in to comment.