remove normalize_comments
rustfmt rule (#316)
This commit is contained in:
parent
97a9040eb8
commit
f952ed5b1b
5 changed files with 17 additions and 14 deletions
|
@ -1,3 +1,2 @@
|
||||||
tab_spaces = 4
|
tab_spaces = 4
|
||||||
hard_tabs = true
|
hard_tabs = true
|
||||||
normalize_comments = true
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ mod tests {
|
||||||
let tmp_dir = TempDir::new("steamguard-cli-test").unwrap();
|
let tmp_dir = TempDir::new("steamguard-cli-test").unwrap();
|
||||||
let manifest_path = tmp_dir.path().join("manifest.json");
|
let manifest_path = tmp_dir.path().join("manifest.json");
|
||||||
let manager = AccountManager::new(manifest_path.as_path());
|
let manager = AccountManager::new(manifest_path.as_path());
|
||||||
assert!(matches!(manager.save(), Ok(_)));
|
assert!(manager.save().is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -529,7 +529,7 @@ mod tests {
|
||||||
manager.add_account(account);
|
manager.add_account(account);
|
||||||
manager.manifest.entries[0].encryption = Some(EncryptionScheme::generate());
|
manager.manifest.entries[0].encryption = Some(EncryptionScheme::generate());
|
||||||
manager.submit_passkey(passkey.clone());
|
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();
|
let mut loaded_manager = AccountManager::load(manifest_path.as_path()).unwrap();
|
||||||
loaded_manager.submit_passkey(passkey);
|
loaded_manager.submit_passkey(passkey);
|
||||||
|
@ -542,7 +542,7 @@ mod tests {
|
||||||
if _r.is_err() {
|
if _r.is_err() {
|
||||||
eprintln!("{:?}", _r);
|
eprintln!("{:?}", _r);
|
||||||
}
|
}
|
||||||
assert!(matches!(_r, Ok(_)));
|
assert!(_r.is_ok());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
loaded_manager.manifest.entries.len(),
|
loaded_manager.manifest.entries.len(),
|
||||||
loaded_manager.accounts.len()
|
loaded_manager.accounts.len()
|
||||||
|
@ -628,17 +628,16 @@ mod tests {
|
||||||
std::fs::remove_file(&manifest_path)?;
|
std::fs::remove_file(&manifest_path)?;
|
||||||
|
|
||||||
let mut loaded_manager = AccountManager::new(manifest_path.as_path());
|
let mut loaded_manager = AccountManager::new(manifest_path.as_path());
|
||||||
assert!(matches!(
|
assert!(loaded_manager
|
||||||
loaded_manager.import_account(
|
.import_account(
|
||||||
&tmp_dir
|
&tmp_dir
|
||||||
.path()
|
.path()
|
||||||
.join("asdf1234.maFile")
|
.join("asdf1234.maFile")
|
||||||
.into_os_string()
|
.into_os_string()
|
||||||
.into_string()
|
.into_string()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
),
|
)
|
||||||
Ok(_)
|
.is_ok());
|
||||||
));
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
loaded_manager.manifest.entries.len(),
|
loaded_manager.manifest.entries.len(),
|
||||||
loaded_manager.accounts.len()
|
loaded_manager.accounts.len()
|
||||||
|
|
|
@ -42,7 +42,10 @@ where
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let Some(tokens) = account.tokens.as_ref() else {
|
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));
|
return Err(anyhow!("No tokens found for {}", account.account_name));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ mod prompt_char_tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_should_not_give_invalid() {
|
fn test_should_not_give_invalid() {
|
||||||
let answer = prompt_char_impl("g", "yn");
|
let answer = prompt_char_impl("g", "yn");
|
||||||
assert!(matches!(answer, Err(_)));
|
assert!(answer.is_err());
|
||||||
let answer = prompt_char_impl("n", "yn").unwrap();
|
let answer = prompt_char_impl("n", "yn").unwrap();
|
||||||
assert_eq!(answer, 'n');
|
assert_eq!(answer, 'n');
|
||||||
}
|
}
|
||||||
|
@ -296,6 +296,6 @@ mod prompt_char_tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_should_not_give_multichar() {
|
fn test_should_not_give_multichar() {
|
||||||
let answer = prompt_char_impl("yy", "yn");
|
let answer = prompt_char_impl("yy", "yn");
|
||||||
assert!(matches!(answer, Err(_)));
|
assert!(answer.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,11 +101,13 @@ impl SteamGuardAccount {
|
||||||
client: &TwoFactorClient<T>,
|
client: &TwoFactorClient<T>,
|
||||||
revocation_code: Option<&String>,
|
revocation_code: Option<&String>,
|
||||||
) -> Result<(), RemoveAuthenticatorError> {
|
) -> 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);
|
return Err(RemoveAuthenticatorError::MissingRevocationCode);
|
||||||
}
|
}
|
||||||
let Some(tokens) = &self.tokens else {
|
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();
|
let mut req = CTwoFactor_RemoveAuthenticator_Request::new();
|
||||||
req.set_revocation_code(
|
req.set_revocation_code(
|
||||||
|
|
Loading…
Reference in a new issue