From ace3f512d3b290c47c7e824464191b24e12e5ae5 Mon Sep 17 00:00:00 2001 From: Steve Pentland Date: Mon, 23 Apr 2018 21:42:58 -0400 Subject: [PATCH] Make compatible with min rust version --- src/internal.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/internal.rs b/src/internal.rs index 500b9a2..10c90ec 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -70,16 +70,22 @@ impl SizeFilter { return None; } - let captures = SIZE_CAPTURES.captures(s)?; + let captures = match SIZE_CAPTURES.captures(s) { + Some(cap) => cap, + None => return None, + }; let limit = match captures.get(1).map_or("+", |m| m.as_str()) { "+" => SizeLimitType::Min, _ => SizeLimitType::Max, }; - let quantity = match captures.get(2)?.as_str().parse::() { - Ok(val) => val, - _ => return None, + let quantity = match captures.get(2) { + None => return None, + Some(v) => match v.as_str().parse::() { + Ok(val) => val, + _ => return None, + }, }; let multiplier = match &captures.get(3).map_or("k", |m| m.as_str()).to_lowercase()[..] {