From 05ddad37d19bd32b8ef75464640c8b0e6a6e1516 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Mon, 13 Aug 2018 23:12:36 +0200 Subject: [PATCH] use ? to simplify `TransitiveRelation.maybe_map` --- src/librustc_data_structures/transitive_relation.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index 18a1e9129b3..2acc29acb0c 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -97,12 +97,7 @@ impl TransitiveRelation { { let mut result = TransitiveRelation::new(); for edge in &self.edges { - f(&self.elements[edge.source.0]).and_then(|source| { - f(&self.elements[edge.target.0]).and_then(|target| { - result.add(source, target); - Some(()) - }) - })?; + result.add(f(&self.elements[edge.source.0])?, f(&self.elements[edge.target.0])?); } Some(result) }