mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Prefer field.workspace = true
to field = { workspace = true }
This commit is contained in:
parent
edffc4ada3
commit
ea79548c1b
@ -225,7 +225,7 @@ pub enum TomlDependency<P: Clone = String> {
|
|||||||
/// In the simple format, only a version is specified, eg.
|
/// In the simple format, only a version is specified, eg.
|
||||||
/// `package = "<version>"`
|
/// `package = "<version>"`
|
||||||
Simple(String),
|
Simple(String),
|
||||||
/// `package = { workspace = true }`
|
/// `package.workspace = true`
|
||||||
Workspace(TomlWorkspaceDependency),
|
Workspace(TomlWorkspaceDependency),
|
||||||
/// The simple format is equivalent to a detailed dependency
|
/// The simple format is equivalent to a detailed dependency
|
||||||
/// specifying only a version, eg.
|
/// specifying only a version, eg.
|
||||||
@ -990,7 +990,7 @@ where
|
|||||||
deserializer.deserialize_any(Visitor)
|
deserializer.deserialize_any(Visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enum that allows for the parsing of { workspace = true } in a Cargo.toml
|
/// Enum that allows for the parsing of `field.workspace = true` in a Cargo.toml
|
||||||
///
|
///
|
||||||
/// It allows for things to be inherited from a workspace or defined as needed
|
/// It allows for things to be inherited from a workspace or defined as needed
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
|
@ -1458,16 +1458,16 @@ edition = "2018"
|
|||||||
```toml
|
```toml
|
||||||
# in a workspace member's Cargo.toml
|
# in a workspace member's Cargo.toml
|
||||||
[package]
|
[package]
|
||||||
version = { workspace = true }
|
version.workspace = true
|
||||||
authors = { workspace = true }
|
authors.workspace = true
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
documentation = { workspace = true }
|
documentation.workspace = true
|
||||||
readme = { workspace = true }
|
readme.workspace = true
|
||||||
homepage = { workspace = true }
|
homepage.workspace = true
|
||||||
repository = { workspace = true }
|
repository.workspace = true
|
||||||
license = { workspace = true }
|
license.workspace = true
|
||||||
license-file = { workspace = true }
|
license-file.workspace = true
|
||||||
keywords = { workspace = true }
|
keywords.workspace = true
|
||||||
categories = { workspace = true }
|
categories.workspace = true
|
||||||
publish = { workspace = true }
|
publish.workspace = true
|
||||||
```
|
```
|
@ -1,4 +1,4 @@
|
|||||||
//! Tests for inheriting Cargo.toml fields with { workspace = true }
|
//! Tests for inheriting Cargo.toml fields with field.workspace = true
|
||||||
use cargo_test_support::registry::{Dependency, Package};
|
use cargo_test_support::registry::{Dependency, Package};
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{
|
||||||
basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry,
|
basic_lib_manifest, basic_manifest, git, path2url, paths, project, publish, registry,
|
||||||
@ -119,24 +119,24 @@ fn inherit_own_workspace_fields() {
|
|||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
cargo-features = ["workspace-inheritance"]
|
cargo-features = ["workspace-inheritance"]
|
||||||
badges = { workspace = true }
|
badges.workspace = true
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "foo"
|
name = "foo"
|
||||||
version = { workspace = true }
|
version.workspace = true
|
||||||
authors = { workspace = true }
|
authors.workspace = true
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
documentation = { workspace = true }
|
documentation.workspace = true
|
||||||
homepage = { workspace = true }
|
homepage.workspace = true
|
||||||
repository = { workspace = true }
|
repository.workspace = true
|
||||||
license = { workspace = true }
|
license.workspace = true
|
||||||
keywords = { workspace = true }
|
keywords.workspace = true
|
||||||
categories = { workspace = true }
|
categories.workspace = true
|
||||||
publish = { workspace = true }
|
publish.workspace = true
|
||||||
edition = { workspace = true }
|
edition.workspace = true
|
||||||
rust-version = { workspace = true }
|
rust-version.workspace = true
|
||||||
exclude = { workspace = true }
|
exclude.workspace = true
|
||||||
include = { workspace = true }
|
include.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = []
|
members = []
|
||||||
@ -501,7 +501,7 @@ fn inherit_from_own_undefined_field() {
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "1.2.5"
|
version = "1.2.5"
|
||||||
authors = ["rustaceans"]
|
authors = ["rustaceans"]
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = []
|
members = []
|
||||||
@ -623,27 +623,27 @@ fn inherit_workspace_fields() {
|
|||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
badges = { workspace = true }
|
badges.workspace = true
|
||||||
cargo-features = ["workspace-inheritance"]
|
cargo-features = ["workspace-inheritance"]
|
||||||
[package]
|
[package]
|
||||||
name = "bar"
|
name = "bar"
|
||||||
workspace = ".."
|
workspace = ".."
|
||||||
version = { workspace = true }
|
version.workspace = true
|
||||||
authors = { workspace = true }
|
authors.workspace = true
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
documentation = { workspace = true }
|
documentation.workspace = true
|
||||||
readme = { workspace = true }
|
readme.workspace = true
|
||||||
homepage = { workspace = true }
|
homepage.workspace = true
|
||||||
repository = { workspace = true }
|
repository.workspace = true
|
||||||
license = { workspace = true }
|
license.workspace = true
|
||||||
license-file = { workspace = true }
|
license-file.workspace = true
|
||||||
keywords = { workspace = true }
|
keywords.workspace = true
|
||||||
categories = { workspace = true }
|
categories.workspace = true
|
||||||
publish = { workspace = true }
|
publish.workspace = true
|
||||||
edition = { workspace = true }
|
edition.workspace = true
|
||||||
rust-version = { workspace = true }
|
rust-version.workspace = true
|
||||||
exclude = { workspace = true }
|
exclude.workspace = true
|
||||||
include = { workspace = true }
|
include.workspace = true
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("LICENSE", "license")
|
.file("LICENSE", "license")
|
||||||
@ -1298,7 +1298,7 @@ fn error_no_root_workspace() {
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
version = "1.2.3"
|
version = "1.2.3"
|
||||||
authors = ["rustaceans"]
|
authors = ["rustaceans"]
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/main.rs", "fn main() {}")
|
.file("src/main.rs", "fn main() {}")
|
||||||
@ -1385,7 +1385,7 @@ fn workspace_inheritance_not_enabled() {
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "1.2.5"
|
version = "1.2.5"
|
||||||
authors = ["rustaceans"]
|
authors = ["rustaceans"]
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = []
|
members = []
|
||||||
@ -1431,7 +1431,7 @@ fn nightly_required() {
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "1.2.5"
|
version = "1.2.5"
|
||||||
authors = ["rustaceans"]
|
authors = ["rustaceans"]
|
||||||
description = { workspace = true }
|
description.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = []
|
members = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user