change return Err to Err()?

This commit is contained in:
Quaternions 2024-01-23 20:37:03 -08:00
parent db2c760c49
commit 4ced7f6210

View File

@ -119,7 +119,7 @@ async fn main()->AResult<()>{
(None,Some(env_var),None)=>Some(Cookie::Environment(env_var)), (None,Some(env_var),None)=>Some(Cookie::Environment(env_var)),
(None,None,Some(path))=>Some(Cookie::File(path)), (None,None,Some(path))=>Some(Cookie::File(path)),
(None,None,None)=>None, (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{ let cookie=match cookie_enum{
@ -143,7 +143,7 @@ async fn main()->AResult<()>{
|Some("RoxRojo") |Some("RoxRojo")
|Some("RojoRox")=>Some(DecompileStyle::RoxRojo), |Some("RojoRox")=>Some(DecompileStyle::RoxRojo),
None=>None, None=>None,
_=>return Err(anyhow::Error::msg("Invalid style")), _=>Err(anyhow::Error::msg("Invalid style"))?,
}; };
match cli.command{ match cli.command{
@ -255,7 +255,7 @@ async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFi
.body(body) .body(body)
.send().await?; .send().await?;
}else{ }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){ match std::fs::File::open(versions_path){
Ok(versions_file)=>asset_list.append(&mut serde_json::from_reader(versions_file)?), Ok(versions_file)=>asset_list.append(&mut serde_json::from_reader(versions_file)?),
Err(e)=>match e.kind(){ 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)?, _=>Err(e)?,
} }
} }
@ -624,7 +624,7 @@ fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:std::path::PathBuf,node:&TreeN
// properties.class=None; // properties.class=None;
// }, // },
None=>assert!(file.set_extension("lua"),"could not set extension"), 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<ScriptWithOverrides>{
match &captures[1]{ match &captures[1]{
"Name"=>overrides.name=Some(captures[2].to_owned()), "Name"=>overrides.name=Some(captures[2].to_owned()),
"ClassName"=>overrides.class=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{ }else{
break; 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), |(None,ScriptHint::Script)=>CompileClass::LocalScript(script_with_overrides.source),
(Some("Script"),_) (Some("Script"),_)
|(None,ScriptHint::LocalScript)=>CompileClass::Script(script_with_overrides.source), |(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), folder:Some(dir),
} }