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
2021-04-23 09:36:10 -04:00
committed by GitHub
parent 541692c4a8
commit 052be8bbef
37 changed files with 77 additions and 188 deletions
@@ -195,7 +195,7 @@ pub fn extract_all_signature_types(items: &[ImplItem]) -> Vec<Type> {
ImplItem::Method(method) => Some(&method.sig),
_ => None,
})
.map(|sig| {
.flat_map(|sig| {
let ret_ty = match &sig.output {
ReturnType::Default => None,
ReturnType::Type(_, ty) => Some((**ty).clone()),
@@ -209,7 +209,6 @@ pub fn extract_all_signature_types(items: &[ImplItem]) -> Vec<Type> {
_ => (**ty).clone(),
}).chain(ret_ty)
})
.flatten()
.collect()
}