Skip to content
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

Fix rustdoc strings indentation #76154

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
}
});
debug!(
"get_blanket_impls: found applicable impl: {}\
for trait_ref={:?}, ty={:?}",
"get_blanket_impls: found applicable impl: {} for trait_ref={:?}, ty={:?}",
may_apply, trait_ref, ty
);
if !may_apply {
Expand Down
13 changes: 6 additions & 7 deletions src/librustdoc/clean/cfg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,26 +391,25 @@ fn test_render_long_html() {
(word_cfg("unix") & word_cfg("windows") & word_cfg("debug_assertions"))
.render_long_html(),
"This is supported on <strong>Unix and Windows and debug-assertions enabled\
</strong> only."
</strong> only."
);
assert_eq!(
(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions"))
.render_long_html(),
"This is supported on <strong>Unix or Windows or debug-assertions enabled\
</strong> only."
</strong> only."
);
assert_eq!(
(!(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions")))
.render_long_html(),
"This is supported on <strong>neither Unix nor Windows nor debug-assertions \
enabled</strong>."
enabled</strong>."
);
assert_eq!(
((word_cfg("unix") & name_value_cfg("target_arch", "x86_64"))
| (word_cfg("windows") & name_value_cfg("target_pointer_width", "64")))
.render_long_html(),
"This is supported on <strong>Unix and x86-64, or Windows and 64-bit</strong> \
only."
"This is supported on <strong>Unix and x86-64, or Windows and 64-bit</strong> only."
);
assert_eq!(
(!(word_cfg("unix") & word_cfg("windows"))).render_long_html(),
Expand All @@ -420,7 +419,7 @@ fn test_render_long_html() {
((word_cfg("debug_assertions") | word_cfg("windows")) & word_cfg("unix"))
.render_long_html(),
"This is supported on <strong>(debug-assertions enabled or Windows) and Unix\
</strong> only."
</strong> only."
);
assert_eq!(
name_value_cfg("target_feature", "sse2").render_long_html(),
Expand All @@ -430,7 +429,7 @@ fn test_render_long_html() {
(name_value_cfg("target_arch", "x86_64") & name_value_cfg("target_feature", "sse2"))
.render_long_html(),
"This is supported on <strong>x86-64 and target feature \
<code>sse2</code></strong> only."
<code>sse2</code></strong> only."
);
})
}
5 changes: 2 additions & 3 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,13 @@ pub fn name_from_pat(p: &hir::Pat<'_>) -> String {
PatKind::Ref(ref p, _) => name_from_pat(&**p),
PatKind::Lit(..) => {
warn!(
"tried to get argument name from PatKind::Lit, \
which is silly in function arguments"
"tried to get argument name from PatKind::Lit, which is silly in function arguments"
);
"()".to_string()
}
PatKind::Range(..) => panic!(
"tried to get argument name from PatKind::Range, \
which is not allowed in function arguments"
which is not allowed in function arguments"
),
PatKind::Slice(ref begin, ref mid, ref end) => {
let begin = begin.iter().map(|p| name_from_pat(&**p));
Expand Down
6 changes: 2 additions & 4 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,12 @@ impl Options {
return Err(1);
} else if !ret.is_empty() {
diag.struct_warn(&format!(
"theme file \"{}\" is missing CSS rules from the \
default theme",
"theme file \"{}\" is missing CSS rules from the default theme",
theme_s
))
.warn("the theme may appear incorrect when loaded")
.help(&format!(
"to see what rules are missing, call `rustdoc \
--check-theme \"{}\"`",
"to see what rules are missing, call `rustdoc --check-theme \"{}\"`",
theme_s
))
.emit();
Expand Down
7 changes: 3 additions & 4 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ fn run_global_ctxt(
if let Some(ref m) = krate.module {
if let None | Some("") = m.doc_value() {
let help = "The following guide may be of use:\n\
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\
.html";
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
tcx.struct_lint_node(
rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS,
ctxt.as_local_hir_id(m.def_id).unwrap(),
Expand All @@ -581,7 +580,7 @@ fn run_global_ctxt(
.struct_warn(&format!("the `#![doc({})]` attribute is considered deprecated", name));
msg.warn(
"see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
for more information",
for more information",
);

if name == "no_default_passes" {
Expand Down Expand Up @@ -614,7 +613,7 @@ fn run_global_ctxt(
report_deprecated_attr("plugins = \"...\"", diag);
eprintln!(
"WARNING: `#![doc(plugins = \"...\")]` \
no longer functions; see CVE-2018-1000622"
no longer functions; see CVE-2018-1000622"
);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
write!(
f,
"<a class=\"type\" href=\"{url}#{shortty}.{name}\" \
title=\"type {path}::{name}\">{name}</a>",
title=\"type {path}::{name}\">{name}</a>",
url = url,
shortty = ItemType::AssocType,
name = name,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn render_with_highlighting(
write!(
out,
"<div class='information'><div class='tooltip {}'>ⓘ<span \
class='tooltiptext'>{}</span></div></div>",
class='tooltiptext'>{}</span></div></div>",
class, tooltip
)
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ pub fn render<T: Print, S: Print>(
.collect::<String>(),
filter_crates = if layout.generate_search_filter {
"<select id=\"crate-search\">\
<option value=\"All crates\">All crates</option>\
</select>"
<option value=\"All crates\">All crates</option>\
</select>"
} else {
""
},
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
Some(Event::FootnoteReference(ref reference)) => {
let entry = self.get_entry(&reference);
let reference = format!(
"<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}\
</a></sup>",
"<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}</a></sup>",
(*entry).1
);
return Some(Event::Html(reference.into()));
Expand Down
35 changes: 15 additions & 20 deletions src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,26 @@ fn test_header() {

t(
"# Foo bar",
"<h1 id=\"foo-bar\" class=\"section-header\">\
<a href=\"#foo-bar\">Foo bar</a></h1>",
"<h1 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h1>",
);
t(
"## Foo-bar_baz qux",
"<h2 id=\"foo-bar_baz-qux\" class=\"section-\
header\"><a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h2>",
"<h2 id=\"foo-bar_baz-qux\" class=\"section-header\">
<a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h2>",
);
t(
"### **Foo** *bar* baz!?!& -_qux_-%",
"<h3 id=\"foo-bar-baz--qux-\" class=\"section-header\">\
<a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
<em>bar</em> baz!?!&amp; -<em>qux</em>-%</a></h3>",
<a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
<em>bar</em> baz!?!&amp; -<em>qux</em>-%</a>\
</h3>",
);
t(
"#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
"<h4 id=\"foo--bar--baz--qux\" class=\"section-header\">\
<a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \
<em><code>baz</code></em> ❤ #qux</a></h4>",
<a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \
<em><code>baz</code></em> ❤ #qux</a>\
</h4>",
);
}

Expand All @@ -174,38 +175,32 @@ fn test_header_ids_multiple_blocks() {
t(
&mut map,
"# Example",
"<h1 id=\"example\" class=\"section-header\">\
<a href=\"#example\">Example</a></h1>",
"<h1 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h1>",
);
t(
&mut map,
"# Panics",
"<h1 id=\"panics\" class=\"section-header\">\
<a href=\"#panics\">Panics</a></h1>",
"<h1 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h1>",
);
t(
&mut map,
"# Example",
"<h1 id=\"example-1\" class=\"section-header\">\
<a href=\"#example-1\">Example</a></h1>",
"<h1 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h1>",
);
t(
&mut map,
"# Main",
"<h1 id=\"main-1\" class=\"section-header\">\
<a href=\"#main-1\">Main</a></h1>",
"<h1 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h1>",
);
t(
&mut map,
"# Example",
"<h1 id=\"example-2\" class=\"section-header\">\
<a href=\"#example-2\">Example</a></h1>",
"<h1 id=\"example-2\" class=\"section-header\"><a href=\"#example-2\">Example</a></h1>",
);
t(
&mut map,
"# Panics",
"<h1 id=\"panics-1\" class=\"section-header\">\
<a href=\"#panics-1\">Panics</a></h1>",
"<h1 id=\"panics-1\" class=\"section-header\"><a href=\"#panics-1\">Panics</a></h1>",
);
}

Expand Down
Loading