-
Notifications
You must be signed in to change notification settings - Fork 525
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
Enable clippy lints up to Rust 1.48 #901
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes clippy warning: ``` warning: this seems like a manual implementation of the non-exhaustive pattern --> src/format/parsed.rs:24:1 | 24 | pub struct Parsed { | ^---------------- | | | _help: add the attribute: `#[non_exhaustive] pub struct Parsed` | | 25 | | /// Year. 26 | | /// 27 | | /// This can be negative unlike [`year_div_100`](#structfield.year_div_100) ... | 107 | | _dummy: (), 108 | | } | |_^ | = note: `#[warn(clippy::manual_non_exhaustive)]` on by default help: remove this field --> src/format/parsed.rs:107:5 | 107 | _dummy: (), | ^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive ```
Fixes clippy warning: ``` warning: this seems like a manual implementation of the non-exhaustive pattern --> src/format/mod.rs:360:1 | 360 | pub enum ParseErrorKind { | ^---------------------- | | | _help: add the attribute: `#[non_exhaustive] pub enum ParseErrorKind` | | 361 | | /// Given field is out of permitted range. 362 | | OutOfRange, 363 | | ... | 391 | | __Nonexhaustive, 392 | | } | |_^ | help: remove this variant --> src/format/mod.rs:391:5 | 391 | __Nonexhaustive, | ^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive ```
Fixes clippy warning: ``` warning: match expression looks like `matches!` macro --> src/format/scan.rs:316:24 | 316 | .position(|&c| match c { | ________________________^ 317 | | b'a'..=b'z' | b'A'..=b'Z' => false, 318 | | _ => true, 319 | | }) | |_________^ help: try this: `!matches!(c, b'a'..=b'z' | b'A'..=b'Z')` | = note: `#[warn(clippy::match_like_matches_macro)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro ```
Potentially saves one char boundary check.
Fixes two clippy warnings: ``` warning: called `.as_ref().map(|s| s.as_str())` on an Option value. This can be done more directly by calling `env_tz.as_deref()` instead --> src/offset/local/unix.rs:91:23 | 91 | let env_ref = env_tz.as_ref().map(|s| s.as_str()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `env_tz.as_deref()` | = note: `#[warn(clippy::option_as_ref_deref)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref warning: called `.as_ref().map(|s| s.as_str())` on an Option value. This can be done more directly by calling `env_tz.as_deref()` instead --> src/offset/local/unix.rs:117:31 | 117 | let env_ref = env_tz.as_ref().map(|s| s.as_str()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `env_tz.as_deref()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref ```
djc
approved these changes
Nov 29, 2022
Thanks! |
iArmanKarimi
approved these changes
Dec 15, 2022
Added one more fix for a clippy warning that shows up since Rust 1.66. |
Fixes clippy warning: ``` warning: casting to the same type is unnecessary (`u32` -> `u32`) --> src/offset/utc.rs:71:69 | 71 | NaiveDateTime::from_timestamp_opt(now.as_secs() as i64, now.subsec_nanos() as u32) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `now.subsec_nanos()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `#[warn(clippy::unnecessary_cast)]` on by default ```
The MSRV was recently raised in [1], but clippy was missed. [1] chronotope@95532db
Gentle ping. |
@esheppa going to merge this, please feel free to review post-merge. |
Thanks, and sorry for the delay! |
esheppa
reviewed
Feb 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Enables clippy to show lints applicable for Rust versions 1.39..=1.48 and fixes all resulting warnings.