forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#6650 - daxpedda:cargo-common-metadata-publish…
…, r=flip1995 Fix cargo_common_metadata warning on `publish = false`. I believe `cargo_common_metadata` shouldn't trigger when `publish = false`, not sure if everybody agrees. Made some tests to handle all edge-cases. Fixes rust-lang#6649. changelog: [`cargo_common_metadata`](https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata): No longer lints if [`publish = false`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field) is defined in the manifest
- Loading branch information
Showing
17 changed files
with
132 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
cargo-ignore-publish = true |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "cargo_common_metadata" | ||
version = "0.1.0" | ||
publish = ["some-registry-name"] | ||
|
||
[workspace] |
4 changes: 4 additions & 0 deletions
4
tests/ui-cargo/cargo_common_metadata/fail_publish/src/main.rs
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// compile-flags: --crate-name=cargo_common_metadata | ||
#![warn(clippy::cargo_common_metadata)] | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
tests/ui-cargo/cargo_common_metadata/fail_publish/src/main.stderr
This file contains 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error: package `cargo_common_metadata` is missing `package.authors` metadata | ||
| | ||
= note: `-D clippy::cargo-common-metadata` implied by `-D warnings` | ||
|
||
error: package `cargo_common_metadata` is missing `package.description` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `either package.license or package.license_file` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.repository` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.readme` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.keywords` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.categories` metadata | ||
|
||
error: aborting due to 7 previous errors | ||
|
6 changes: 6 additions & 0 deletions
6
tests/ui-cargo/cargo_common_metadata/fail_publish_true/Cargo.toml
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "cargo_common_metadata" | ||
version = "0.1.0" | ||
publish = true | ||
|
||
[workspace] |
4 changes: 4 additions & 0 deletions
4
tests/ui-cargo/cargo_common_metadata/fail_publish_true/src/main.rs
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// compile-flags: --crate-name=cargo_common_metadata | ||
#![warn(clippy::cargo_common_metadata)] | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
tests/ui-cargo/cargo_common_metadata/fail_publish_true/src/main.stderr
This file contains 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error: package `cargo_common_metadata` is missing `package.authors` metadata | ||
| | ||
= note: `-D clippy::cargo-common-metadata` implied by `-D warnings` | ||
|
||
error: package `cargo_common_metadata` is missing `package.description` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `either package.license or package.license_file` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.repository` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.readme` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.keywords` metadata | ||
|
||
error: package `cargo_common_metadata` is missing `package.categories` metadata | ||
|
||
error: aborting due to 7 previous errors | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
cargo-ignore-publish = true |
6 changes: 6 additions & 0 deletions
6
tests/ui-cargo/cargo_common_metadata/pass_publish_empty/Cargo.toml
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "cargo_common_metadata" | ||
version = "0.1.0" | ||
publish = [] | ||
|
||
[workspace] |
4 changes: 4 additions & 0 deletions
4
tests/ui-cargo/cargo_common_metadata/pass_publish_empty/src/main.rs
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// compile-flags: --crate-name=cargo_common_metadata | ||
#![warn(clippy::cargo_common_metadata)] | ||
|
||
fn main() {} |
6 changes: 6 additions & 0 deletions
6
tests/ui-cargo/cargo_common_metadata/pass_publish_false/Cargo.toml
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "cargo_common_metadata" | ||
version = "0.1.0" | ||
publish = false | ||
|
||
[workspace] |
4 changes: 4 additions & 0 deletions
4
tests/ui-cargo/cargo_common_metadata/pass_publish_false/src/main.rs
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// compile-flags: --crate-name=cargo_common_metadata | ||
#![warn(clippy::cargo_common_metadata)] | ||
|
||
fn main() {} |
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown field `foobar`, expected one of `msrv`, `blacklisted-names`, `cognitive-complexity-threshold`, `cyclomatic-complexity-threshold`, `doc-valid-idents`, `too-many-arguments-threshold`, `type-complexity-threshold`, `single-char-binding-names-threshold`, `too-large-for-stack`, `enum-variant-name-threshold`, `enum-variant-size-threshold`, `verbose-bit-mask-threshold`, `literal-representation-threshold`, `trivial-copy-size-limit`, `pass-by-value-size-limit`, `too-many-lines-threshold`, `array-size-threshold`, `vec-box-size-threshold`, `max-trait-bounds`, `max-struct-bools`, `max-fn-params-bools`, `warn-on-all-wildcard-imports`, `disallowed-methods`, `unreadable-literal-lint-fractions`, `third-party` at line 5 column 1 | ||
error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown field `foobar`, expected one of `msrv`, `blacklisted-names`, `cognitive-complexity-threshold`, `cyclomatic-complexity-threshold`, `doc-valid-idents`, `too-many-arguments-threshold`, `type-complexity-threshold`, `single-char-binding-names-threshold`, `too-large-for-stack`, `enum-variant-name-threshold`, `enum-variant-size-threshold`, `verbose-bit-mask-threshold`, `literal-representation-threshold`, `trivial-copy-size-limit`, `pass-by-value-size-limit`, `too-many-lines-threshold`, `array-size-threshold`, `vec-box-size-threshold`, `max-trait-bounds`, `max-struct-bools`, `max-fn-params-bools`, `warn-on-all-wildcard-imports`, `disallowed-methods`, `unreadable-literal-lint-fractions`, `cargo-ignore-publish`, `third-party` at line 5 column 1 | ||
|
||
error: aborting due to previous error | ||
|