Skip to content

Commit be9e168

Browse files
committed
Fix clippy lints for 1.78
1 parent fcadc2a commit be9e168

7 files changed

Lines changed: 25 additions & 17 deletions

File tree

clippy.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
msrv = "1.64.0"
2-
blacklisted-names = []

fuzz/fuzz_targets/bench/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ struct ArbitraryPrettyConfig {
117117
/// Enumerate array items in comments
118118
enumerate_arrays: bool,
119119
#[arbitrary(with = arbitrary_ron_extensions)]
120-
/// Enable extensions. Only configures 'implicit_some',
121-
/// 'unwrap_newtypes', and 'unwrap_variant_newtypes' for now.
120+
/// Enable extensions. Only configures `implicit_some`,
121+
/// `unwrap_newtypes`, and `unwrap_variant_newtypes` for now.
122122
extensions: Extensions,
123123
/// Enable compact arrays, which do not insert new lines and indentation
124124
/// between the elements of an array

src/de/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ impl<'de> Deserializer<'de> {
6363
Ok(deserializer)
6464
}
6565

66+
// FIXME: panic is not actually possible, remove once utf8_chunks is stabilized
67+
#[allow(clippy::missing_panics_doc)]
6668
pub fn from_bytes_with_options(input: &'de [u8], options: &Options) -> SpannedResult<Self> {
6769
let err = match str::from_utf8(input) {
6870
Ok(input) => return Self::from_str_with_options(input, options),

src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ impl Options {
121121
/// A convenience function for building a deserializer
122122
/// and deserializing a value of type `T` from a reader
123123
/// and a seed.
124+
// FIXME: panic is not actually possible, remove once utf8_chunks is stabilized
125+
#[allow(clippy::missing_panics_doc)]
124126
pub fn from_reader_seed<R, S, T>(&self, mut rdr: R, seed: S) -> SpannedResult<T>
125127
where
126128
R: io::Read,

src/parse.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'a> Parser<'a> {
192192
Ok(false)
193193
}
194194
})
195-
.fold(Ok(true), |acc, x| acc.and_then(|val| x.map(|x| x && val)))
195+
.try_fold(true, |acc, x| x.map(|x| x && acc))
196196
}
197197

198198
pub fn expect_char(&mut self, expected: char, error: Error) -> Result<()> {
@@ -256,10 +256,10 @@ impl<'a> Parser<'a> {
256256

257257
fn parse_integer<T: Num>(&mut self, sign: i8) -> Result<T> {
258258
let base = match () {
259-
_ if self.consume_str("0b") => 2,
260-
_ if self.consume_str("0o") => 8,
261-
_ if self.consume_str("0x") => 16,
262-
_ => 10,
259+
() if self.consume_str("0b") => 2,
260+
() if self.consume_str("0o") => 8,
261+
() if self.consume_str("0x") => 16,
262+
() => 10,
263263
};
264264

265265
let num_bytes = self.next_chars_while_len(is_int_char);
@@ -324,7 +324,7 @@ impl<'a> Parser<'a> {
324324

325325
let num_bytes = self.next_chars_while_len(is_int_char);
326326

327-
if self.src()[num_bytes..].starts_with(&['i', 'u']) {
327+
if self.src()[num_bytes..].starts_with(['i', 'u']) {
328328
let int_cursor = self.cursor;
329329
self.advance_bytes(num_bytes);
330330

src/ser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ pub struct PrettyConfig {
9292
pub separate_tuple_members: bool,
9393
/// Enumerate array items in comments
9494
pub enumerate_arrays: bool,
95-
/// Enable extensions. Only configures 'implicit_some',
96-
/// 'unwrap_newtypes', and 'unwrap_variant_newtypes' for now.
95+
/// Enable extensions. Only configures `implicit_some`,
96+
/// `unwrap_newtypes`, and `unwrap_variant_newtypes` for now.
9797
pub extensions: Extensions,
9898
/// Enable compact arrays, which do not insert new lines and indentation
9999
/// between the elements of an array

src/value/map.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,32 @@ impl Map {
7373
}
7474

7575
/// Iterate all key-value pairs.
76-
pub fn iter(&self) -> impl Iterator<Item = (&Value, &Value)> + DoubleEndedIterator {
76+
#[must_use]
77+
pub fn iter(&self) -> impl DoubleEndedIterator<Item = (&Value, &Value)> {
7778
self.0.iter()
7879
}
7980

8081
/// Iterate all key-value pairs mutably.
81-
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Value, &mut Value)> + DoubleEndedIterator {
82+
#[must_use]
83+
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = (&Value, &mut Value)> {
8284
self.0.iter_mut()
8385
}
8486

8587
/// Iterate all keys.
86-
pub fn keys(&self) -> impl Iterator<Item = &Value> + DoubleEndedIterator {
88+
#[must_use]
89+
pub fn keys(&self) -> impl DoubleEndedIterator<Item = &Value> {
8790
self.0.keys()
8891
}
8992

9093
/// Iterate all values.
91-
pub fn values(&self) -> impl Iterator<Item = &Value> + DoubleEndedIterator {
94+
#[must_use]
95+
pub fn values(&self) -> impl DoubleEndedIterator<Item = &Value> {
9296
self.0.values()
9397
}
9498

9599
/// Iterate all values mutably.
96-
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut Value> + DoubleEndedIterator {
100+
#[must_use]
101+
pub fn values_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Value> {
97102
self.0.values_mut()
98103
}
99104

@@ -158,7 +163,7 @@ impl Eq for Map {}
158163

159164
impl PartialOrd for Map {
160165
fn partial_cmp(&self, other: &Map) -> Option<Ordering> {
161-
self.iter().partial_cmp(other.iter())
166+
Some(self.cmp(other))
162167
}
163168
}
164169

0 commit comments

Comments
 (0)