Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[WIP] Configure lints in Cargo.toml #5728
Conversation
rust-highfive
assigned
alexcrichton
Jul 15, 2018
This comment has been minimized.
This comment has been minimized.
rust-highfive
commented
Jul 15, 2018
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
|
@detrumi I saw your message on Discord, did you figure out the virtual manifest distinction? There are two manifest types, I'd caution about having packages override the workspace, since that's the opposite precedence of other workspace settings. I'm not sure how that should work. Also, just a heads up, rustdoc lint settings will probably be stabilized soon (rust-lang/rust#52354), and will probably want to reuse these for rustdoc. (Which will also probably need cap-lint support, but I imagine that will land separately.) One tricky bit is that This will likely need a feature flag (see |
This comment has been minimized.
This comment has been minimized.
|
|
detrumi
force-pushed the
detrumi:lints-in-manifest
branch
from
49d2614
to
68ae5b1
Jul 16, 2018
This comment has been minimized.
This comment has been minimized.
|
@ehuss Thanks for pointing me to The package override direction was taken from the proposal text in #5034, but maybe I read that wrong or there was a mistake in that, since you're right that having workspaces override packages makes more sense. I'll look into the |
This comment has been minimized.
This comment has been minimized.
|
I don't think you misread it, different people will have different expectations. I'm not sure which way is the right way. I'm just cautioning that it may not be clear how it should work, and that someone on the cargo team might want to clarify it. |
This comment has been minimized.
This comment has been minimized.
|
ping @detrumi, have you had a chance to handle some of the follow up comments here? |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Yes, I'm slowly working my way through implementing it. |
detrumi
force-pushed the
detrumi:lints-in-manifest
branch
2 times, most recently
from
69fb5a4
to
4652dca
Jul 31, 2018
This comment has been minimized.
This comment has been minimized.
|
Some questions:
|
This comment has been minimized.
This comment has been minimized.
|
Others may have a better idea how to handle the flags and such but for the test at least it's been tweaked I think since this started, you should be able to just drop the leading |
dwijnand
reviewed
Aug 7, 2018
| @@ -0,0 +1,177 @@ | |||
| use cargotest::support::{execs, project}; | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dwijnand
Aug 7, 2018
Member
Yeah it does because CI tests the merge of this PR branch with the (current) state of the target branch (where the merge has happened).
detrumi
force-pushed the
detrumi:lints-in-manifest
branch
2 times, most recently
from
cd7dbf6
to
67ee176
Aug 7, 2018
alexcrichton
reviewed
Aug 20, 2018
| @@ -240,6 +241,9 @@ pub struct TomlManifest { | |||
| patch: Option<BTreeMap<String, BTreeMap<String, TomlDependency>>>, | |||
| workspace: Option<TomlWorkspace>, | |||
| badges: Option<BTreeMap<String, BTreeMap<String, String>>>, | |||
| lints: Option<BTreeMap<String, String>>, | |||
| #[serde(rename = "lints2")] | |||
This comment has been minimized.
This comment has been minimized.
alexcrichton
Aug 20, 2018
Member
I'm not entirely clear on what the lints2 name is doing here, can you add a comment to the naming choice here?
This comment has been minimized.
This comment has been minimized.
detrumi
Aug 20, 2018
•
Author
Ah, I haven't figured out yet how to deserialize both [lints] and [lints.'cfg(...)'] correctly, so I just temporarily named it something else (sorry!). Just using #[serde(rename = "lints")] here doesn't work, so it probably needs a custom Deserialize impl.
This comment has been minimized.
This comment has been minimized.
alexcrichton
Aug 23, 2018
Member
Hm ok, I'm not really sure we'd want to support cfg(..) for lint configurations though in the sense that it feels like it's a bit overkill for configuration that can otherwise be specific in the crate source anyway?
This comment has been minimized.
This comment has been minimized.
| pub fn set_lint_flags(&self, unit_cfg: &[Cfg], features: &HashSet<String>, cmd: &mut ProcessBuilder) { | ||
| match self.cfg { | ||
| None => self.set_flags(cmd), | ||
| Some(CfgExpr::Value(Cfg::KeyPair(ref key, ref value))) |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Aug 20, 2018
Member
I think we've already got a number of #[cfg] matching functions throughout Cargo, could those be reused here?
This comment has been minimized.
This comment has been minimized.
detrumi
Aug 20, 2018
•
Author
I don't see one that could be used here, except maybe the CfgExpr::matches function that is used in the next line. The way I wrote it seems simpler than wrapping all feature strings inside Cfg::KeyPair, unless feature = foo keypairs can be nested inside other CfgExpr's?
This comment has been minimized.
This comment has been minimized.
alexcrichton
Aug 23, 2018
Member
I think we'll want to funnel everything through matches to ensure it's consistently appplied
ehuss
referenced this pull request
Sep 9, 2018
Open
Seems like --cap-lints is not being passed to rustc anymore #5998
phansch
referenced this pull request
Sep 11, 2018
Closed
It is impossible to understand from the readme file how to supress lints using clippy.toml #3164
detrumi
added some commits
Jul 12, 2018
detrumi
force-pushed the
detrumi:lints-in-manifest
branch
from
88e21f8
to
09abcb6
Sep 21, 2018
detrumi
force-pushed the
detrumi:lints-in-manifest
branch
from
09abcb6
to
e6a64ea
Sep 21, 2018
This comment has been minimized.
This comment has been minimized.
azriel91
commented
Oct 15, 2018
|
Hiya @detrumi, are you still working on this? |
This comment has been minimized.
This comment has been minimized.
|
This is unfortunately pretty old at this point so I'm going to close this (and we also have a soft feature freeze right now with Cargo). The Cargo team, however, will hopefully be able to allocate resources for this in early 2019! |
alexcrichton
closed this
Nov 6, 2018
This comment has been minimized.
This comment has been minimized.
|
@detrumi Would you mind if I pick up this PR in the next days? I would really like to see this implemented in 2019. (I would probably start with a fresh PR) |
This comment has been minimized.
This comment has been minimized.
|
@phansch We discussed lint configs at the Cargo meeting yesterday. We would like to see more discussion on the design before continuing. Would you be interested in helping to hash this out on IRLO? The following needs a closer look:
We don't really feel this needs a full RFC process, but we would at least like to see the content/questions that arise during that process to be addressed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yes, feel free to work on this. Creating a post on IRLO seems like a good way to push this forward, as there are too many open questions. I'd be happy to help, but I don't have much experience pushing discussion forward and such. |
detrumi commentedJul 15, 2018
•
edited
Implements #5034
This PR adds a
[lints]section toCargo.tomlusing the following format:Progress
-A/-W/-D/-Fflags to rustc[lints.'cfg(feature = "clippy")']