mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 04:51:31 +00:00
Use crate_name() on the library target, update tests.
This commit is contained in:
parent
58ed2e3746
commit
af355f0ea5
|
@ -108,7 +108,7 @@ impl<'a> fmt::Display for Display<'a> {
|
|||
.iter()
|
||||
.find(|target| target.is_lib())
|
||||
{
|
||||
write!(fmt, "{}", target.name())?;
|
||||
write!(fmt, "{}", target.crate_name())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ strings will be replaced with the corresponding value:
|
|||
- `{l}` — The package license.
|
||||
- `{r}` — The package repository URL.
|
||||
- `{f}` — Comma-separated list of package features that are enabled.
|
||||
- `{lib}` — The name of the package's library.
|
||||
- `{lib}` — The name, as used in a `use` statement, of the package's library.
|
||||
{{/option}}
|
||||
|
||||
{{#option "`--prefix` _prefix_" }}
|
||||
|
|
|
@ -138,7 +138,8 @@ OPTIONS
|
|||
o {f} — Comma-separated list of package features that are
|
||||
enabled.
|
||||
|
||||
o {lib} — The name of the package's library.
|
||||
o {lib} — The name, as used in a use statement, of the package's
|
||||
library.
|
||||
|
||||
--prefix prefix
|
||||
Sets how each line is displayed. The prefix value can be one of:
|
||||
|
|
|
@ -145,7 +145,7 @@ strings will be replaced with the corresponding value:</p>
|
|||
<li><code>{l}</code> — The package license.</li>
|
||||
<li><code>{r}</code> — The package repository URL.</li>
|
||||
<li><code>{f}</code> — Comma-separated list of package features that are enabled.</li>
|
||||
<li><code>{lib}</code> — The name of the package's library.</li>
|
||||
<li><code>{lib}</code> — The name, as used in a <code>use</code> statement, of the package's library.</li>
|
||||
</ul></dd>
|
||||
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ strings will be replaced with the corresponding value:
|
|||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
\h'-04'\(bu\h'+02'\fB{lib}\fR \[em] The name of the package's library.
|
||||
\h'-04'\(bu\h'+02'\fB{lib}\fR \[em] The name, as used in a \fBuse\fR statement, of the package's library.
|
||||
.RE
|
||||
.RE
|
||||
.sp
|
||||
|
|
|
@ -1009,6 +1009,7 @@ foo v0.1.0 ([..]/foo)
|
|||
#[cargo_test]
|
||||
fn format() {
|
||||
Package::new("dep", "1.0.0").publish();
|
||||
Package::new("other-dep", "1.0.0").publish();
|
||||
|
||||
Package::new("dep_that_is_awesome", "1.0.0")
|
||||
.file(
|
||||
|
@ -1037,15 +1038,17 @@ fn format() {
|
|||
|
||||
[dependencies]
|
||||
dep = {version="1.0", optional=true}
|
||||
other-dep = {version="1.0", optional=true}
|
||||
dep_that_is_awesome = {version="1.0", optional=true}
|
||||
|
||||
|
||||
[features]
|
||||
default = ["foo"]
|
||||
foo = ["bar"]
|
||||
bar = []
|
||||
"#,
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.file("src/main.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("tree --format <<<{p}>>>")
|
||||
|
@ -1082,20 +1085,21 @@ Caused by:
|
|||
.arg("{p} [{f}]")
|
||||
.with_stdout(
|
||||
"\
|
||||
foo v0.1.0 ([..]/foo) [bar,default,dep,dep_that_is_awesome,foo]
|
||||
foo v0.1.0 ([..]/foo) [bar,default,dep,dep_that_is_awesome,foo,other-dep]
|
||||
├── dep v1.0.0 []
|
||||
└── dep_that_is_awesome v1.0.0 []
|
||||
├── dep_that_is_awesome v1.0.0 []
|
||||
└── other-dep v1.0.0 []
|
||||
",
|
||||
)
|
||||
.run();
|
||||
|
||||
p.cargo("tree")
|
||||
.arg("--features=dep_that_is_awesome")
|
||||
.arg("--features=other-dep,dep_that_is_awesome")
|
||||
.arg("--format={lib}")
|
||||
.with_stdout(
|
||||
"\
|
||||
foo
|
||||
└── awesome_dep
|
||||
"
|
||||
├── awesome_dep
|
||||
└── other_dep
|
||||
",
|
||||
)
|
||||
.run();
|
||||
|
|
Loading…
Reference in a new issue