fix: eliminate unwraps

fix: mtshiba/pylyzer#46
This commit is contained in:
Shunsuke Shibayama 2023-07-03 00:46:30 +09:00
parent 1d4c837abe
commit 2d532ad0ea
2 changed files with 2 additions and 2 deletions

View file

@ -138,7 +138,7 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
for err in errors.into_iter() {
let loc = err.core.get_loc_with_fallback();
let res_uri = if let Some(path) = err.input.path() {
Url::from_file_path(path.canonicalize().unwrap())
Url::from_file_path(path.canonicalize().unwrap_or(path.to_path_buf()))
} else {
Ok(uri.clone().raw())
};

View file

@ -41,7 +41,7 @@ impl SharedCompilerResource {
graph,
cfg.input
.path()
.map_or(PathBuf::default(), |p| p.canonicalize().unwrap()),
.map_or(PathBuf::default(), |p| p.canonicalize().unwrap_or_default()),
),
errors: SharedCompileErrors::new(),
warns: SharedCompileWarnings::new(),