1
Fork 0

Fix strings indent

This commit is contained in:
Guillaume Gomez 2020-08-31 13:16:50 +02:00
parent 6c44bcc4ff
commit c9a48d1d73
16 changed files with 127 additions and 153 deletions

View file

@ -75,8 +75,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
} }
}); });
debug!( debug!(
"get_blanket_impls: found applicable impl: {}\ "get_blanket_impls: found applicable impl: {} for trait_ref={:?}, ty={:?}",
for trait_ref={:?}, ty={:?}",
may_apply, trait_ref, ty may_apply, trait_ref, ty
); );
if !may_apply { if !may_apply {

View file

@ -391,26 +391,25 @@ fn test_render_long_html() {
(word_cfg("unix") & word_cfg("windows") & word_cfg("debug_assertions")) (word_cfg("unix") & word_cfg("windows") & word_cfg("debug_assertions"))
.render_long_html(), .render_long_html(),
"This is supported on <strong>Unix and Windows and debug-assertions enabled\ "This is supported on <strong>Unix and Windows and debug-assertions enabled\
</strong> only." </strong> only."
); );
assert_eq!( assert_eq!(
(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions")) (word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions"))
.render_long_html(), .render_long_html(),
"This is supported on <strong>Unix or Windows or debug-assertions enabled\ "This is supported on <strong>Unix or Windows or debug-assertions enabled\
</strong> only." </strong> only."
); );
assert_eq!( assert_eq!(
(!(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions"))) (!(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions")))
.render_long_html(), .render_long_html(),
"This is supported on <strong>neither Unix nor Windows nor debug-assertions \ "This is supported on <strong>neither Unix nor Windows nor debug-assertions \
enabled</strong>." enabled</strong>."
); );
assert_eq!( assert_eq!(
((word_cfg("unix") & name_value_cfg("target_arch", "x86_64")) ((word_cfg("unix") & name_value_cfg("target_arch", "x86_64"))
| (word_cfg("windows") & name_value_cfg("target_pointer_width", "64"))) | (word_cfg("windows") & name_value_cfg("target_pointer_width", "64")))
.render_long_html(), .render_long_html(),
"This is supported on <strong>Unix and x86-64, or Windows and 64-bit</strong> \ "This is supported on <strong>Unix and x86-64, or Windows and 64-bit</strong> only."
only."
); );
assert_eq!( assert_eq!(
(!(word_cfg("unix") & word_cfg("windows"))).render_long_html(), (!(word_cfg("unix") & word_cfg("windows"))).render_long_html(),
@ -420,7 +419,7 @@ fn test_render_long_html() {
((word_cfg("debug_assertions") | word_cfg("windows")) & word_cfg("unix")) ((word_cfg("debug_assertions") | word_cfg("windows")) & word_cfg("unix"))
.render_long_html(), .render_long_html(),
"This is supported on <strong>(debug-assertions enabled or Windows) and Unix\ "This is supported on <strong>(debug-assertions enabled or Windows) and Unix\
</strong> only." </strong> only."
); );
assert_eq!( assert_eq!(
name_value_cfg("target_feature", "sse2").render_long_html(), name_value_cfg("target_feature", "sse2").render_long_html(),
@ -430,7 +429,7 @@ fn test_render_long_html() {
(name_value_cfg("target_arch", "x86_64") & name_value_cfg("target_feature", "sse2")) (name_value_cfg("target_arch", "x86_64") & name_value_cfg("target_feature", "sse2"))
.render_long_html(), .render_long_html(),
"This is supported on <strong>x86-64 and target feature \ "This is supported on <strong>x86-64 and target feature \
<code>sse2</code></strong> only." <code>sse2</code></strong> only."
); );
}) })
} }

View file

