Skip to content

Commit

Permalink
Auto merge of #13371 - epage:new-comment, r=weihanglo
Browse files Browse the repository at this point in the history
fix(new): Print a note, rather than a comment, for more information

### What does this PR try to resolve?

For myself, I find it frustrating when tools add boilerplate that I have to remove after every use.  A `note:` on the command-line is more ephemeral, helping people who need it while not interfering with those that don't.

Fixes #12210

### How should we test and review this PR?

### Additional information
  • Loading branch information
bors committed Feb 1, 2024
2 parents 8e5e648 + 7513b41 commit b1bd44d
Show file tree
Hide file tree
Showing 91 changed files with 73 additions and 102 deletions.
7 changes: 5 additions & 2 deletions src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,7 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> {
array.push(registry);
manifest["package"]["publish"] = toml_edit::value(array);
}
let mut dep_table = toml_edit::Table::default();
dep_table.decor_mut().set_prefix("\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n");
let dep_table = toml_edit::Table::default();
manifest["dependencies"] = toml_edit::Item::Table(dep_table);

// Calculate what `[lib]` and `[[bin]]`s we need to append to `Cargo.toml`.
Expand Down Expand Up @@ -911,6 +910,10 @@ mod tests {
);
}

config.shell().note(
"see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html",
)?;

Ok(())
}

Expand Down
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/auto_git/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/auto_git/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Creating binary (application) package
warning: file `case.rs` seems to be a library file
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[lib]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Creating library package
warning: file `case.rs` seems to be a binary (application) file
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/formats_source/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/formats_source/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/fossil_autodetect/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/fossil_autodetect/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/git_autodetect/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/git_autodetect/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[lib]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ publish.workspace = true
repository.workspace = true
version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[lib]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/mercurial_autodetect/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "testing"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Creating binary (application) package
warning: the path `[ROOT]/case/test:ing/.` contains invalid PATH characters (usually `:`, `;`, or `"`)
It is recommended to use a different name to avoid problems.
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/pijul_autodetect/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/pijul_autodetect/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/simple_bin/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/simple_bin/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/simple_git/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/simple_git/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/simple_hg/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/simple_hg/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/simple_lib/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "case"
version = "0.1.0"
edition = "2015"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/simple_lib/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2 changes: 0 additions & 2 deletions tests/testsuite/cargo_init/with_argument/out/foo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/with_argument/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
1 change: 1 addition & 0 deletions tests/testsuite/cargo_init/workspace_add_member/stderr.log
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ version = "0.1.0"
edition = "2021"
authors.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) `foo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) `foo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ name = "foo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Creating binary (application) `foo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Loading

0 comments on commit b1bd44d

Please sign in to comment.