-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make clippy happy + a few more cleanups #285
Merged
Merged
Commits on Dec 13, 2021
-
Make clippy happy + a few more cleanups
Following up from rust-lang#283 * Address all remaining clippy issues * Switch `assert!(a==b)` to `assert_eq!(a, b)` * `MAX` instead of `max_value()` > warning: this seems like a manual implementation of the non-exhaustive pattern > --> src/mem.rs:46:1 > | > 46 | pub enum FlushCompress { > | ^--------------------- > | | > | _help: add the attribute: `#[non_exhaustive] pub enum FlushCompress` > | | > 47 | | /// A typical parameter for passing to compression/decompression functions, > 48 | | /// this indicates that the underlying stream to decide how much data to > 49 | | /// accumulate before producing output in order to maximize compression. > ... | > 85 | | _Nonexhaustive, > 86 | | } > | |_^ > | > = note: `#[warn(clippy::manual_non_exhaustive)]` on by default > help: remove this variant > --> src/mem.rs:85:5 > | > 85 | _Nonexhaustive, > | ^^^^^^^^^^^^^^ > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive > > warning: this seems like a manual implementation of the non-exhaustive pattern > --> src/mem.rs:91:1 > | > 91 | pub enum FlushDecompress { > | ^----------------------- > | | > | _help: add the attribute: `#[non_exhaustive] pub enum FlushDecompress` > | | > 92 | | /// A typical parameter for passing to compression/decompression functions, > 93 | | /// this indicates that the underlying stream to decide how much data to > 94 | | /// accumulate before producing output in order to maximize compression. > ... | > 113 | | _Nonexhaustive, > 114 | | } > | |_^ > | > help: remove this variant > --> src/mem.rs:113:5 > | > 113 | _Nonexhaustive, > | ^^^^^^^^^^^^^^ > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive > > warning: the operation is ineffective. Consider reducing it to `(header[4] as u32)` > --> src/gz/bufread.rs:58:39 > | > 58 | r.part.header.mtime = ((header[4] as u32) << 0) > | ^^^^^^^^^^^^^^^^^^^^^^^^^ > | > = note: `#[warn(clippy::identity_op)]` on by default > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead > --> src/gz/bufread.rs:197:13 > | > 197 | let ref arr = [ > | ^^^^^^^ > | > = note: `#[warn(clippy::toplevel_ref_arg)]` on by default > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg > help: try > | > 197 ~ let arr = &[ > 198 + (crc.sum() >> 0) as u8, > 199 + (crc.sum() >> 8) as u8, > 200 + (crc.sum() >> 16) as u8, > 201 + (crc.sum() >> 24) as u8, > 202 + (crc.amount() >> 0) as u8, > ... > > warning: the operation is ineffective. Consider reducing it to `crc.sum()` > --> src/gz/bufread.rs:198:13 > | > 198 | (crc.sum() >> 0) as u8, > | ^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `crc.amount()` > --> src/gz/bufread.rs:202:13 > | > 202 | (crc.amount() >> 0) as u8, > | ^^^^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `(buf[0] as u32)` > --> src/gz/bufread.rs:233:15 > | > 233 | let crc = ((buf[0] as u32) << 0) > | ^^^^^^^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `(buf[4] as u32)` > --> src/gz/bufread.rs:237:15 > | > 237 | let amt = ((buf[4] as u32) << 0) > | ^^^^^^^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `sum` > --> src/gz/write.rs:102:17 > | > 102 | (sum >> 0) as u8, > | ^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `amt` > --> src/gz/write.rs:106:17 > | > 106 | (amt >> 0) as u8, > | ^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `(self.crc_bytes[0] as u32)` > --> src/gz/write.rs:307:19 > | > 307 | let crc = ((self.crc_bytes[0] as u32) << 0) > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `(self.crc_bytes[4] as u32)` > --> src/gz/write.rs:311:19 > | > 311 | let amt = ((self.crc_bytes[4] as u32) << 0) > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: the operation is ineffective. Consider reducing it to `v.len()` > --> src/gz/mod.rs:215:25 > | > 215 | header.push((v.len() >> 0) as u8); > | ^^^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: you are using an explicit closure for copying elements > --> src/gz/mod.rs:221:27 > | > 221 | header.extend(filename.as_bytes_with_nul().iter().map(|x| *x)); > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `filename.as_bytes_with_nul().iter().copied()` > | > = note: `#[warn(clippy::map_clone)]` on by default > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone > > warning: you are using an explicit closure for copying elements > --> src/gz/mod.rs:225:27 > | > 225 | header.extend(comment.as_bytes_with_nul().iter().map(|x| *x)); > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `comment.as_bytes_with_nul().iter().copied()` > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone > > warning: the operation is ineffective. Consider reducing it to `mtime` > --> src/gz/mod.rs:231:21 > | > 231 | header[4] = (mtime >> 0) as u8; > | ^^^^^^^^^^^^ > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op > > warning: use of `offset` with a `usize` casted to an `isize` > --> src/mem.rs:365:27 > | > 365 | let ptr = output.as_mut_ptr().offset(len as isize); > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `output.as_mut_ptr().add(len)` > | > = note: `#[warn(clippy::ptr_offset_with_cast)]` on by default > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast > > warning: use of `offset` with a `usize` casted to an `isize` > --> src/mem.rs:506:27 > | > 506 | let ptr = output.as_mut_ptr().offset(len as isize); > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `output.as_mut_ptr().add(len)` > | > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast > > warning: `flate2` (lib) generated 18 warnings > Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Configuration menu - View commit details
-
Copy full SHA for ea89049 - Browse repository at this point
Copy the full SHA ea89049View commit details
Commits on Dec 14, 2021
-
Configuration menu - View commit details
-
Copy full SHA for f361ad7 - Browse repository at this point
Copy the full SHA f361ad7View commit details
Commits on Dec 22, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 4a08387 - Browse repository at this point
Copy the full SHA 4a08387View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2665fab - Browse repository at this point
Copy the full SHA 2665fabView commit details -
Configuration menu - View commit details
-
Copy full SHA for 183d413 - Browse repository at this point
Copy the full SHA 183d413View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.