@ -422,14 +422,13 @@ pub fn name_from_pat(p: &hir::Pat<'_>) -> String {
PatKind::Ref(ref p, _) => name_from_pat(&**p), PatKind::Ref(ref p, _) => name_from_pat(&**p),
PatKind::Lit(..) => { PatKind::Lit(..) => {
warn!( warn!(
"tried to get argument name from PatKind::Lit, \ "tried to get argument name from PatKind::Lit, which is silly in function arguments"
which is silly in function arguments"
); );
"()".to_string() "()".to_string()
} }
PatKind::Range(..) => panic!( PatKind::Range(..) => panic!(
"tried to get argument name from PatKind::Range, \ "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) => { PatKind::Slice(ref begin, ref mid, ref end) => {
let begin = begin.iter().map(|p| name_from_pat(&**p)); let begin = begin.iter().map(|p| name_from_pat(&**p));

View file

@ -416,14 +416,12 @@ impl Options {
return Err(1); return Err(1);
} else if !ret.is_empty() { } else if !ret.is_empty() {
diag.struct_warn(&format!( diag.struct_warn(&format!(
"theme file \"{}\" is missing CSS rules from the \ "theme file \"{}\" is missing CSS rules from the default theme",
default theme",
theme_s theme_s
)) ))
.warn("the theme may appear incorrect when loaded") .warn("the theme may appear incorrect when loaded")
.help(&format!( .help(&format!(
"to see what rules are missing, call `rustdoc \ "to see what rules are missing, call `rustdoc --check-theme \"{}\"`",
--check-theme \"{}\"`",
theme_s theme_s
)) ))
.emit(); .emit();

View file

@ -561,8 +561,7 @@ fn run_global_ctxt(
if let Some(ref m) = krate.module { if let Some(ref m) = krate.module {
if let None | Some("") = m.doc_value() { if let None | Some("") = m.doc_value() {
let help = "The following guide may be of use:\n\ let help = "The following guide may be of use:\n\
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\ https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
.html";
tcx.struct_lint_node( tcx.struct_lint_node(
rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS, rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS,
ctxt.as_local_hir_id(m.def_id).unwrap(), ctxt.as_local_hir_id(m.def_id).unwrap(),
@ -581,7 +580,7 @@ fn run_global_ctxt(
.struct_warn(&format!("the `#![doc({})]` attribute is considered deprecated", name)); .struct_warn(&format!("the `#![doc({})]` attribute is considered deprecated", name));
msg.warn( msg.warn(
"see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \ "see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
for more information", for more information",
); );
if name == "no_default_passes" { if name == "no_default_passes" {
@ -614,7 +613,7 @@ fn run_global_ctxt(
report_deprecated_attr("plugins = \"...\"", diag); report_deprecated_attr("plugins = \"...\"", diag);
eprintln!( eprintln!(
"WARNING: `#![doc(plugins = \"...\")]` \ "WARNING: `#![doc(plugins = \"...\")]` \
no longer functions; see CVE-2018-1000622" no longer functions; see CVE-2018-1000622"
); );
continue; continue;
} }

View file

@ -833,7 +833,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
write!( write!(
f, f,
"<a class=\"type\" href=\"{url}#{shortty}.{name}\" \ "<a class=\"type\" href=\"{url}#{shortty}.{name}\" \
title=\"type {path}::{name}\">{name}</a>", title=\"type {path}::{name}\">{name}</a>",
url = url, url = url,
shortty = ItemType::AssocType, shortty = ItemType::AssocType,
name = name, name = name,

View file

@ -27,7 +27,7 @@ pub fn render_with_highlighting(
write!( write!(
out, out,
"<div class='information'><div class='tooltip {}'>ⓘ<span \ "<div class='information'><div class='tooltip {}'>ⓘ<span \
class='tooltiptext'>{}</span></div></div>", class='tooltiptext'>{}</span></div></div>",
class, tooltip class, tooltip
) )
.unwrap(); .unwrap();

View file

@ -210,8 +210,8 @@ pub fn render<T: Print, S: Print>(
.collect::<String>(), .collect::<String>(),
filter_crates = if layout.generate_search_filter { filter_crates = if layout.generate_search_filter {
"<select id=\"crate-search\">\ "<select id=\"crate-search\">\
<option value=\"All crates\">All crates</option>\ <option value=\"All crates\">All crates</option>\
</select>" </select>"
} else { } else {
"" ""
}, },

View file

@ -519,8 +519,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
Some(Event::FootnoteReference(ref reference)) => { Some(Event::FootnoteReference(ref reference)) => {
let entry = self.get_entry(&reference); let entry = self.get_entry(&reference);
let reference = format!( let reference = format!(
"<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}\ "<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}</a></sup>",
</a></sup>",
(*entry).1 (*entry).1
); );
return Some(Event::Html(reference.into())); return Some(Event::Html(reference.into()));

View file

@ -140,25 +140,26 @@ fn test_header() {
t( t(
"# Foo bar", "# Foo bar",
"<h1 id=\"foo-bar\" class=\"section-header\">\ "<h1 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h1>",
<a href=\"#foo-bar\">Foo bar</a></h1>",
); );
t( t(
"## Foo-bar_baz qux", "## Foo-bar_baz qux",
"<h2 id=\"foo-bar_baz-qux\" class=\"section-\ "<h2 id=\"foo-bar_baz-qux\" class=\"section-header\">
header\"><a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h2>", <a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h2>",
); );
t( t(
"### **Foo** *bar* baz!?!& -_qux_-%", "### **Foo** *bar* baz!?!& -_qux_-%",
"<h3 id=\"foo-bar-baz--qux-\" class=\"section-header\">\ "<h3 id=\"foo-bar-baz--qux-\" class=\"section-header\">\
<a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \ <a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
<em>bar</em> baz!?!&amp; -<em>qux</em>-%</a></h3>", <em>bar</em> baz!?!&amp; -<em>qux</em>-%</a>\
</h3>",
); );
t( t(
"#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux", "#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
"<h4 id=\"foo--bar--baz--qux\" class=\"section-header\">\ "<h4 id=\"foo--bar--baz--qux\" class=\"section-header\">\
<a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \ <a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!* \
<em><code>baz</code></em> #qux</a></h4>", <em><code>baz</code></em> #qux</a>\
</h4>",
); );
} }
@ -174,38 +175,32 @@ fn test_header_ids_multiple_blocks() {
t( t(
&mut map, &mut map,
"# Example", "# Example",
"<h1 id=\"example\" class=\"section-header\">\ "<h1 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h1>",
<a href=\"#example\">Example</a></h1>",
); );
t( t(
&mut map, &mut map,
"# Panics", "# Panics",
"<h1 id=\"panics\" class=\"section-header\">\ "<h1 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h1>",
<a href=\"#panics\">Panics</a></h1>",
); );
t( t(
&mut map, &mut map,
"# Example", "# Example",
"<h1 id=\"example-1\" class=\"section-header\">\ "<h1 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h1>",
<a href=\"#example-1\">Example</a></h1>",
); );
t( t(
&mut map, &mut map,
"# Main", "# Main",
"<h1 id=\"main-1\" class=\"section-header\">\ "<h1 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h1>",
<a href=\"#main-1\">Main</a></h1>",
); );
t( t(
&mut map, &mut map,
"# Example", "# Example",
"<h1 id=\"example-2\" class=\"section-header\">\ "<h1 id=\"example-2\" class=\"section-header\"><a href=\"#example-2\">Example</a></h1>",
<a href=\"#example-2\">Example</a></h1>",
); );
t( t(
&mut map, &mut map,
"# Panics", "# Panics",
"<h1 id=\"panics-1\" class=\"section-header\">\ "<h1 id=\"panics-1\" class=\"section-header\"><a href=\"#panics-1\">Panics</a></h1>",
<a href=\"#panics-1\">Panics</a></h1>",
); );
} }

View file

@ -1061,8 +1061,8 @@ themePicker.onblur = handleThemeButtonsBlur;
let content = format!( let content = format!(
"<h1 class='fqn'>\ "<h1 class='fqn'>\
<span class='in-band'>List of all crates</span>\ <span class='in-band'>List of all crates</span>\
</h1><ul class='mod'>{}</ul>", </h1><ul class='mod'>{}</ul>",
krates krates
.iter() .iter()
.map(|s| { .map(|s| {
@ -1311,15 +1311,16 @@ impl AllTypes {
write!( write!(
f, f,
"<h1 class='fqn'>\ "<h1 class='fqn'>\
<span class='out-of-band'>\ <span class='out-of-band'>\
<span id='render-detail'>\ <span id='render-detail'>\
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" title=\"collapse all docs\">\ <a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
[<span class='inner'>&#x2212;</span>]\ title=\"collapse all docs\">\
</a>\ [<span class='inner'>&#x2212;</span>]\
</span> </a>\
</span> </span>
<span class='in-band'>List of all items</span>\ </span>
</h1>" <span class='in-band'>List of all items</span>\
</h1>"
); );
print_entries(f, &self.structs, "Structs", "structs"); print_entries(f, &self.structs, "Structs", "structs");
print_entries(f, &self.enums, "Enums", "enums"); print_entries(f, &self.enums, "Enums", "enums");
@ -1349,20 +1350,20 @@ impl Setting {
match *self { match *self {
Setting::Section { ref description, ref sub_settings } => format!( Setting::Section { ref description, ref sub_settings } => format!(
"<div class='setting-line'>\ "<div class='setting-line'>\
<div class='title'>{}</div>\ <div class='title'>{}</div>\
<div class='sub-settings'>{}</div> <div class='sub-settings'>{}</div>
</div>", </div>",
description, description,
sub_settings.iter().map(|s| s.display()).collect::<String>() sub_settings.iter().map(|s| s.display()).collect::<String>()
), ),
Setting::Entry { ref js_data_name, ref description, ref default_value } => format!( Setting::Entry { ref js_data_name, ref description, ref default_value } => format!(
"<div class='setting-line'>\ "<div class='setting-line'>\
<label class='toggle'>\ <label class='toggle'>\
<input type='checkbox' id='{}' {}>\ <input type='checkbox' id='{}' {}>\
<span class='slider'></span>\ <span class='slider'></span>\
</label>\ </label>\
<div>{}</div>\ <div>{}</div>\
</div>", </div>",
js_data_name, js_data_name,
if *default_value { " checked" } else { "" }, if *default_value { " checked" } else { "" },
description, description,
@ -1876,30 +1877,29 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) {
write!( write!(
w, w,
"Non-exhaustive structs could have additional fields added in future. \ "Non-exhaustive structs could have additional fields added in future. \
Therefore, non-exhaustive structs cannot be constructed in external crates \ Therefore, non-exhaustive structs cannot be constructed in external crates \
using the traditional <code>Struct {{ .. }}</code> syntax; cannot be \ using the traditional <code>Struct {{ .. }}</code> syntax; cannot be \
matched against without a wildcard <code>..</code>; and \ matched against without a wildcard <code>..</code>; and \
struct update syntax will not work." struct update syntax will not work."
); );
} else if item.is_enum() { } else if item.is_enum() {
write!( write!(
w, w,
"Non-exhaustive enums could have additional variants added in future. \ "Non-exhaustive enums could have additional variants added in future. \
Therefore, when matching against variants of non-exhaustive enums, an \ Therefore, when matching against variants of non-exhaustive enums, an \
extra wildcard arm must be added to account for any future variants." extra wildcard arm must be added to account for any future variants."
); );
} else if item.is_variant() { } else if item.is_variant() {
write!( write!(
w, w,
"Non-exhaustive enum variants could have additional fields added in future. \ "Non-exhaustive enum variants could have additional fields added in future. \
Therefore, non-exhaustive enum variants cannot be constructed in external \ Therefore, non-exhaustive enum variants cannot be constructed in external \
crates and cannot be matched against." crates and cannot be matched against."
); );
} else { } else {
write!( write!(
w, w,
"This type will require a wildcard arm in any match statements or \ "This type will require a wildcard arm in any match statements or constructors."
constructors."
); );
} }
@ -2096,12 +2096,11 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
let doc_value = myitem.doc_value().unwrap_or(""); let doc_value = myitem.doc_value().unwrap_or("");
write!( write!(
w, w,
"\ "<tr class='{stab}{add}module-item'>\
<tr class='{stab}{add}module-item'>\ <td><a class=\"{class}\" href=\"{href}\" \
<td><a class=\"{class}\" href=\"{href}\" \ title='{title}'>{name}</a>{unsafety_flag}</td>\
title='{title}'>{name}</a>{unsafety_flag}</td>\ <td class='docblock-short'>{stab_tags}{docs}</td>\
<td class='docblock-short'>{stab_tags}{docs}</td>\ </tr>",
</tr>",
name = *myitem.name.as_ref().unwrap(), name = *myitem.name.as_ref().unwrap(),
stab_tags = stability_tags(myitem), stab_tags = stability_tags(myitem),
docs = MarkdownSummaryLine(doc_value, &myitem.links()).into_string(), docs = MarkdownSummaryLine(doc_value, &myitem.links()).into_string(),
@ -2250,8 +2249,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
write!( write!(
w, w,
"{vis}const \ "{vis}const {name}: {typ}",
{name}: {typ}",
vis = it.visibility.print_with_space(), vis = it.visibility.print_with_space(),
name = it.name.as_ref().unwrap(), name = it.name.as_ref().unwrap(),
typ = c.type_.print(), typ = c.type_.print(),
@ -2285,8 +2283,7 @@ fn item_static(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Static
render_attributes(w, it, false); render_attributes(w, it, false);
write!( write!(
w, w,
"{vis}static {mutability}\ "{vis}static {mutability} {name}: {typ}</pre>",
{name}: {typ}</pre>",
vis = it.visibility.print_with_space(), vis = it.visibility.print_with_space(),
mutability = s.mutability.print_with_space(), mutability = s.mutability.print_with_space(),
name = it.name.as_ref().unwrap(), name = it.name.as_ref().unwrap(),
@ -2312,7 +2309,7 @@ fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Func
write!( write!(
w, w,
"{vis}{constness}{asyncness}{unsafety}{abi}fn \ "{vis}{constness}{asyncness}{unsafety}{abi}fn \
{name}{generics}{decl}{spotlight}{where_clause}</pre>", {name}{generics}{decl}{spotlight}{where_clause}</pre>",
vis = it.visibility.print_with_space(), vis = it.visibility.print_with_space(),
constness = f.header.constness.print_with_space(), constness = f.header.constness.print_with_space(),
asyncness = f.header.asyncness.print_with_space(), asyncness = f.header.asyncness.print_with_space(),
@ -2503,10 +2500,9 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
fn write_small_section_header(w: &mut Buffer, id: &str, title: &str, extra_content: &str) { fn write_small_section_header(w: &mut Buffer, id: &str, title: &str, extra_content: &str) {
write!( write!(
w, w,
" "<h2 id='{0}' class='small-section-header'>\
<h2 id='{0}' class='small-section-header'>\ {1}<a href='#{0}' class='anchor'></a>\
{1}<a href='#{0}' class='anchor'></a>\ </h2>{2}",
</h2>{2}",
id, title, extra_content id, title, extra_content
) )
} }
@ -2835,7 +2831,7 @@ fn render_assoc_item(
write!( write!(
w, w,
"{}{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\ "{}{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
{generics}{decl}{spotlight}{where_clause}", {generics}{decl}{spotlight}{where_clause}",
if parent == ItemType::Trait { " " } else { "" }, if parent == ItemType::Trait { " " } else { "" },
meth.visibility.print_with_space(), meth.visibility.print_with_space(),
header.constness.print_with_space(), header.constness.print_with_space(),
@ -2910,9 +2906,9 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
write!( write!(
w, w,
"<span id=\"{id}\" class=\"{item_type} small-section-header\">\ "<span id=\"{id}\" class=\"{item_type} small-section-header\">\
<a href=\"#{id}\" class=\"anchor field\"></a>\ <a href=\"#{id}\" class=\"anchor field\"></a>\
<code>{name}: {ty}</code>\ <code>{name}: {ty}</code>\
</span>", </span>",
item_type = ItemType::StructField, item_type = ItemType::StructField,
id = id, id = id,
name = field.name.as_ref().unwrap(), name = field.name.as_ref().unwrap(),
@ -2954,9 +2950,9 @@ fn item_union(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Union,
write!( write!(
w, w,
"<span id=\"{id}\" class=\"{shortty} small-section-header\">\ "<span id=\"{id}\" class=\"{shortty} small-section-header\">\
<a href=\"#{id}\" class=\"anchor field\"></a>\ <a href=\"#{id}\" class=\"anchor field\"></a>\
<code>{name}: {ty}</code>\ <code>{name}: {ty}</code>\
</span>", </span>",
id = id, id = id,
name = name, name = name,
shortty = ItemType::StructField, shortty = ItemType::StructField,
@ -3081,9 +3077,9 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca
write!( write!(
w, w,
"<span id=\"{id}\" class=\"variant small-section-header\">\ "<span id=\"{id}\" class=\"variant small-section-header\">\
<a href=\"#{id}\" class=\"anchor field\"></a>\ <a href=\"#{id}\" class=\"anchor field\"></a>\
<code>{f}:&nbsp;{t}\ <code>{f}:&nbsp;{t}</code>\
</code></span>", </span>",
id = id, id = id,
f = field.name.as_ref().unwrap(), f = field.name.as_ref().unwrap(),
t = ty.print() t = ty.print()
@ -3296,23 +3292,19 @@ fn render_assoc_items(
AssocItemRender::All => { AssocItemRender::All => {
write!( write!(
w, w,
"\ "<h2 id='implementations' class='small-section-header'>\
<h2 id='implementations' class='small-section-header'>\ Implementations<a href='#implementations' class='anchor'></a>\
Implementations<a href='#implementations' class='anchor'></a>\ </h2>"
</h2>\
"
); );
RenderMode::Normal RenderMode::Normal
} }
AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => { AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => {
write!( write!(
w, w,
"\ "<h2 id='deref-methods' class='small-section-header'>\
<h2 id='deref-methods' class='small-section-header'>\ Methods from {}&lt;Target = {}&gt;\
Methods from {}&lt;Target = {}&gt;\ <a href='#deref-methods' class='anchor'></a>\
<a href='#deref-methods' class='anchor'></a>\ </h2>",
</h2>\
",
trait_.print(), trait_.print(),
type_.print() type_.print()
); );
@ -3359,11 +3351,10 @@ fn render_assoc_items(
if !impls.is_empty() { if !impls.is_empty() {
write!( write!(
w, w,
"\ "<h2 id='trait-implementations' class='small-section-header'>\
<h2 id='trait-implementations' class='small-section-header'>\ Trait Implementations<a href='#trait-implementations' class='anchor'></a>\
Trait Implementations<a href='#trait-implementations' class='anchor'></a>\ </h2>\
</h2>\ <div id='trait-implementations-list'>{}</div>",
<div id='trait-implementations-list'>{}</div>",
impls impls
); );
} }
@ -3371,13 +3362,11 @@ fn render_assoc_items(
if !synthetic.is_empty() { if !synthetic.is_empty() {
write!( write!(
w, w,
"\ "<h2 id='synthetic-implementations' class='small-section-header'>\
<h2 id='synthetic-implementations' class='small-section-header'>\ Auto Trait Implementations\
Auto Trait Implementations\ <a href='#synthetic-implementations' class='anchor'></a>\
<a href='#synthetic-implementations' class='anchor'></a>\ </h2>\
</h2>\ <div id='synthetic-implementations-list'>"
<div id='synthetic-implementations-list'>\
"
); );
render_impls(cx, w, &synthetic, containing_item, cache); render_impls(cx, w, &synthetic, containing_item, cache);
write!(w, "</div>"); write!(w, "</div>");
@ -3386,13 +3375,11 @@ fn render_assoc_items(
if !blanket_impl.is_empty() { if !blanket_impl.is_empty() {
write!( write!(
w, w,
"\ "<h2 id='blanket-implementations' class='small-section-header'>\
<h2 id='blanket-implementations' class='small-section-header'>\ Blanket Implementations\
Blanket Implementations\ <a href='#blanket-implementations' class='anchor'></a>\
<a href='#blanket-implementations' class='anchor'></a>\ </h2>\
</h2>\ <div id='blanket-implementations-list'>"
<div id='blanket-implementations-list'>\
"
); );
render_impls(cx, w, &blanket_impl, containing_item, cache); render_impls(cx, w, &blanket_impl, containing_item, cache);
write!(w, "</div>"); write!(w, "</div>");
@ -3473,7 +3460,7 @@ fn spotlight_decl(decl: &clean::FnDecl) -> String {
if out.is_empty() { if out.is_empty() {
out.push_str(&format!( out.push_str(&format!(
"<h3 class=\"notable\">Notable traits for {}</h3>\ "<h3 class=\"notable\">Notable traits for {}</h3>\
<code class=\"content\">", <code class=\"content\">",
impl_.for_.print() impl_.for_.print()
)); ));
trait_.push_str(&impl_.for_.print().to_string()); trait_.push_str(&impl_.for_.print().to_string());
@ -3909,8 +3896,8 @@ fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer, cache: &Ca
write!( write!(
buffer, buffer,
"<div class='block version'>\ "<div class='block version'>\
<p>Version {}</p>\ <p>Version {}</p>\
</div>", </div>",
Escape(version) Escape(version)
); );
} }
@ -4185,7 +4172,7 @@ fn sidebar_struct(buf: &mut Buffer, it: &clean::Item, s: &clean::Struct) {
if let doctree::Plain = s.struct_type { if let doctree::Plain = s.struct_type {
sidebar.push_str(&format!( sidebar.push_str(&format!(
"<a class=\"sidebar-title\" href=\"#fields\">Fields</a>\ "<a class=\"sidebar-title\" href=\"#fields\">Fields</a>\
<div class=\"sidebar-links\">{}</div>", <div class=\"sidebar-links\">{}</div>",
fields fields
)); ));
} }
@ -4312,8 +4299,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
res.sort(); res.sort();
sidebar.push_str(&format!( sidebar.push_str(&format!(
"<a class=\"sidebar-title\" href=\"#foreign-impls\">\ "<a class=\"sidebar-title\" href=\"#foreign-impls\">\
Implementations on Foreign Types</a><div \ Implementations on Foreign Types</a>\
class=\"sidebar-links\">{}</div>", <div class=\"sidebar-links\">{}</div>",
res.into_iter() res.into_iter()
.map(|(name, id)| format!("<a href=\"#{}\">{}</a>", id, Escape(&name))) .map(|(name, id)| format!("<a href=\"#{}\">{}</a>", id, Escape(&name)))
.collect::<Vec<_>>() .collect::<Vec<_>>()

View file

@ -52,7 +52,7 @@ impl<'a> DocFolder for SourceCollector<'a> {
Err(e) => { Err(e) => {
println!( println!(
"warning: source code was requested to be rendered, \ "warning: source code was requested to be rendered, \
but processing `{}` had an error: {}", but processing `{}` had an error: {}",
item.source.filename, e item.source.filename, e
); );
println!(" skipping rendering of source code"); println!(" skipping rendering of source code");

View file

@ -153,7 +153,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"passes", "passes",
"list of passes to also run, you might want to pass it multiple times; a value of \ "list of passes to also run, you might want to pass it multiple times; a value of \
`list` will print available passes", `list` will print available passes",
"PASSES", "PASSES",
) )
}), }),
@ -183,7 +183,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"html-in-header", "html-in-header",
"files to include inline in the <head> section of a rendered Markdown file \ "files to include inline in the <head> section of a rendered Markdown file \
or generated documentation", or generated documentation",
"FILES", "FILES",
) )
}), }),
@ -192,7 +192,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"html-before-content", "html-before-content",
"files to include inline between <body> and the content of a rendered \ "files to include inline between <body> and the content of a rendered \
Markdown file or generated documentation", Markdown file or generated documentation",
"FILES", "FILES",
) )
}), }),
@ -201,7 +201,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"html-after-content", "html-after-content",
"files to include inline between the content and </body> of a rendered \ "files to include inline between the content and </body> of a rendered \
Markdown file or generated documentation", Markdown file or generated documentation",
"FILES", "FILES",
) )
}), }),
@ -210,7 +210,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"markdown-before-content", "markdown-before-content",
"files to include inline between <body> and the content of a rendered \ "files to include inline between <body> and the content of a rendered \
Markdown file or generated documentation", Markdown file or generated documentation",
"FILES", "FILES",
) )
}), }),
@ -219,7 +219,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"markdown-after-content", "markdown-after-content",
"files to include inline between the content and </body> of a rendered \ "files to include inline between the content and </body> of a rendered \
Markdown file or generated documentation", Markdown file or generated documentation",
"FILES", "FILES",
) )
}), }),
@ -234,8 +234,8 @@ fn opts() -> Vec<RustcOptGroup> {
"e", "e",
"extend-css", "extend-css",
"To add some CSS rules with a given file to generate doc with your \ "To add some CSS rules with a given file to generate doc with your \
own theme. However, your theme might break if the rustdoc's generated HTML \ own theme. However, your theme might break if the rustdoc's generated HTML \
changes, so be careful!", changes, so be careful!",
"PATH", "PATH",
) )
}), }),
@ -248,7 +248,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"playground-url", "playground-url",
"URL to send code snippets to, may be reset by --markdown-playground-url \ "URL to send code snippets to, may be reset by --markdown-playground-url \
or `#![doc(html_playground_url=...)]`", or `#![doc(html_playground_url=...)]`",
"URL", "URL",
) )
}), }),
@ -281,7 +281,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"resource-suffix", "resource-suffix",
"suffix to add to CSS and JavaScript files, e.g., \"light.css\" will become \ "suffix to add to CSS and JavaScript files, e.g., \"light.css\" will become \
\"light-suffix.css\"", \"light-suffix.css\"",
"PATH", "PATH",
) )
}), }),
@ -343,7 +343,7 @@ fn opts() -> Vec<RustcOptGroup> {
"", "",
"static-root-path", "static-root-path",
"Path string to force loading static files from in output pages. \ "Path string to force loading static files from in output pages. \
If not set, uses combinations of '../' to reach the documentation root.", If not set, uses combinations of '../' to reach the documentation root.",
"PATH", "PATH",
) )
}), }),

View file

@ -1157,7 +1157,7 @@ fn report_diagnostic(
// Print the line containing the `link_range` and manually mark it with '^'s. // Print the line containing the `link_range` and manually mark it with '^'s.
diag.note(&format!( diag.note(&format!(
"the link appears in this line:\n\n{line}\n\ "the link appears in this line:\n\n{line}\n\
{indicator: <before$}{indicator:^<found$}", {indicator: <before$}{indicator:^<found$}",
line = line, line = line,
indicator = "", indicator = "",
before = link_range.start - last_new_line_offset, before = link_range.start - last_new_line_offset,

View file

@ -284,8 +284,7 @@ impl<'a> DocFolder for ImplStripper<'a> {
if let Some(did) = typaram.def_id() { if let Some(did) = typaram.def_id() {
if did.is_local() && !self.retained.contains(&did) { if did.is_local() && !self.retained.contains(&did) {
debug!( debug!(
"ImplStripper: stripped item in trait's generics; \ "ImplStripper: stripped item in trait's generics; removing impl"
removing impl"
); );
return None; return None;
} }

View file

@ -9,7 +9,7 @@ pub const STRIP_PRIVATE: Pass = Pass {
name: "strip-private", name: "strip-private",
run: strip_private, run: strip_private,
description: "strips all private items from a crate which cannot be seen externally, \ description: "strips all private items from a crate which cannot be seen externally, \
implies strip-priv-imports", implies strip-priv-imports",
}; };
/// Strip private items from the point of view of a crate or externally from a /// Strip private items from the point of view of a crate or externally from a