From 5ff2bb4dcf4680a4e3d0d74dda02c7a5989b4305 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 21 Jun 2019 09:02:33 +0200 Subject: [PATCH] Use map instead of match on Option --- src/parse/features/suggestions.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/parse/features/suggestions.rs b/src/parse/features/suggestions.rs index a7b38ce2..73fb0420 100644 --- a/src/parse/features/suggestions.rs +++ b/src/parse/features/suggestions.rs @@ -25,10 +25,8 @@ where candidate = Some((confidence, pv.as_ref().to_owned())); } } - match candidate { - None => None, - Some((_, candidate)) => Some(candidate.to_owned()), - } + + candidate.map(|(_, candidate)| candidate) } #[cfg(not(feature = "suggestions"))]