-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove unused_extern_crates warning for crates used by nested code #44294
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Comments
Mark-Simulacrum
added
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
labels
Sep 3, 2017
Arguable point. As the statement doesn't impact the binary (linkage), it doesn't harm if we disabled the lint. I'm not sure about the way to implement it though. |
This was referenced Sep 10, 2017
dtolnay
added a commit
to dtolnay/rust
that referenced
this issue
Sep 25, 2017
This is a partial revert of rust-lang#42588. There is a usability concern reported in rust-lang#44294 that was not considered in the discussion of the PR, so I would like to back this out of 1.21. As is, I think users would have a worse and more confusing experience with this lint enabled by default. We can re-enabled once there are better diagnostics or the case in rust-lang#44294 does not trigger the lint.
bors
added a commit
that referenced
this issue
Sep 27, 2017
Allow unused extern crate again This is a partial revert of #42588. There is a usability concern reported in #44294 that was not considered in the discussion of the PR, so I would like to back this out of 1.21. As is, I think users would have a worse and more confusing experience with this lint enabled by default. We can re-enabled once there are better diagnostics or the case in #44294 does not trigger the lint.
nikomatsakis
pushed a commit
to nikomatsakis/rust
that referenced
this issue
Sep 28, 2017
This is a partial revert of rust-lang#42588. There is a usability concern reported in rust-lang#44294 that was not considered in the discussion of the PR, so I would like to back this out of 1.21. As is, I think users would have a worse and more confusing experience with this lint enabled by default. We can re-enabled once there are better diagnostics or the case in rust-lang#44294 does not trigger the lint.
11 tasks
Closing this as the error case is the same now irrespective of whether extern crate is included or not. |
There is still a minor improvement from adding //extern crate serde;
struct NotSerializable;
#[derive(serde::Serialize)]
struct TryingToSerialize {
bad: NotSerializable,
} < note: required by a bound in `_serde::ser::SerializeStruct::serialize_field`
> note: required by a bound in `serde::ser::SerializeStruct::serialize_field` Less bad compared to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
In the following scenario, the user will have a better experience if we allow them to have an "unused" extern crate.
[playground]
If we permit them to write
extern crate
, as recommended by Serde's docs for this reason, the error message is:If they remove the unused
extern crate
, they generally get nastier error messages.If we can't fix the error message to be as good as it was before the unused_extern_crates warning, let's disable unused_extern_crates in cases where the same crate is used later in some nested scope (submodule or code block).
cc @ishitatsuyuki who has been involved with this warning.
The text was updated successfully, but these errors were encountered: