refactor: optimize

This commit is contained in:
GyDi
2022-09-11 20:58:55 +08:00
parent 04f4934adb
commit 2d00ddad2b
20 changed files with 812 additions and 631 deletions

View File

@@ -58,22 +58,20 @@ pub fn open_file(path: PathBuf) -> Result<()> {
.arg(path)
.spawn()
{
bail!(format!("failed to open file by VScode for `{err}`"));
bail!("failed to open file by VScode for `{err}`");
}
}
#[cfg(not(target_os = "windows"))]
if let Err(err) = Command::new(code).arg(path).spawn() {
bail!(format!("failed to open file by VScode for `{err}`"));
bail!("failed to open file by VScode for `{err}`");
}
return Ok(());
}
match open::that(path) {
Ok(_) => Ok(()),
Err(err) => bail!(format!("failed to open file for `{err}`")),
}
open::that(path)?;
Ok(())
}
#[macro_export]