Skip to content

Commit

Permalink
Auto merge of rust-lang#87119 - jyn514:rustfmt-doc-private, r=Mark-Si…
Browse files Browse the repository at this point in the history
…mulacrum

Document private items for rustfmt

This is possible now that rust-lang#73936 has been merged.
  • Loading branch information
bors committed Aug 17, 2021
2 parents a183141 + 6216b4e commit 3b5df01
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
15 changes: 3 additions & 12 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl Step for Rustc {
}

macro_rules! tool_doc {
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], binary=$bin:expr) => {
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct $tool {
stage: u32,
Expand Down Expand Up @@ -688,9 +688,7 @@ macro_rules! tool_doc {
cargo.arg("-p").arg($krate);
)+

if !$bin {
cargo.rustdocflag("--document-private-items");
}
cargo.rustdocflag("--document-private-items");
cargo.rustdocflag("--enable-index-page");
cargo.rustdocflag("--show-type-layout");
cargo.rustdocflag("-Zunstable-options");
Expand All @@ -700,19 +698,12 @@ macro_rules! tool_doc {
}
}

tool_doc!(
Rustdoc,
"rustdoc-tool",
"src/tools/rustdoc",
["rustdoc", "rustdoc-json-types"],
binary = false
);
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"]);
tool_doc!(
Rustfmt,
"rustfmt-nightly",
"src/tools/rustfmt",
["rustfmt-nightly", "rustfmt-config_proc_macro"],
binary = true
);

#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ fn identify_comment(
}

/// Attributes for code blocks in rustdoc.
/// See https://doc.rust-lang.org/rustdoc/print.html#attributes
/// See <https://doc.rust-lang.org/rustdoc/print.html#attributes>.
enum CodeBlockAttribute {
Rust,
Ignore,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustfmt/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ impl MacroBranch {
}
}

/// Format `lazy_static!` from https://crates.io/crates/lazy_static.
/// Format `lazy_static!` from <https://crates.io/crates/lazy_static>.
///
/// # Expected syntax
///
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rustfmt/src/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use crate::utils::{format_mutability, mk_sp, mk_sp_lo_plus_one, rewrite_ident};
/// Returns `true` if the given pattern is "short".
/// A short pattern is defined by the following grammar:
///
/// [small, ntp]:
/// `[small, ntp]`:
/// - single token
/// - `&[single-line, ntp]`
///
/// [small]:
/// `[small]`:
/// - `[small, ntp]`
/// - unary tuple constructor `([small, ntp])`
/// - `&[small]`
Expand Down

0 comments on commit 3b5df01

Please sign in to comment.