Simplify some Option / Result / ? operator patterns (#8653)

* Simplify some Option / Result / ? operator patterns

When those match a combinator exactly.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).

* adjust after review

* adjust post-review
This commit is contained in:
François Garillot authored and GitHub committed 2021-04-23 13:36:10 +00:00
1 parent 541692c4a8
commit 052be8bbef
37 files changed
+77 -188

No files matched your search

@@ -99,8 +99,7 @@ fn replace_path_dependencies_with_git(cargo_toml_path: &Path, commit_id: &str, c
let deps_rewritten = dependencies
.iter()
.filter_map(|(k, v)| v.clone().try_into::<toml::value::Table>().ok().map(move |v| (k, v)))
.filter(|t| t.1.contains_key("path"))
.filter(|t| {
.filter(|t| t.1.contains_key("path") && {
// if the path does not exists, we need to add this as git dependency
t.1.get("path").unwrap().as_str().map(|path| !cargo_toml_path.join(path).exists()).unwrap_or(false)
})