Skip to content

Commit 4b3123e

Browse files
committed
docs(cargo-target): clarify dashs in bin target name wont be replaced
1 parent 0335428 commit 4b3123e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/doc/src/reference/cargo-targets.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ configuring the settings for a target.
1414

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

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

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

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

0 commit comments

Comments
 (0)