diff --git a/src/map.rs b/src/map.rs index f847c21..6fbc944 100644 --- a/src/map.rs +++ b/src/map.rs @@ -234,19 +234,6 @@ impl Map { } } - /// Retains only the elements specified by the predicate. - /// - /// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` - /// returns `false`. - #[cfg(not(no_btreemap_retain))] - #[inline] - pub fn retain(&mut self, f: F) - where - F: FnMut(&String, &mut Value) -> bool, - { - self.map.retain(f); - } - /// Gets an iterator over the values of the map. #[inline] pub fn values(&self) -> Values { @@ -262,6 +249,19 @@ impl Map { iter: self.map.values_mut(), } } + + /// Retains only the elements specified by the predicate. + /// + /// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` + /// returns `false`. + #[cfg(not(no_btreemap_retain))] + #[inline] + pub fn retain(&mut self, f: F) + where + F: FnMut(&String, &mut Value) -> bool, + { + self.map.retain(f); + } } #[allow(clippy::derivable_impls)] // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7655