From 7f2186ef75947e456cba122f511f2f5725e3eef6 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 27 Oct 2019 08:13:12 -0400 Subject: clippy --- src/creator.rs | 2 +- src/lib.rs | 5 +++++ src/parser.rs | 13 +++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/creator.rs b/src/creator.rs index c0f9b76..fac57bb 100644 --- a/src/creator.rs +++ b/src/creator.rs @@ -12,7 +12,7 @@ pub struct Creator { impl Creator { /// Creates a new `Creator` instance. pub fn new() -> Self { - Default::default() + Self::default() } /// Returns a new `Frame` object containing the given data. diff --git a/src/lib.rs b/src/lib.rs index 1de8daa..3f8e745 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,11 @@ //! `Parser` and `Creator` can be used to read and write files manually, and //! `Reader` and `Writer` are helpers to provide a nicer API for asynchronous //! applications using `tokio`. + +#![warn(clippy::pedantic)] +#![warn(clippy::nursery)] +#![allow(clippy::missing_const_for_fn)] + mod creator; pub use creator::Creator; mod error; diff --git a/src/parser.rs b/src/parser.rs index a473931..02f2178 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -34,7 +34,7 @@ pub struct Parser { impl Parser { /// Create a new `Parser`. pub fn new() -> Self { - Default::default() + Self::default() } /// Add more bytes to the internal buffer. @@ -61,11 +61,12 @@ impl Parser { let secs4 = self.reading.pop_front().unwrap(); let secs = u32::from_le_bytes([secs1, secs2, secs3, secs4]); - let usecs1 = self.reading.pop_front().unwrap(); - let usecs2 = self.reading.pop_front().unwrap(); - let usecs3 = self.reading.pop_front().unwrap(); - let usecs4 = self.reading.pop_front().unwrap(); - let micros = u32::from_le_bytes([usecs1, usecs2, usecs3, usecs4]); + let micros1 = self.reading.pop_front().unwrap(); + let micros2 = self.reading.pop_front().unwrap(); + let micros3 = self.reading.pop_front().unwrap(); + let micros4 = self.reading.pop_front().unwrap(); + let micros = + u32::from_le_bytes([micros1, micros2, micros3, micros4]); let len1 = self.reading.pop_front().unwrap(); let len2 = self.reading.pop_front().unwrap(); -- cgit v1.2.3-54-g00ecf