diff --git a/src/providers/cobol.rs b/src/providers/cobol.rs index 680c4e9ba..ce78ff3c4 100644 --- a/src/providers/cobol.rs +++ b/src/providers/cobol.rs @@ -90,13 +90,10 @@ impl CobolProvider { } fn normalized_path(path: &PathBuf) -> Option { - if let Some(normalized_path) = path.to_slash() { - let path_string = PathBuf::from_str(normalized_path.to_string().as_str()); - - if let Ok(path) = path_string { - return Some(path); - } - } - None + path.to_slash().and_then(|normalized_path| { + PathBuf::from_str(normalized_path.as_ref()) + .map(Some) + .unwrap_or(None) + }) } }