-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add lint to check manual pattern char comparison #12849
Add lint to check manual pattern char comparison #12849
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Alexendoo (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
I have applied all the suggestions. Thank you for the very deep explanations as a first contributor it's very appreciable. I learnt a lot of things in Clippy and it motivate me to continue to contribute ! |
@Alexendoo thank you for the heart, that's kind ! If there anything I need to do for this PR or I need to wait ? I don't want to be rude, it's because I'm not very familiar with the process so I prefer to ask |
I plan to do another read through of it soon, then after that I'll create a final comment period thread on Zulip for others to weigh in |
☔ The latest upstream changes (presumably #12815) made this pull request unmergeable. Please resolve the merge conflicts. |
06aae81
to
9939549
Compare
I addressed all the comments. Furthermore I saw that last time I forget to push modification on function Everything should be fine now |
48f9915
to
6dbcf14
Compare
☔ The latest upstream changes (presumably #12915) made this pull request unmergeable. Please resolve the merge conflicts. |
6dbcf14
to
73adcce
Compare
If you could squash the commits I think this is ready to merge, the FCP has been running long enough without issue |
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
…ith single_char_pattern lint
c658805
to
c86b19f
Compare
@Alexendoo Seems ok to me. (I'm not very confident with my git skills 😆 ) |
Yep, looks great thanks! @bors r+ |
…lexendoo Add lint to check manual pattern char comparison This PR adds a new lint asked in #12490 This lint catches manual char comparison in pattern of string functions and propose to use `char` or array of `char` instead. As it's my first contribution i'm not feeling very safe about not matching too much or missing some cases. Thanks in advance for taking time to review and propose feedback !
💔 Test failed - checks-action_test |
@bors retry |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
@Alexendoo I want to make you a special thanks for being so nice an pedagogy for this PR, loved it. You are really kind ! |
Thank you! Congrats on the first contribution |
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
Summary: Upgrading Rust from `1.80.1` to `1.81.0` ([release notes](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)) with the following changes affecting `fbsource`: * Feature stabilizations: * `io_slice_advance` ([#62726](rust-lang/rust#62726)) * `panic_info_message` ([#66745](rust-lang/rust#66745)) * `fs_try_exists` ([#83186](rust-lang/rust#83186)) * `lint_reasons` ([#120924](rust-lang/rust#120924)) * `duration_abs_diff` ([#117618](rust-lang/rust#117618)) * `effects` ([#102090](rust-lang/rust#102090)) * New `clippy` lints: * `manual_inspect` ([#12287](rust-lang/rust-clippy#12287)) * `manual_pattern_char_comparison` ([#12849](rust-lang/rust-clippy#12849)) * Other: * `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` became a deny-by-default lint ([#126881](rust-lang/rust#126881) & [#123748](rust-lang/rust#123748)) * Changes to `stringify!` introducing whitespaces between some tokens ([#125174](rust-lang/rust#125174)) * `format!` is now marked with a `must_use` hint ([#127355](rust-lang/rust#127355)) ignore-conflict-markers Reviewed By: zertosh, dtolnay Differential Revision: D63864870 fbshipit-source-id: c8d61f3e9483ec709c8116514cfb030c883ec262
This PR adds a new lint asked in #12490
This lint catches manual char comparison in pattern of string functions and propose to use
char
or array ofchar
instead.As it's my first contribution i'm not feeling very safe about not matching too much or missing some cases.
Thanks in advance for taking time to review and propose feedback !
changelog: new lint [
manual_pattern_char_comparison
]