From c82be2f4cb909a70b870ab2fb176e54a91e5372f Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 24 Feb 2016 22:50:23 -0500 Subject: [PATCH] Prefer 'match' pattern guard over conditional within body. --- src/libstd/path.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index e1393ce6aab..81d9d0a7f10 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -393,11 +393,8 @@ fn iter_after(mut iter: I, mut prefix: J) -> Option loop { let mut iter_next = iter.clone(); match (iter_next.next(), prefix.next()) { - (Some(x), Some(y)) => { - if x != y { - return None; - } - } + (Some(ref x), Some(ref y)) if x == y => (), + (Some(_), Some(_)) => return None, (Some(_), None) => return Some(iter), (None, None) => return Some(iter), (None, Some(_)) => return None,