Postpone using Option::flatten() until Rust 1.40 is a bit older.

This commit is contained in:
Tim Bruijnzeels
2020-03-16 14:17:12 -03:00
parent 6d50542cc7
commit 2d9532ecdf
+9 -1
View File
@@ -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),
},
}
}
}