Skip to content

Commit

Permalink
Merge pull request #807 from epage/clippy
Browse files Browse the repository at this point in the history
style: Make clippy happy
  • Loading branch information
epage authored Nov 4, 2024
2 parents 17b0c36 + 36fb1ef commit d93f0e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions crates/toml/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ impl Map<String, Value> {
String: Borrow<Q>,
Q: Ord + Eq + Hash + ?Sized,
{
self.map.remove(key)
#[cfg(not(feature = "preserve_order"))]
{
self.map.remove(key)
}
#[cfg(feature = "preserve_order")]
{
self.map.shift_remove(key)
}
}

/// Retains only the elements specified by the `keep` predicate.
Expand Down Expand Up @@ -501,7 +508,14 @@ impl<'a> OccupiedEntry<'a> {
/// Takes the value of the entry out of the map, and returns it.
#[inline]
pub fn remove(self) -> Value {
self.occupied.remove()
#[cfg(not(feature = "preserve_order"))]
{
self.occupied.remove()
}
#[cfg(feature = "preserve_order")]
{
self.occupied.shift_remove()
}
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/toml_edit/src/ser/map.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::{Error, KeySerializer, SerializeValueArray, ValueSerializer};

#[doc(hidden)]
#[allow(clippy::large_enum_variant)]
pub enum SerializeMap {
Datetime(SerializeDatetime),
Table(SerializeInlineTable),
Expand Down

0 comments on commit d93f0e6

Please sign in to comment.