From d610adfc2bfe3d4e9fec61b7a5bc02cfea503384 Mon Sep 17 00:00:00 2001 From: Evgenii P Date: Sun, 4 Aug 2019 08:03:17 +0700 Subject: Employ early return pattern more --- crates/ra_hir/src/source_binder.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index cf9a9e108..2c4cedd8b 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -428,20 +428,18 @@ impl SourceAnalyzer { let std_future_trait = match self.resolver.resolve_path_segments(db, &std_future_path).into_fully_resolved() { PerNs { types: Some(Resolution::Def(ModuleDef::Trait(trait_))), .. } => { - Some(trait_) + trait_ } - _ => None, + _ => return false, }; - let krate = self.resolver.krate(); - if let Some(krate) = krate { - if let Some(trait_) = std_future_trait { - let canonical_ty = crate::ty::Canonical { value: ty, num_vars: 0 }; - return implements_trait(&canonical_ty, db, &self.resolver, krate, trait_); - } - } + let krate = match self.resolver.krate() { + Some(krate) => krate, + _ => return false, + }; - false + let canonical_ty = crate::ty::Canonical { value: ty, num_vars: 0 }; + return implements_trait(&canonical_ty, db, &self.resolver, krate, std_future_trait); } #[cfg(test)] -- cgit v1.2.3