Skip to content

Commit

Permalink
Fix clippy warnings after the upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubfijalkowski committed Feb 5, 2023
1 parent d4e6f5e commit ade5619
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/env/azure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl AzureConfig {
if let Some(url) = &self.azure_keyvault_url {
Ok(url.to_string())
} else if let Some(name) = &self.azure_keyvault_name {
Ok(format!("https://{}.vault.azure.net", name))
Ok(format!("https://{name}.vault.azure.net"))
} else {
Err(AzureError::ConfigurationError(anyhow::Error::msg(
"configuration is invalid (Clap should not validate that)",
Expand Down
4 changes: 2 additions & 2 deletions src/env/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub fn as_valid_env_name(name: String) -> Result<String> {
pub fn value_as_string(name: &str, v: Value) -> Result<String> {
match v {
Value::String(s) => Ok(s),
Value::Bool(b) => Ok(format!("{}", b)),
Value::Number(n) => Ok(format!("{}", n)),
Value::Bool(b) => Ok(format!("{b}")),
Value::Number(n) => Ok(format!("{n}")),
Value::Null => Ok("null".to_string()),
_ => bail!("secret '{}' value is not convertible", name),
}
Expand Down
6 changes: 3 additions & 3 deletions src/env/google.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl Vault for GoogleConfig {
let project = self.google_project.as_ref().unwrap();
let response = manager
.projects()
.secrets_list(&format!("projects/{}", project))
.secrets_list(&format!("projects/{project}"))
.page_size(250)
.doit()
.await
Expand Down Expand Up @@ -205,7 +205,7 @@ impl GoogleConfig {
) -> Result<String> {
let data = manager
.projects()
.secrets_versions_access(&format!("{}/versions/latest", name))
.secrets_versions_access(&format!("{name}/versions/latest"))
.doit()
.await
.map_err(GoogleError::SecretManagerError)?
Expand All @@ -215,7 +215,7 @@ impl GoogleConfig {
.data
.ok_or(GoogleError::EmptySecret)?;
let raw_bytes = base64
.decode(&data)
.decode(data)
.map_err(|e| GoogleError::WrongEncoding(anyhow::anyhow!(e)))?;
String::from_utf8(raw_bytes).map_err(|e| GoogleError::WrongEncoding(anyhow::anyhow!(e)))
}
Expand Down
8 changes: 6 additions & 2 deletions src/env/process_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ impl ProcessEnv {

#[cfg(test)]
mod tests {
use std::fmt::Display;

use super::*;

impl ProcessEnv {
Expand All @@ -97,9 +99,11 @@ mod tests {
pub fn from_str(s: &str) -> Self {
serde_json::from_str(s).unwrap()
}
}

pub fn to_string(&self) -> String {
serde_json::to_string(self).unwrap()
impl Display for ProcessEnv {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}

Expand Down

0 comments on commit ade5619

Please sign in to comment.