mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Remove some unnecessary unwraps by using the Result::ok
combinatoric
This commit is contained in:
parent
c881fc607e
commit
07202f944c
@ -59,12 +59,8 @@ impl RootFilter {
|
||||
if !(self.file_filter)(path) {
|
||||
return None;
|
||||
}
|
||||
if !(path.starts_with(&self.root)) {
|
||||
return None;
|
||||
}
|
||||
let path = path.strip_prefix(&self.root).unwrap();
|
||||
let path = RelativePathBuf::from_path(path).unwrap();
|
||||
Some(path)
|
||||
let path = path.strip_prefix(&self.root).ok()?;
|
||||
RelativePathBuf::from_path(path).ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user