diff --git a/mkwin/src/error.rs b/mkwin/src/error.rs index 846abef..e2e3d95 100644 --- a/mkwin/src/error.rs +++ b/mkwin/src/error.rs @@ -3,13 +3,13 @@ use std::process::exit; /// no argument for target; code 1 -pub fn missing_target() { +pub fn missing_target() -> ! { eprintln!("mkwin: missing target"); exit(1); } /// failed to canonicalize target path; code 2 -pub fn canonicalize_fail(target: String) { +pub fn canonicalize_fail(target: String) -> ! { eprintln!("mkwin: failed to canonicalze '{target}'--does the file exist?"); exit(2); } diff --git a/mkwin/src/main.rs b/mkwin/src/main.rs index b3cbb95..d8a5dad 100644 --- a/mkwin/src/main.rs +++ b/mkwin/src/main.rs @@ -73,15 +73,9 @@ pub fn main() { if let Ok(path) = path.canonicalize() { let path: String = path.to_string_lossy().into(); target = format!("'{path}'"); - } else { - error::canonicalize_fail(arg); - return; - } + } else { error::canonicalize_fail(arg); } } - } else { - error::missing_target(); - return; - } + } else { error::missing_target(); } // construct output println!("#!/usr/bin/bash\n# generated with: mkwin{arg_string}\n");