From 04b43fe44d5f668f0bd0f6530694fdc6d943ec96 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Thu, 12 Oct 2023 04:02:15 -0700 Subject: [PATCH] fix: remove unneeded or_else cases --- src/cli/utils/files.rs | 51 ++---------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/src/cli/utils/files.rs b/src/cli/utils/files.rs index 09e8a0d..9b9b1ca 100644 --- a/src/cli/utils/files.rs +++ b/src/cli/utils/files.rs @@ -149,56 +149,9 @@ pub fn discover_script_path_including_lune_dirs(path: &str) -> Result { // directories + the home directory for the current user let res = discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), false) .or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), false)) - .or_else(|_| { - discover_script_path( - format!("lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.lua"), - false, - ) - }) - .or_else(|_| { - discover_script_path( - format!(".lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.lua"), - false, - ) - }) - .or_else(|_| { - discover_script_path( - format!("lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.luau"), - false, - ) - }) - .or_else(|_| { - discover_script_path( - format!(".lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.luau"), - false, - ) - }) .or_else(|_| discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), true)) - .or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), true)) - .or_else(|_| { - discover_script_path( - format!("lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.lua"), - true, - ) - }) - .or_else(|_| { - discover_script_path( - format!(".lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.lua"), - true, - ) - }) - .or_else(|_| { - discover_script_path( - format!("lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.luau"), - true, - ) - }) - .or_else(|_| { - discover_script_path( - format!(".lune{MAIN_SEPARATOR}{path}{MAIN_SEPARATOR}init.luau"), - true, - ) - }); + .or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), true)); + match res { // NOTE: The first error message is generally more // descriptive than the ones for the lune subfolders