Skip to content

Commit

Permalink
Merge #447
Browse files Browse the repository at this point in the history
447: Fix nightly clippy warnings r=jonasbb a=jonasbb

bors merge

Co-authored-by: Jonas Bushart <jonas@bushart.org>
  • Loading branch information
bors[bot] and jonasbb authored May 9, 2022
2 parents aa87968 + e7579cc commit 4c12d73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion serde_with/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub struct DeserializeAsWrap<T, U> {
marker: PhantomData<U>,
}

impl<'de, T, U> DeserializeAsWrap<T, U> {
impl<T, U> DeserializeAsWrap<T, U> {
/// Return the inner value of type `T`.
pub fn into_inner(self) -> T {
self.value
Expand Down
6 changes: 3 additions & 3 deletions serde_with/src/ser/const_arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ macro_rules! tuple_seq_as_map_impl_intern {
tuple_seq_as_map_impl_intern!([(K, V); N], BTreeMap<K, V>);
tuple_seq_as_map_impl_intern!([(K, V); N], HashMap<K, V>);

impl<'a, const N: usize> SerializeAs<[u8; N]> for Bytes {
impl<const N: usize> SerializeAs<[u8; N]> for Bytes {
fn serialize_as<S>(bytes: &[u8; N], serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -53,7 +53,7 @@ impl<'a, const N: usize> SerializeAs<[u8; N]> for Bytes {
}
}

impl<'a, const N: usize> SerializeAs<&[u8; N]> for Bytes {
impl<const N: usize> SerializeAs<&[u8; N]> for Bytes {
fn serialize_as<S>(bytes: &&[u8; N], serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -62,7 +62,7 @@ impl<'a, const N: usize> SerializeAs<&[u8; N]> for Bytes {
}
}

impl<'a, const N: usize> SerializeAs<Box<[u8; N]>> for Bytes {
impl<const N: usize> SerializeAs<Box<[u8; N]>> for Bytes {
fn serialize_as<S>(bytes: &Box<[u8; N]>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
8 changes: 3 additions & 5 deletions serde_with/tests/serde_as/enum_map.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use super::*;
use serde_test::Configure;
use serde_with::EnumMap;
use std::fmt::Write as _;
use std::net::IpAddr;
use std::str::FromStr;

fn bytes_debug_readable(bytes: &[u8]) -> String {
let mut result = String::with_capacity(bytes.len() * 2);
for &byte in bytes {
match byte {
control if control < 0x20 || control == 0x7f => {
result.push_str(&format!("\\x{:02x}", byte));
}
non_ascii if non_ascii > 0x7f => {
result.push_str(&format!("\\x{:02x}", byte));
non_printable if !(0x20..0x7f).contains(&non_printable) => {
write!(result, "\\x{:02x}", byte).unwrap();
}
b'\\' => result.push_str("\\\\"),
_ => {
Expand Down

0 comments on commit 4c12d73

Please sign in to comment.