Skip to content

rustdoc: tweak notes on ignore/compile_fail examples #45815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>, id: Option<&str>

let mut out = Vec::new();
if let Some((tooltip, class)) = tooltip {
write!(out, "<div class='information'><div class='tooltip {}'><span \
write!(out, "<div class='information'><div class='tooltip {}'><span \
class='tooltiptext'>{}</span></div></div>",
class, tooltip).unwrap();
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'a, I> {
))
});
let tooltip = if ignore {
Some(("Be careful when using this code, it's not being tested!", "ignore"))
Some(("This example is not tested", "ignore"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of this new sentence. :-/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's matter of fact, much better.

} else if compile_fail {
Some(("This code doesn't compile so be extra careful!", "compile_fail"))
Some(("This example deliberately fails to compile", "compile_fail"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

} else {
None
};
Expand Down Expand Up @@ -639,9 +639,9 @@ pub fn render(w: &mut fmt::Formatter,
))
});
let tooltip = if ignore {
Some(("Be careful when using this code, it's not being tested!", "ignore"))
Some(("This example is not tested", "ignore"))
} else if compile_fail {
Some(("This code doesn't compile so be extra careful!", "compile_fail"))
Some(("This example deliberately fails to compile", "compile_fail"))
} else {
None
};
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc/codeblock-title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

// ignore-tidy-linelength

// @has foo/fn.bar.html '//*[@class="tooltip compile_fail"]/span' "This code doesn't compile so be extra careful!"
// @has foo/fn.bar.html '//*[@class="tooltip ignore"]/span' "Be careful when using this code, it's not being tested!"
// @has foo/fn.bar.html '//*[@class="tooltip compile_fail"]/span' "This example deliberately fails to compile"
// @has foo/fn.bar.html '//*[@class="tooltip ignore"]/span' "This example is not tested"

/// foo
///
Expand Down