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

@ -409,8 +409,7 @@ fn test_render_long_html() {
((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(),

View file

@ -422,8 +422,7 @@ 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()
} }

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(),

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

@ -1313,7 +1313,8 @@ impl AllTypes {
"<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)\" \
title=\"collapse all docs\">\
[<span class='inner'>&#x2212;</span>]\ [<span class='inner'>&#x2212;</span>]\
</a>\ </a>\
</span> </span>
@ -1898,8 +1899,7 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) {
} 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,8 +2096,7 @@ 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>\
@ -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(),
@ -2503,8 +2500,7 @@ 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
@ -3082,8 +3078,8 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca
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,8 +3351,7 @@ 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>",
@ -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>");
@ -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

@ -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;
} }