From 2d9532ecdfbc7a38d1afa2ec508c839cfcc2e059 Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Mon, 16 Mar 2020 14:17:12 -0300 Subject: [PATCH] Postpone using Option::flatten() until Rust 1.40 is a bit older. --- src/daemon/http/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/daemon/http/mod.rs b/src/daemon/http/mod.rs index 0b52c352..f5f13caa 100644 --- a/src/daemon/http/mod.rs +++ b/src/daemon/http/mod.rs @@ -393,6 +393,14 @@ impl RequestPath { where T: FromStr, { - self.next().map(|s| T::from_str(s).ok()).flatten() + // TODO change to .flatten() when rust 1.40 is more commonplace, + // it seems a bit over the top to require 1.40 for this only. + match self.next().map(|s| T::from_str(s).ok()) { + None => None, + Some(opt) => match opt { + None => None, + Some(t) => Some(t), + }, + } } }