Skip to content

Commit

Permalink
docs(cargo-target): clarify dashs in bin target name wont be replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed May 8, 2024
1 parent 0335428 commit 4b3123e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/doc/src/reference/cargo-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ configuring the settings for a target.

The library target defines a "library" that can be used and linked by other
libraries and executables. The filename defaults to `src/lib.rs`, and the name
of the library defaults to the name of the package. A package can have only
one library. The settings for the library can be [customized] in the `[lib]`
table in `Cargo.toml`.
of the library defaults to the name of the package, with any dashes replaced
with underscores. A package can have only one library. The settings for the
library can be [customized] in the `[lib]` table in `Cargo.toml`.

```toml
# Example of customizing the library in Cargo.toml.
Expand Down Expand Up @@ -198,9 +198,10 @@ The `name` field specifies the name of the target, which corresponds to the
filename of the artifact that will be generated. For a library, this is the
crate name that dependencies will use to reference it.

For the `[lib]` and the default binary (`src/main.rs`), this defaults to the
name of the package, with any dashes replaced with underscores. For other
[auto discovered](#target-auto-discovery) targets, it defaults to the
For the library target, this defaults to the name of the package , with any
dashes replaced with underscores. For the default binary (`src/main.rs`),
it also defaults to the name of the package, with no replacement for dashes.
For [auto discovered](#target-auto-discovery) targets, it defaults to the
directory or file name.

This is required for all targets except `[lib]`.
Expand Down

0 comments on commit 4b3123e

Please sign in to comment.