diff --git a/src/ini.rs b/src/ini.rs index fef5346..a5384c1 100644 --- a/src/ini.rs +++ b/src/ini.rs @@ -1230,7 +1230,14 @@ impl Ini { } else { section.to_lowercase() }; - self.map.remove(§ion) + #[cfg(not(feature = "indexmap"))] + { + self.map.remove(§ion) + } + #[cfg(feature = "indexmap")] + { + self.map.swap_remove(§ion) + } } ///Removes a key from a section in the hashmap, returning the value attached to the key if it was previously in the map. @@ -1250,7 +1257,14 @@ impl Ini { ///Returns `Some(Option)` if the value exists or else, `None`. pub fn remove_key(&mut self, section: &str, key: &str) -> Option> { let (section, key) = self.autocase(section, key); - self.map.get_mut(§ion)?.remove(&key) + #[cfg(not(feature = "indexmap"))] + { + self.map.get_mut(§ion)?.remove(&key) + } + #[cfg(feature = "indexmap")] + { + self.map.get_mut(§ion)?.swap_remove(&key) + } } }