From 6d0b7386976ca76b464b29d3cfeb0fc4e824bfe7 Mon Sep 17 00:00:00 2001 From: networkException Date: Thu, 12 Sep 2024 02:17:43 +0200 Subject: [PATCH] Main: Fix format strings not being format strings Damn you rust-analyzer for highlighting these things when not using format! or an equivalent. --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index edea77a..5b8b554 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,8 @@ fn main() -> Result<()> { let path_to_contents = env::args().nth(1).expect("The first argument to be present."); let output_path = env::args().nth(2).expect("The second argument to be present."); - let contents = fs::read_to_string(path_to_contents).expect("To be able to read the contents file at the path '{path_to_contents}' passed as the first argument."); + let contents = fs::read_to_string(&path_to_contents) + .expect(format!("To be able to read the contents file at the path '{path_to_contents}' passed as the first argument.").as_str()); let secret_inputs = env::vars().filter(|(key, _)| key.starts_with("SECRET_")); @@ -26,7 +27,7 @@ fn main() -> Result<()> { }; let secret_value = fs::read_to_string(path_to_secret) - .expect("To be able to read in secret '{secret_key}' from path '{path_to_secret}'"); + .expect(format!("To be able to read in secret '{secret_key}' from path '{path_to_secret}'").as_str()); println!("Registering secret '{secret_key}' from '{path_to_secret}'."); @@ -73,7 +74,8 @@ fn main() -> Result<()> { let output = handlebars.render_template(contents.as_str(), &Value::Object(data_map))?; - fs::write(output_path, output).expect("To be able to write to {output_path}"); + fs::write(&output_path, output) + .expect(format!("To be able to write to {output_path}").as_str()); Ok(()) }