From 784c28af77dfc418ed6a5e1f31dec3d3e3e2cbe6 Mon Sep 17 00:00:00 2001 From: Kiril Kovachev Date: Thu, 8 May 2025 23:42:08 +0100 Subject: [PATCH] refactor: Use ? operator instead of unwrapping inside of setup() --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b9fb4dd..2aba1b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ fn setup(args: SetupArgs) -> Result<(), std::io::Error> { let config_template = std::fs::read_to_string(CONFIG_TEMPLATE_PATH).or(Err(std::io::Error::new(std::io::ErrorKind::NotFound, format!("Unable to find {}; did you execute the script from the same directory?", CONFIG_TEMPLATE_PATH))))?; let filled_in_config = formatx!(config_template, args.api_url, args.rest_url, args.username, args.botpassword, args.oauth2_token).unwrap(); let path = get_bot_config_path(); - std::fs::write(&path, filled_in_config).unwrap(); + std::fs::write(&path, filled_in_config)?; // Fix permissions on UNIX-like systems, since mwbot-rs doesn't like to read configs with loose permissions. { use std::os::unix::fs::PermissionsExt;