Skip to content

Commit 7d8caa7

Browse files
committed
Expose higher-level interface in Toolchain
1 parent be1cfa5 commit 7d8caa7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/cli/rustup_mode.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,9 +1508,7 @@ async fn man(
15081508
toolchain: Option<PartialToolchainDesc>,
15091509
) -> Result<utils::ExitCode> {
15101510
let toolchain = cfg.toolchain_from_partial(toolchain).await?;
1511-
let mut path = toolchain.path().to_path_buf();
1512-
path.push("share");
1513-
path.push("man");
1511+
let path = toolchain.man_path();
15141512
utils::assert_is_directory(&path)?;
15151513

15161514
let mut manpaths = std::ffi::OsString::from(path);

src/toolchain/toolchain.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a> Toolchain<'a> {
136136
&self.name
137137
}
138138

139-
pub(crate) fn path(&self) -> &Path {
139+
pub(super) fn path(&self) -> &Path {
140140
&self.path
141141
}
142142

@@ -395,6 +395,13 @@ impl<'a> Toolchain<'a> {
395395
Ok(cmd)
396396
}
397397

398+
#[cfg(not(windows))]
399+
pub(crate) fn man_path(&self) -> PathBuf {
400+
let mut buf = PathBuf::from(&self.path);
401+
buf.extend(["share", "man"]);
402+
buf
403+
}
404+
398405
pub fn doc_path(&self, relative: &str) -> anyhow::Result<PathBuf> {
399406
let parts = vec!["share", "doc", "rust", "html"];
400407
let mut doc_dir = self.path.clone();

0 commit comments

Comments
 (0)