Skip to content

Commit 9e4c0e1

Browse files
committed
Don't use CargoDocConfig struct
1 parent 1919ce7 commit 9e4c0e1

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/cargo/ops/cargo_doc.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::core::{Shell, Workspace};
22
use crate::ops;
33
use crate::util::config::PathAndArgs;
44
use crate::util::CargoResult;
5-
use serde::Deserialize;
65
use std::path::Path;
76
use std::path::PathBuf;
87
use std::process::Command;
@@ -16,13 +15,6 @@ pub struct DocOptions {
1615
pub compile_opts: ops::CompileOptions,
1716
}
1817

19-
#[derive(Deserialize)]
20-
struct CargoDocConfig {
21-
/// Browser to use to open docs. If this is unset, the value of the environment variable
22-
/// `BROWSER` will be used.
23-
browser: Option<PathAndArgs>,
24-
}
25-
2618
/// Main method for `cargo doc`.
2719
pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
2820
let compilation = ops::compile(ws, &options.compile_opts)?;
@@ -36,10 +28,8 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
3628
.join("index.html");
3729
if path.exists() {
3830
let config_browser = {
39-
let cfg = ws.config().get::<CargoDocConfig>("doc")?;
40-
41-
cfg.browser
42-
.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args))
31+
let cfg: Option<PathAndArgs> = ws.config().get("doc.browser")?;
32+
cfg.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args))
4333
};
4434

4535
let mut shell = ws.config().shell();

tests/testsuite/doc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,13 +1188,12 @@ fn doc_extern_map_local() {
11881188
p.change_file(
11891189
".cargo/config.toml",
11901190
r#"
1191-
[doc.extern-map]
1192-
std = "local"
1191+
[doc.extern-map]
1192+
std = "local"
11931193
"#,
11941194
);
11951195

1196-
1197-
p.cargo("doc -Zrustdoc-map --open")
1196+
p.cargo("doc -v --no-deps -Zrustdoc-map --open")
11981197
.env("BROWSER", "echo")
11991198
.masquerade_as_nightly_cargo()
12001199
.with_stderr_contains("[..] Documenting foo v0.1.0 ([..])")

0 commit comments

Comments
 (0)