From a2cde0698f7405c1628942460f3491d5dfa54c55 Mon Sep 17 00:00:00 2001 From: Ed Barnard Date: Sat, 23 Mar 2024 19:03:26 +0000 Subject: [PATCH] Fix new warnings from nightly Rust --- src/dictionary.rs | 5 ++--- src/error.rs | 10 ++++++++-- src/stream/binary_reader.rs | 1 - src/stream/xml_reader.rs | 2 +- src/value.rs | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/dictionary.rs b/src/dictionary.rs index d3d43a2..8448ee1 100644 --- a/src/dictionary.rs +++ b/src/dictionary.rs @@ -7,7 +7,6 @@ use indexmap::{map, IndexMap}; use std::{ fmt::{self, Debug}, - iter::FromIterator, ops, }; @@ -67,7 +66,7 @@ impl Dictionary { /// in the dictionary. #[inline] pub fn remove(&mut self, key: &str) -> Option { - self.map.remove(key) + self.map.swap_remove(key) } /// Scan through each key-value pair in the map and keep those where the @@ -540,7 +539,7 @@ impl<'a> OccupiedEntry<'a> { /// ``` #[inline] pub fn remove(self) -> Value { - self.occupied.remove() + self.occupied.swap_remove() } } diff --git a/src/error.rs b/src/error.rs index 824fce9..dca269a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -61,11 +61,17 @@ pub(crate) enum ErrorKind { InfiniteOrNanDate, InvalidUtf8String, InvalidUtf16String, - UnknownObjectType(u8), + UnknownObjectType( + // Used by the `Debug` implementation. + #[allow(dead_code)] u8, + ), Io(io::Error), #[cfg(feature = "serde")] - Serde(String), + Serde( + // Used by the `Debug` implementation. + #[allow(dead_code)] String, + ), } #[derive(Debug, Clone, Copy)] diff --git a/src/stream/binary_reader.rs b/src/stream/binary_reader.rs index 60db2e9..0e4cb98 100644 --- a/src/stream/binary_reader.rs +++ b/src/stream/binary_reader.rs @@ -412,7 +412,6 @@ mod tests { use std::fs::File; use super::*; - use crate::{stream::Event, Uid}; #[test] fn streaming_parser() { diff --git a/src/stream/xml_reader.rs b/src/stream/xml_reader.rs index 5375d2b..d7fa256 100644 --- a/src/stream/xml_reader.rs +++ b/src/stream/xml_reader.rs @@ -211,7 +211,7 @@ mod tests { use std::fs::File; use super::*; - use crate::stream::Event::{self, *}; + use crate::stream::Event::*; #[test] fn streaming_parser() { diff --git a/src/value.rs b/src/value.rs index 1ff8ba3..f7d21d4 100644 --- a/src/value.rs +++ b/src/value.rs @@ -770,7 +770,7 @@ mod tests { use std::time::SystemTime; use super::*; - use crate::{stream::Event::*, Date, Dictionary, Value}; + use crate::{stream::Event::*, Date}; #[test] fn value_accessors() {