diff options
author | Stuart Stock <stuart@int08h.com> | 2020-06-20 09:56:18 -0700 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2020-06-20 09:56:18 -0700 |
commit | 76c4af584837416411b1941e78e95538f2549697 (patch) | |
tree | 428f96230f5bc2c967f9a58fa28535c01d9f41eb | |
parent | 5a783fe0f444d96520d8efb2662cdba18e88ad6d (diff) | |
download | roughenough-76c4af584837416411b1941e78e95538f2549697.zip |
Refactor: lift return out of if block
-rw-r--r-- | src/kms/gcpkms.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kms/gcpkms.rs b/src/kms/gcpkms.rs index d3b7340..a59318a 100644 --- a/src/kms/gcpkms.rs +++ b/src/kms/gcpkms.rs @@ -137,21 +137,21 @@ pub mod inner { fn load_gcp_credential() -> Result<ServiceAccountKey, KmsError> { if let Ok(gac) = env::var(GOOGLE_APP_CREDS.to_string()) { - if Path::new(&gac).exists() { + return if Path::new(&gac).exists() { match oauth2::service_account_key_from_file(&gac) { - Ok(svc_acct_key) => return Ok(svc_acct_key), + Ok(svc_acct_key) => Ok(svc_acct_key), Err(e) => { - return Err(KmsError::InvalidConfiguration(format!( + Err(KmsError::InvalidConfiguration(format!( "Can't load service account credential '{}': {:?}", gac, e ))) } } } else { - return Err(KmsError::InvalidConfiguration(format!( + Err(KmsError::InvalidConfiguration(format!( "{} ='{}' does not exist", GOOGLE_APP_CREDS, gac - ))); + ))) } } |