mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fixed the error message for a user to open the crate
This commit is contained in:
parent
c2b0d50451
commit
871e281cff
@ -56,10 +56,11 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
|
|||||||
let compilation = ops::compile(ws, &options.compile_opts)?;
|
let compilation = ops::compile(ws, &options.compile_opts)?;
|
||||||
|
|
||||||
if options.open_result {
|
if options.open_result {
|
||||||
let name = &compilation
|
let name = &compilation.root_crate_names.get(0).ok_or_else(|| {
|
||||||
.root_crate_names
|
anyhow::anyhow!(
|
||||||
.get(0)
|
"cannot open specified crate's documentation: no documentation generated"
|
||||||
.ok_or_else(|| anyhow::anyhow!("no crates with documentation"))?;
|
)
|
||||||
|
})?;
|
||||||
let kind = options.compile_opts.build_config.single_requested_kind()?;
|
let kind = options.compile_opts.build_config.single_requested_kind()?;
|
||||||
|
|
||||||
let path = path_by_output_format(&compilation, &kind, &name, &options.output_format);
|
let path = path_by_output_format(&compilation, &kind, &name, &options.output_format);
|
||||||
|
@ -1501,7 +1501,7 @@ fn open_no_doc_crate() {
|
|||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_data(str![[r#"
|
.with_stderr_data(str![[r#"
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[ERROR] no crates with documentation
|
[ERROR] cannot open specified crate's documentation: no documentation generated
|
||||||
|
|
||||||
"#]])
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user