From 991ec57c33afda5d9caacbc3dbdce46c00696b2d Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Wed, 15 Nov 2023 00:14:10 +0000 Subject: [PATCH 1/6] Fix documentation for the target.kind field, based on https://doc.rust-lang.org/cargo/commands/cargo-metadata.html and my own experiments --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 061fd8bc..0aaf4f20 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -502,7 +502,10 @@ impl fmt::Display for Source { pub struct Target { /// Name as given in the `Cargo.toml` or generated from the file name pub name: String, - /// Kind of target ("bin", "example", "test", "bench", "lib", "custom-build") + /// Kind of target. + /// This can be one of `example`, `test`, `bench`, `custom-build` + /// and/or one of the [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): + /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` pub kind: Vec, /// Almost the same as `kind`, except when an example is a library instead of an executable. /// In that case `crate_types` contains things like `rlib` and `dylib` while `kind` is `example` From 1b429f368763da67b392af6f66c7fb82ecaa567e Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Wed, 15 Nov 2023 00:34:28 +0000 Subject: [PATCH 2/6] Fix documentation for the target.crate_types field, based on https://doc.rust-lang.org/cargo/commands/cargo-metadata.html --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0aaf4f20..80c5cad1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -507,8 +507,10 @@ pub struct Target { /// and/or one of the [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` pub kind: Vec, - /// Almost the same as `kind`, except when an example is a library instead of an executable. - /// In that case `crate_types` contains things like `rlib` and `dylib` while `kind` is `example` + /// Almost the same as `kind`, but only reports the + /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): + /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro`. + /// Everything that's not a proc macro or a library of some kind is reported as "bin". #[serde(default)] #[cfg_attr(feature = "builder", builder(default))] pub crate_types: Vec, From ac9aed5137b0dbb8e303514584d011ac2669e9e1 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Wed, 15 Nov 2023 00:35:12 +0000 Subject: [PATCH 3/6] Formatting --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 80c5cad1..20bd334f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -503,8 +503,8 @@ pub struct Target { /// Name as given in the `Cargo.toml` or generated from the file name pub name: String, /// Kind of target. - /// This can be one of `example`, `test`, `bench`, `custom-build` - /// and/or one of the [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): + /// This can be one of `example`, `test`, `bench`, `custom-build` and/or one of the + /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` pub kind: Vec, /// Almost the same as `kind`, but only reports the From 5f9a44f47b1aae98201c33eb5c439b4e46896c97 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Wed, 15 Nov 2023 00:38:20 +0000 Subject: [PATCH 4/6] Better wording --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 20bd334f..7c1d6947 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -507,7 +507,7 @@ pub struct Target { /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` pub kind: Vec, - /// Almost the same as `kind`, but only reports the + /// Similar to `kind`, but only reports the /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro`. /// Everything that's not a proc macro or a library of some kind is reported as "bin". From 7d2aeb9ab29529429508a8038e917e59a835390e Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Wed, 15 Nov 2023 00:41:08 +0000 Subject: [PATCH 5/6] I'm not 100% certain only one of each is allowed, do not claim that --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7c1d6947..8d794853 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -503,7 +503,7 @@ pub struct Target { /// Name as given in the `Cargo.toml` or generated from the file name pub name: String, /// Kind of target. - /// This can be one of `example`, `test`, `bench`, `custom-build` and/or one of the + /// The possible values are `example`, `test`, `bench`, `custom-build` and /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` pub kind: Vec, From cfe1549341292518c5c28817c36a330af63d0d99 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Thu, 16 Nov 2023 20:52:02 +0000 Subject: [PATCH 6/6] Address review feedback --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8d794853..008d642b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -503,14 +503,19 @@ pub struct Target { /// Name as given in the `Cargo.toml` or generated from the file name pub name: String, /// Kind of target. + /// /// The possible values are `example`, `test`, `bench`, `custom-build` and /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): - /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro` + /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro`. + /// + /// Other possible values may be added in the future. pub kind: Vec, /// Similar to `kind`, but only reports the /// [Cargo crate types](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field): /// `bin`, `lib`, `rlib`, `dylib`, `cdylib`, `staticlib`, `proc-macro`. /// Everything that's not a proc macro or a library of some kind is reported as "bin". + /// + /// Other possible values may be added in the future. #[serde(default)] #[cfg_attr(feature = "builder", builder(default))] pub crate_types: Vec,