aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Vorobjov <maxim.vorobjov@gmail.com>2019-11-01 17:58:09 +0300
committerAlex Crichton <alex@alexcrichton.com>2019-11-01 09:58:09 -0500
commit1e6bfbca98813d7126b65ba6e6706237dc9a3274 (patch)
tree34adc0e8709c84120e1894a445f3c12418f2fefc
parent4673cfd79788c74c5bd6bcabe564c2dfcbd7c553 (diff)
downloadmilf-rs-1e6bfbca98813d7126b65ba6e6706237dc9a3274.tar.gz
milf-rs-1e6bfbca98813d7126b65ba6e6706237dc9a3274.zip
replace copied wit filter_map for rustc 1.35 compatibility (#354)
-rw-r--r--src/de.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/de.rs b/src/de.rs
index 27462e8..ae44f20 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -432,8 +432,7 @@ impl<'de, 'b> de::MapAccess<'de> for MapVisitor<'de, 'b> {
}
entries[start..]
.iter()
- .copied()
- .filter(|i| *i < self.max)
+ .filter_map(|i| if *i < self.max { Some(*i) } else { None })
.map(|i| (i, &self.tables[i]))
.find(|(_, table)| table.values.is_some())
.map(|p| p.0)
@@ -572,8 +571,7 @@ impl<'de, 'b> de::SeqAccess<'de> for MapVisitor<'de, 'b> {
}
entries[start..]
.iter()
- .copied()
- .filter(|i| *i < self.max)
+ .filter_map(|i| if *i < self.max { Some(*i) } else { None })
.map(|i| (i, &self.tables[i]))
.find(|(_, table)| table.array)
.map(|p| p.0)