-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Improved code with clippy #124287
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
Improved code with clippy #124287
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (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 (
|
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
II have also changed some tooling code with clippy. I have made the following changes: Removed question mark operator on line 24 of src/tools/build_helper/src/git.rs Removed a needless borrow implicitly performed by the compiler on line 147 of src/tools/clippy/declare_clippy_lint/src/lib.rs Removed a needless borrow on line 54 of src/tools/miropt-test-tools/src/lib.rs Replaced match expression with matches! macro on line 54 and 61 of src/tool/rustfmt/config_proc_macro/src/attrs.rs Removed a needless borrow on lines 78 and 153 of src/tools/rustfmt/config_proc_macro/src/item_enum.rs Replaced match expression with an equality check on line 16 of src/tools/rustfmt/config_proc_macro/src/utils.rs Replaced argument slices to arrays on lines 43 and 51 of src/tools/rustfmt/build.rs |
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.
The rustfmt team prefers these kinds of changes be made directly to rustfmt instead of here in the rust-lang/rust repo.
src/tools/rustfmt/build.rs
Outdated
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.
Please revert these changes and open a PR directly to https://github.com/rust-lang/rustfmt for these kinds of changes.
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.
(where "these changes" means anything in clippy or rustfmt)
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.
@41Leahcim to clarify, some of the tools in rust-lang/rust
are developed in their own repos, and it's best to avoid making non essential, lint related changes here. Instead, prefer to open PRs directly to the respective repos.
Please revert all changes made to src/tools/rustfmt
and src/tools/clippy
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.
Thanks for telling me. I'm pretty new to open source. That's why I'm still making stupid mistakes like this and why my pull request doesn't add anything special.
I have reverted the changes to all tools. Only the changes to the compiler are left. With only 7 lines changed, it's a pretty much worthless pull request. So I would understand it if it won't get merged. |
It's alright. I will approve it once you've squashed the commits into one. |
Note that your two long comments describing the changes in prose are now outdated. |
I have merged my commits |
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#124287 (Improved code with clippy) - rust-lang#124326 (tests: remove few ignore-stage2) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124287 - 41Leahcim:master, r=fmease Improved code with clippy I haven't used the bootstrapped compiler, but I think I have made some improvements using clippy. I have already made the following changes to the compiler: Replaced `self.first().is_digit(10)` with `self.first().is_ascii_digit()` on lines 633, 664, and 680 of compiler/rust_lexer/src/lib.rs. Removed unnecessary cast on line 262 of compiler/rustc_lexer/src/unescape.rs Replaced ok_or_else with ok_or on line 303 of compiler/rustc_lexer/src/unescape.rs Replaced `!std::env::var("RUSTC_BOOTSTRAP").is_ok()` with `std::env::var("RUSTC_BOOTSTRAP").is_err()` on line 4 of compiler/rustc_macros/build.rs Removed needless borrow for generic argument `env`on line 53 of compiler/rust_llvm/build.rs
I haven't used the bootstrapped compiler, but I think I have made some improvements using clippy. I have already made the following changes to the compiler:
Replaced
self.first().is_digit(10)
withself.first().is_ascii_digit()
on lines 633, 664, and 680 of compiler/rust_lexer/src/lib.rs.Removed unnecessary cast on line 262 of compiler/rustc_lexer/src/unescape.rs
Replaced ok_or_else with ok_or on line 303 of compiler/rustc_lexer/src/unescape.rs
Replaced
!std::env::var("RUSTC_BOOTSTRAP").is_ok()
withstd::env::var("RUSTC_BOOTSTRAP").is_err()
on line 4 of compiler/rustc_macros/build.rsRemoved needless borrow for generic argument
env
on line 53 of compiler/rust_llvm/build.rs