From 17618cf936a2678791c2b812a7ed10f7e0652111 Mon Sep 17 00:00:00 2001 From: Andriy Massimilla Date: Mon, 7 Oct 2024 11:21:13 -0400 Subject: [PATCH] Don't use empty string for project name fallback --- src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d9f3902..b138645 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,14 +50,13 @@ impl std::error::Error for GenerateError { pub fn get_project_name(out_dir: &Path) -> String { let path = match out_dir.canonicalize() { Ok(path) => path, - Err(_) => return "".to_string(), + Err(_) => "project".into(), }; - return path - .file_stem() + path.file_stem() .unwrap_or_default() .to_string_lossy() - .into_owned(); + .to_string() } /// Generates a filled directory from the specified spackle project.