Clippy easy wins 1 (#596)

This commit is contained in:
trevyn
2021-03-17 10:51:53 -04:00
committed by GitHub
parent 4e4880be8e
commit a88a522f84
6 changed files with 13 additions and 40 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ where
config.owner_api_listen_addr().as_str(),
g_args.api_secret.clone(),
g_args.tls_conf.clone(),
config.owner_api_include_foreign.clone(),
config.owner_api_include_foreign,
Some(tor_config.clone()),
test_mode,
);
+3 -24
View File
@@ -337,38 +337,17 @@ pub struct OwnerV3Helpers;
impl OwnerV3Helpers {
/// Checks whether a request is to init the secure API
pub fn is_init_secure_api(val: &serde_json::Value) -> bool {
if let Some(m) = val["method"].as_str() {
match m {
"init_secure_api" => true,
_ => false,
}
} else {
false
}
matches!(val["method"].as_str(), Some("init_secure_api"))
}
/// Checks whether a request is to open the wallet
pub fn is_open_wallet(val: &serde_json::Value) -> bool {
if let Some(m) = val["method"].as_str() {
match m {
"open_wallet" => true,
_ => false,
}
} else {
false
}
matches!(val["method"].as_str(), Some("open_wallet"))
}
/// Checks whether a request is an encrypted request
pub fn is_encrypted_request(val: &serde_json::Value) -> bool {
if let Some(m) = val["method"].as_str() {
match m {
"encrypted_request_v3" => true,
_ => false,
}
} else {
false
}
matches!(val["method"].as_str(), Some("encrypted_request_v3"))
}
/// whether encryption is enabled