-
Notifications
You must be signed in to change notification settings - Fork 503
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 workspace lints #2741
Enable workspace lints #2741
Conversation
If it's only a single case, would adding an |
Seems to work! |
Is the reason for the false positive that CI doesn't always use features that use it? E.g. clippy is run with no features at all windows-rs/.github/workflows/clippy.yml Line 146 in 831b99b
|
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 any case, this PR lgtm.
Yes, it isn't used in all cases. It is used by some features and by the optional |
#[allow(unused_extern_crates)] | ||
extern crate self as windows_sys; |
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.
It does not seem that this is needed for anything; the lint is valid. There is nothing inside sys
/ windows
referring to (::)windows_sys::
or (::)windows::
respectively. Could these lines just be removed altogether?
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.
Err, I meant to say that:
- On
windows_sys
I don't seem to get a false-positive here, because it's actually used; - On
windows
I only get a few errors originating from thewindows_implement
macro, which expects thewindows
crate to be available as an external crate (which is interesting for a macro that generates code to be used both inside and outside of a crate).
EDIT: It's actually including::windows::core::
. Wasn't there a request before to use::windows_core::
here so that the macro can also be used without thewindows
crate (at the downside thatwindows
+implement
users now need both crates)?
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 clippy -p windows-sys
Checking windows-sys v0.52.0 (R:\windows-rs\crates\libs\sys)
warning: unused extern crate
--> crates\libs\sys\src\lib.rs:11:1
|
11 | extern crate self as windows_sys;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
= note: `-W unused-extern-crates` implied by `-W rust-2018-idioms`
= help: to override `-W rust-2018-idioms` add `#[allow(unused_extern_crates)]`
warning: `windows-sys` (lib) generated 1 warning (run `cargo clippy --fix --lib -p windows-sys` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 2m 49s
> cargo clippy -p windows-sys --features Win32
Checking windows-sys v0.52.0 (R:\windows-rs\crates\libs\sys)
Finished dev [unoptimized + debuginfo] target(s) in 1.41s
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.
See the console
highlight:
> cargo clippy -p windows-sys Checking windows-sys v0.52.0 (R:\windows-rs\crates\libs\sys) warning: unused extern crate --> crates\libs\sys\src\lib.rs:11:1 | 11 | extern crate self as windows_sys; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | = note: `-W unused-extern-crates` implied by `-W rust-2018-idioms` = help: to override `-W rust-2018-idioms` add `#[allow(unused_extern_crates)]` warning: `windows-sys` (lib) generated 1 warning (run `cargo clippy --fix --lib -p windows-sys` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 2m 49s > cargo clippy -p windows-sys --features Win32 Checking windows-sys v0.52.0 (R:\windows-rs\crates\libs\sys) Finished dev [unoptimized + debuginfo] target(s) in 1.41s
Indeed, it is conditionally used :(
If there's a simpler solution, I'd love to hear it. I'd like to make the macros depend only on the |
Those two desires conflict, unfortunately. We can either use There is a special crate that is able to process renames in |
As suggested in #2739, I'm enabling workspace lints to more easily enable non-default Rust and Clippy lints.
I've started with only
elided-lifetimes-in-paths
as some of the others, likerust_2018_idioms
, has some false positives that prevent them from being turned on for this workspace.Fixes: #2739