-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(manifest): Point out when a key belongs to config #16256
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
Merged
+139
−57
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a18393a
test(manifest): Merge unused manifest key warnings
epage 6738ddd
refactor(manifest): Remove unused 'profile.debug' suggestion
epage 33c3e0a
test(manifest): Reduce indent to make coppy/paste easier
epage 54b68f2
test(manifest): Test for misplaced config keys
epage 97421c9
fix(manifest): Point out when a key belongs to config
epage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -772,74 +772,125 @@ fn unused_keys() { | |
| .file( | ||
| "Cargo.toml", | ||
| r#" | ||
| [package] | ||
| name = "foo" | ||
| version = "0.1.0" | ||
| edition = "2015" | ||
| authors = [] | ||
| paths = ["/path/to/override"] | ||
|
|
||
| [target.foo] | ||
| bar = "3" | ||
| "#, | ||
| ) | ||
| .file("src/lib.rs", "") | ||
| .build(); | ||
| [package] | ||
| name = "foo" | ||
| version = "0.1.0" | ||
| edition = "2015" | ||
| authors = [] | ||
| unused = "foo" | ||
|
|
||
| p.cargo("check") | ||
| .with_stderr_data(str![[r#" | ||
| [WARNING] unused manifest key: target.foo.bar | ||
| [CHECKING] foo v0.1.0 ([ROOT]/foo) | ||
| [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
| [target.foo] | ||
| bar = "3" | ||
|
|
||
| "#]]) | ||
| .run(); | ||
| [lib] | ||
| build = "foo" | ||
|
|
||
| let p = project() | ||
| .file( | ||
| "Cargo.toml", | ||
| r#" | ||
| [package] | ||
| ## Config fields | ||
|
|
||
| name = "foo" | ||
| version = "0.5.0" | ||
| edition = "2015" | ||
| authors = ["[email protected]"] | ||
| unused = "foo" | ||
| "#, | ||
| ) | ||
| .file("src/lib.rs", "pub fn foo() {}") | ||
| .build(); | ||
| p.cargo("check") | ||
| .with_stderr_data(str![[r#" | ||
| [WARNING] unused manifest key: package.unused | ||
| [CHECKING] foo v0.5.0 ([ROOT]/foo) | ||
| [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
| [alias] | ||
| b = "build" | ||
|
|
||
| "#]]) | ||
| .run(); | ||
| [build] | ||
| jobs = 1 | ||
|
|
||
| let p = project() | ||
| .at("bar") | ||
| .file( | ||
| "Cargo.toml", | ||
| r#" | ||
| [package] | ||
| [credential-alias] | ||
| my-alias = ["/usr/bin/cargo-credential-example", "--argument", "value", "--flag"] | ||
|
|
||
| name = "foo" | ||
| version = "0.5.0" | ||
| edition = "2015" | ||
| authors = ["[email protected]"] | ||
| [doc] | ||
| browser = "chromium" | ||
|
|
||
| [lib] | ||
| build = "foo" | ||
| "#, | ||
| [env] | ||
| ENV_VAR_NAME = "value" | ||
|
|
||
| [future-incompat-report] | ||
| frequency = 'always' | ||
|
|
||
| [cache] | ||
| auto-clean-frequency = "1 day" | ||
|
|
||
| [cargo-new] | ||
| vcs = "none" | ||
|
|
||
| [http] | ||
| debug = false | ||
|
|
||
| [install] | ||
| root = "/some/path" | ||
|
|
||
| [net] | ||
| retry = 3 | ||
|
|
||
| [net.ssh] | ||
| known-hosts = ["..."] | ||
|
|
||
| [resolver] | ||
| incompatible-rust-versions = "allow" | ||
|
|
||
| [registries.alternative] | ||
| index = "…" | ||
|
|
||
| [registries.crates-io] | ||
| protocol = "sparse" | ||
|
|
||
| [registry] | ||
| default = "…" | ||
|
|
||
| [source.alternative] | ||
| replace-with = "…" | ||
|
|
||
| [target.'cfg(unix)'] | ||
| linker = "…" | ||
|
|
||
| [term] | ||
| quiet = false | ||
| "#, | ||
| ) | ||
| .file("src/lib.rs", "pub fn foo() {}") | ||
| .file("src/lib.rs", "") | ||
| .build(); | ||
|
|
||
| p.cargo("check") | ||
| .with_stderr_data(str![[r#" | ||
| [WARNING] unused manifest key: alias | ||
| [HELP] alias is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: build | ||
| [HELP] build is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: cache | ||
| [HELP] cache is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: cargo-new | ||
| [HELP] cargo-new is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: credential-alias | ||
| [HELP] credential-alias is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: doc | ||
| [HELP] doc is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: env | ||
| [HELP] env is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: future-incompat-report | ||
| [HELP] future-incompat-report is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: http | ||
| [HELP] http is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: install | ||
| [HELP] install is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: lib.build | ||
| [CHECKING] foo v0.5.0 ([ROOT]/bar) | ||
| [WARNING] unused manifest key: net | ||
| [HELP] net is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: package.unused | ||
| [WARNING] unused manifest key: paths | ||
| [HELP] paths is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: registries | ||
| [HELP] registries is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: registry | ||
| [HELP] registry is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: resolver | ||
| [HELP] resolver is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: source | ||
| [HELP] source is a valid .cargo/config.toml key | ||
| [WARNING] unused manifest key: target.cfg(unix).linker | ||
| [WARNING] unused manifest key: target.foo.bar | ||
| [WARNING] unused manifest key: term | ||
| [HELP] term is a valid .cargo/config.toml key | ||
| [CHECKING] foo v0.1.0 ([ROOT]/foo) | ||
| [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
|
||
| "#]]) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How do we want to maintain this list? I guess it'll just be best-effort?
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.
Yeah. This is why I had it in this file to make it easier to keep it up to date. If we had a schema file, we could read the schema file in and generate it.