-
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
Makes clippy-driver check for --sysroot in arg files #12203
Makes clippy-driver check for --sysroot in arg files #12203
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @xFrednet (or someone else) soon. 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 (
|
@vorner Let me know if you have any questions. I hope to land this change to unblock rules_rust's users. |
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.
Great catch! Please add a test case for this to the .github/driver.sh
script. Don't create an actual arg file in the repo please, but just create one in the script with echo "--sysroot bar" > arg_file.txt
.
r? @flip1995 |
@flip1995 Thanks for the review. I addressed your comment. PTAL. |
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.
You have a few more warnings in your code (unused imports). Also make sure to run cargo dev dogfood
locally and make sure that succeeds. That command runs Clippy on Clippy itself.
117b052
to
aa3490a
Compare
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.
`cargo dev dogfood` shows these errors:
error: unneeded `return` statement
--> src/driver.rs:210:13
|
210 | return false;
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `-D clippy::needless-return` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::needless_return)]`
help: remove `return`
|
210 - return false;
210 + false
|
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/driver.rs:194:26
|
194 | if arg_value(&args, "--sysroot", |_| true).is_some() {
| ^^^^^ help: change this to: `args`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `-D clippy::needless-borrow` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::needless_borrow)]`
error: single-character string constant used as pattern
--> src/driver.rs:201:63
|
201 | if let Some(arg_file_path) = arg.strip_prefix("@") {
| ^^^ help: consider using a `char`: `'@'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
= note: `-D clippy::single-char-pattern` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::single_char_pattern)]`
error: redundant closure
--> src/driver.rs:203:80
|
203 | let split_arg_file: Vec<String> = arg_file.lines().map(|s| s.to_string()).collect();
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D clippy::pedantic`
= help: to override `-D clippy::pedantic` add `#[allow(clippy::redundant_closure_for_method_calls)]`
Please fix them and this should be ready to go.
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.
LGTM!
Can you please squash your commits into one? After that, this is ready to go.
I'm just curious. Why don't we squash the commits upon merging instead? https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests |
166e671
to
c7722c4
Compare
c7722c4
to
73706e8
Compare
@flip1995 PTAL |
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This removes a workaround that was necessary in the past to work around an issue in clippy. The issue is now fixed in clippy, and our clippy version is recent enough to include the fix. See also: * bazelbuild/rules_rust#2277 * rust-lang/rust-clippy#12203
This removes a workaround that was necessary in the past to work around an issue in clippy. The issue is now fixed in clippy, and our clippy version is recent enough to include the fix. See also: * bazelbuild/rules_rust#2277 * rust-lang/rust-clippy#12203
Fixes #12201
changelog: none
cc: @UebelAndre @illicitonion