Skip to content

Commit e17eddd

Browse files
mfelscheLicenser
authored andcommitted
Fix 1.83 clippy complaints
1 parent d3273d5 commit e17eddd

5 files changed

Lines changed: 18 additions & 9 deletions

File tree

simd-json-derive-int/src/deserialize/struct/named.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ pub(crate) fn derive(
8989
}
9090
)*
9191
__unknown_field if #deny_unknown_fields => {
92-
return Err(::simd_json_derive::de::Error::UnknownField(__unknown_field.to_string(), &[ #(#value_keys,)* #(#option_keys,)* ]));
92+
return Err(::simd_json_derive::de::Error::UnknownField {
93+
unknown_field: __unknown_field.to_string(),
94+
possible_field_names: &[ #(#value_keys,)* #(#option_keys,)* ]
95+
});
9396
}
9497
_ => {
9598
// ignore unknown field

src/de.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ pub enum Error {
2626
#[error("missing field: `{0}`")]
2727
MissingField(&'static str),
2828
/// Unexpected field
29-
#[error("unknown field `{0}`, expected one of {}",expected(.1))]
30-
UnknownField(String, &'static [&'static str]),
29+
#[error(
30+
"unknown field `{unknown_field}`, expected one of {}",
31+
expected(possible_field_names)
32+
)]
33+
UnknownField {
34+
unknown_field: String,
35+
possible_field_names: &'static [&'static str],
36+
},
3137
#[error("unnamed enum field `{0}` is not an array")]
3238
FieldNotAnArray(&'static str),
3339
#[error("unknwon enum variant `{0}`")]

src/impls/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct Guard<'a, T, const N: usize> {
88
pub initialized: usize,
99
}
1010

11-
impl<'a, T, const N: usize> Guard<'a, T, N> {
11+
impl<T, const N: usize> Guard<'_, T, N> {
1212
#[inline]
1313
pub unsafe fn push_unchecked(&mut self, item: T) {
1414
// SAFETY: If `initialized` was correct before and the caller does not
@@ -21,7 +21,7 @@ impl<'a, T, const N: usize> Guard<'a, T, N> {
2121
}
2222
}
2323

24-
impl<'a, T, const N: usize> Drop for Guard<'a, T, N> {
24+
impl<T, const N: usize> Drop for Guard<'_, T, N> {
2525
fn drop(&mut self) {
2626
debug_assert!(self.initialized <= N);
2727

src/impls/chrono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<Tz: TimeZone> Serialize for DateTime<Tz> {
1616
inner: &'a D,
1717
}
1818

19-
impl<'a, D: fmt::Debug> fmt::Display for FormatWrapped<'a, D> {
19+
impl<D: fmt::Debug> fmt::Display for FormatWrapped<'_, D> {
2020
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2121
self.inner.fmt(f)
2222
}

src/impls/simdjson.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl Serialize for OwnedValue {
1010
self.write(writer)
1111
}
1212
}
13-
impl<'value> Serialize for BorrowedValue<'value> {
13+
impl Serialize for BorrowedValue<'_> {
1414
fn json_write<W>(&self, writer: &mut W) -> crate::Result
1515
where
1616
W: std::io::Write,
@@ -21,7 +21,7 @@ impl<'value> Serialize for BorrowedValue<'value> {
2121

2222
struct OwnedDeser<'input, 'tape>(&'tape mut crate::Tape<'input>);
2323

24-
impl<'input, 'tape> OwnedDeser<'input, 'tape> {
24+
impl OwnedDeser<'_, '_> {
2525
#[inline(always)]
2626
fn parse(&mut self) -> OwnedValue {
2727
match self.0.next() {
@@ -75,7 +75,7 @@ impl<'input> Deserialize<'input> for OwnedValue {
7575

7676
struct BorrowedDeser<'input, 'tape>(&'tape mut crate::Tape<'input>);
7777

78-
impl<'input, 'tape> BorrowedDeser<'input, 'tape> {
78+
impl<'input> BorrowedDeser<'input, '_> {
7979
#[inline(always)]
8080
fn parse(&mut self) -> BorrowedValue<'input> {
8181
match self.0.next() {

0 commit comments

Comments
 (0)