Skip to content

Commit

Permalink
remove unwrap()
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <[email protected]>
  • Loading branch information
He1pa committed Sep 12, 2024
1 parent 40e1027 commit c802872
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kclvm/parser/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,12 @@ pub fn abs_path(file: &String, work_dir: &String) -> String {
// If the input file or path is a relative path and it is not a absolute path in the KCL module VFS,
// join with the work directory path and convert it to a absolute path.
let path = ModRelativePath::from(file.to_string());
let abs_path = if !is_absolute
&& !path
.is_relative_path()
.map_err(|err| err.to_string())
.unwrap()
{
let is_relative_path = match path.is_relative_path() {
Ok(is_relative_path) => is_relative_path,
_ => return file.clone(),
};

let abs_path = if !is_absolute && !is_relative_path {
let filepath = std::path::Path::new(work_dir).join(file);
match filepath.canonicalize() {
Ok(path) => Some(path.adjust_canonicalization()),
Expand Down

0 comments on commit c802872

Please sign in to comment.