diff --git a/src/cargo/ops/cargo_doc.rs b/src/cargo/ops/cargo_doc.rs index 065888a70..9e868c206 100644 --- a/src/cargo/ops/cargo_doc.rs +++ b/src/cargo/ops/cargo_doc.rs @@ -2,7 +2,6 @@ use crate::core::{Shell, Workspace}; use crate::ops; use crate::util::config::PathAndArgs; use crate::util::CargoResult; -use serde::Deserialize; use std::path::Path; use std::path::PathBuf; use std::process::Command; @@ -16,13 +15,6 @@ pub struct DocOptions { pub compile_opts: ops::CompileOptions, } -#[derive(Deserialize)] -struct CargoDocConfig { - /// Browser to use to open docs. If this is unset, the value of the environment variable - /// `BROWSER` will be used. - browser: Option, -} - /// Main method for `cargo doc`. pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> { let compilation = ops::compile(ws, &options.compile_opts)?; @@ -36,10 +28,8 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> { .join("index.html"); if path.exists() { let config_browser = { - let cfg = ws.config().get::("doc")?; - - cfg.browser - .map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args)) + let cfg: Option = ws.config().get("doc.browser")?; + cfg.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args)) }; let mut shell = ws.config().shell(); diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index ecb54cf94..cd8712425 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1188,13 +1188,12 @@ fn doc_extern_map_local() { p.change_file( ".cargo/config.toml", r#" - [doc.extern-map] - std = "local" +[doc.extern-map] +std = "local" "#, ); - - p.cargo("doc -Zrustdoc-map --open") + p.cargo("doc -v --no-deps -Zrustdoc-map --open") .env("BROWSER", "echo") .masquerade_as_nightly_cargo() .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])")