-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix clippy warnings #15
Conversation
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.
Unlike rustfmt, clippy uses conditional compilation to check the code.
So it should be run on all windows, mac and linux.
Clippy on latest stable suggests replacing lines like self.executable_dir.as_ref().map(|p| p.as_path()) with self.executable_dir.as_deref()
|
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.
In the meantime, we are having plan to downgrade Rust version to 1.34.
I would review this PR after we decide.
Different clippy versions were tested by running: mkdir clippy_versions
for i in 1.{34..42}.0 stable; do
find -name '*.rs' -execdir touch {} \;
cargo +${i} clippy --all --all-targets &> clippy_versions/clippy-${i}.txt
done
|
I suggest using command line flag to allow clippy lint. |
Clippy on the command line doesn't seem to heed $ cargo +1.42.0 clippy --all --all-targets -- -A clippy::option_as_ref_deref
Checking dirs-sys-next v0.1.0 (/home/arif/git/dirs/dirs-sys)
Checking directories-next v1.0.0 (/home/arif/git/dirs/directories)
Checking dirs-next v1.0.0 (/home/arif/git/dirs)
Finished dev [unoptimized + debuginfo] target(s) in 0.45s
$ cargo +1.41.0 clippy --all --all-targets -- -A clippy::option_as_ref_deref
Checking dirs-sys-next v0.1.0 (/home/arif/git/dirs/dirs-sys)
error[E0602]: unknown lint: `clippy::option_as_ref_deref`
|
= help: did you mean: `clippy::option_unwrap_used`
= note: requested on the command line with `-A clippy::option_as_ref_deref`
error[E0602]: unknown lint: `clippy::option_as_ref_deref`
|
= help: did you mean: `clippy::option_unwrap_used`
= note: requested on the command line with `-A clippy::option_as_ref_deref`
error: aborting due to previous error
<snip>
$ cargo +1.41.0 clippy --all --all-targets -- -A clippy::unknown_clippy_lints -A clippy::option_as_ref_deref
Checking dirs-sys-next v0.1.0 (/home/arif/git/dirs/dirs-sys)
error[E0602]: unknown lint: `clippy::option_as_ref_deref`
|
= help: did you mean: `clippy::option_unwrap_used`
= note: requested on the command line with `-A clippy::option_as_ref_deref`
error[E0602]: unknown lint: `clippy::option_as_ref_deref`
|
= help: did you mean: `clippy::option_unwrap_used`
= note: requested on the command line with `-A clippy::option_as_ref_deref`
error: aborting due to previous error
<snip> Plus if in the code itself, the output when users run clippy in the repo will be the same as that of the CI. |
How about using clippy of nightly toolchain? This way we don't have to allow |
Fix the clippy warnings under: * `clippy::or_fun_call` * `clippy::redundant_clone`.
Clippy that comes with rust 1.42.0 and later has the `clippy::option_as_ref_deref` lint enabled by default. Fixing the lint requires an MSRV bump past 1.40.0. Allow the lint until then.
Whoops, I think I misunderstood what you wanted. I was trying to make it so that users who ran clippy on the shell using any version from the MSRV to the current stable didn't get extraneous warnings, which is why I added the I think you're only concerned about the CI. If that's the case, then the latest stable is all that's needed. All of |
Yes, I don't think it is useful to use old clippy for linting. |
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 @ArifRoktim
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
bors has often crashed recently. Merge manually I think. |
Should close #10