mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Don't use CargoDocConfig struct
This commit is contained in:
parent
1919ce7ce5
commit
9e4c0e1e44
@ -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<PathAndArgs>,
|
||||
}
|
||||
|
||||
/// 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::<CargoDocConfig>("doc")?;
|
||||
|
||||
cfg.browser
|
||||
.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args))
|
||||
let cfg: Option<PathAndArgs> = 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();
|
||||
|
@ -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 ([..])")
|
||||
|
Loading…
x
Reference in New Issue
Block a user