diff --git a/Cargo.lock b/Cargo.lock index 2e1f6ab..43e5f2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,7 +166,7 @@ dependencies = [ "aws-smithy-types", "clap", "http 1.1.0", - "thiserror", + "thiserror 2.0.3", "time", "tokio", ] @@ -342,7 +342,7 @@ dependencies = [ "regex-lite", "roxmltree", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1636,18 +1636,38 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3c6efbfc763e64eb85c11c25320f0737cb7364c4b6336db90aa9ebe27a0bbd" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] name = "thiserror-impl" -version = "1.0.67" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b607164372e89797d78b8e23a6d67d5d1038c1c65efd52e1389ef8b77caba2a6" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index bec2e2f..6660f7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ aws-runtime = "1" aws-sdk-sts = "1" aws-smithy-runtime-api = "1" clap = { version = "4", features = ["derive", "env"] } -thiserror = "1" +thiserror = "2" time = "0" tokio = { version = "1", features = ["full"] } diff --git a/src/env.rs b/src/env.rs index 877f212..7d272be 100644 --- a/src/env.rs +++ b/src/env.rs @@ -12,7 +12,7 @@ const AWS_SESSION_EXPIRATION_TIMESTAMP: &str = "AWS_SESSION_EXPIRATION_TIMESTAMP pub async fn get_env_credentials( provider: EnvironmentVariableCredentialsProvider, ) -> Result, Error> { - return match var(AWS_SESSION_EXPIRATION_TIMESTAMP) { + match var(AWS_SESSION_EXPIRATION_TIMESTAMP) { Ok(var) => match var.parse::() { Ok(session_expiration_timestamp) => { let credentials = provider @@ -37,5 +37,5 @@ pub async fn get_env_credentials( var: String::from(AWS_SESSION_EXPIRATION_TIMESTAMP), source: e, }), - }; + } } diff --git a/src/io.rs b/src/io.rs index a552a77..4ed6a3c 100644 --- a/src/io.rs +++ b/src/io.rs @@ -63,12 +63,12 @@ fn find_credentials(file_content: &str, profile: &str) -> Option { } fn replace_credentials(file_content: &str, profile: &str, content: &str) -> String { - return file_content + file_content .split("\n\n") .filter(|l| !l.is_empty() && !l.contains(format!("[{profile}]").as_str())) .collect::>() .join("\n\n") - .add(content); + .add(content) } pub fn find_auth_credentials(home: &str, profile: &str) -> Result, Error> {