Skip to content

Commit 671c19c

Browse files
committed
rm: rm deprecated function for indexmap
1 parent 933db86 commit 671c19c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/ini.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,14 @@ impl Ini {
12301230
} else {
12311231
section.to_lowercase()
12321232
};
1233-
self.map.remove(&section)
1233+
#[cfg(not(feature = "indexmap"))]
1234+
{
1235+
self.map.remove(&section)
1236+
}
1237+
#[cfg(feature = "indexmap")]
1238+
{
1239+
self.map.swap_remove(&section)
1240+
}
12341241
}
12351242

12361243
///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 {
12501257
///Returns `Some(Option<String>)` if the value exists or else, `None`.
12511258
pub fn remove_key(&mut self, section: &str, key: &str) -> Option<Option<String>> {
12521259
let (section, key) = self.autocase(section, key);
1253-
self.map.get_mut(&section)?.remove(&key)
1260+
#[cfg(not(feature = "indexmap"))]
1261+
{
1262+
self.map.get_mut(&section)?.remove(&key)
1263+
}
1264+
#[cfg(feature = "indexmap")]
1265+
{
1266+
self.map.get_mut(&section)?.swap_remove(&key)
1267+
}
12541268
}
12551269
}
12561270

0 commit comments

Comments
 (0)