From 4ced7f621059e6906d9a3775c1c52d24d5a205d2 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 23 Jan 2024 20:37:03 -0800 Subject: [PATCH] change return Err to Err()? --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0c5e41a..55b23e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -119,7 +119,7 @@ async fn main()->AResult<()>{ (None,Some(env_var),None)=>Some(Cookie::Environment(env_var)), (None,None,Some(path))=>Some(Cookie::File(path)), (None,None,None)=>None, - _=>return Err(anyhow::Error::msg("Cookie was specified multiple times.")), + _=>Err(anyhow::Error::msg("Cookie was specified multiple times."))?, } }; let cookie=match cookie_enum{ @@ -143,7 +143,7 @@ async fn main()->AResult<()>{ |Some("RoxRojo") |Some("RojoRox")=>Some(DecompileStyle::RoxRojo), None=>None, - _=>return Err(anyhow::Error::msg("Invalid style")), + _=>Err(anyhow::Error::msg("Invalid style"))?, }; match cli.command{ @@ -255,7 +255,7 @@ async fn upload_list(cookie:String,group:Option,asset_id_file_map:AssetIDFi .body(body) .send().await?; }else{ - return Err(anyhow::Error::msg("Roblox returned 403 with no CSRF")); + Err(anyhow::Error::msg("Roblox returned 403 with no CSRF"))?; } } @@ -394,7 +394,7 @@ async fn download_history(mut config:DownloadHistoryConfig)->AResult<()>{ match std::fs::File::open(versions_path){ Ok(versions_file)=>asset_list.append(&mut serde_json::from_reader(versions_file)?), Err(e)=>match e.kind(){ - std::io::ErrorKind::NotFound=>return Err(anyhow::Error::msg("Cannot continue from versions.json - file does not exist")), + std::io::ErrorKind::NotFound=>Err(anyhow::Error::msg("Cannot continue from versions.json - file does not exist"))?, _=>Err(e)?, } } @@ -624,7 +624,7 @@ fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:std::path::PathBuf,node:&TreeN // properties.class=None; // }, None=>assert!(file.set_extension("lua"),"could not set extension"), - Some(other)=>return Err(anyhow::Error::msg(format!("Attempt to write a {} as a script",other))), + Some(other)=>Err(anyhow::Error::msg(format!("Attempt to write a {} as a script",other)))?, } } } @@ -1282,7 +1282,7 @@ fn extract_script_overrides(mut source:String)->AResult{ match &captures[1]{ "Name"=>overrides.name=Some(captures[2].to_owned()), "ClassName"=>overrides.class=Some(captures[2].to_owned()), - other=>return Err(anyhow::Error::msg(format!("Unimplemented property {other}"))), + other=>Err(anyhow::Error::msg(format!("Unimplemented property {other}")))?, } }else{ break; @@ -1329,7 +1329,7 @@ async fn discern_node(search_path:&std::path::PathBuf,search_name:&str,style:Opt |(None,ScriptHint::Script)=>CompileClass::LocalScript(script_with_overrides.source), (Some("Script"),_) |(None,ScriptHint::LocalScript)=>CompileClass::Script(script_with_overrides.source), - other=>return Err(anyhow::Error::msg(format!("Invalid hint or class {other:?}"))), + other=>Err(anyhow::Error::msg(format!("Invalid hint or class {other:?}")))?, }, folder:Some(dir), }