mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +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)?;
|
||||
|
||||
if options.open_result {
|
||||
let name = &compilation
|
||||
.root_crate_names
|
||||
.get(0)
|
||||
.ok_or_else(|| anyhow::anyhow!("no crates with documentation"))?;
|
||||
let name = &compilation.root_crate_names.get(0).ok_or_else(|| {
|
||||
anyhow::anyhow!(
|
||||
"cannot open specified crate's documentation: no documentation generated"
|
||||
)
|
||||
})?;
|
||||
let kind = options.compile_opts.build_config.single_requested_kind()?;
|
||||
|
||||
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_stderr_data(str![[r#"
|
||||
[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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user