From c9a48d1d73f71fbe5f2ea72485fd2a8a94e65934 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 31 Aug 2020 13:16:50 +0200 Subject: Fix strings indent --- src/librustdoc/html/render/mod.rs | 169 ++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 91 deletions(-) (limited to 'src/librustdoc/html/render') diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 15afe9257d1..470e9d5ae76 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1061,8 +1061,8 @@ themePicker.onblur = handleThemeButtonsBlur; let content = format!( "

\ - List of all crates\ -

", + List of all crates\ + ", krates .iter() .map(|s| { @@ -1311,15 +1311,16 @@ impl AllTypes { write!( f, "

\ - \ - \ - \ - []\ - \ - - - List of all items\ -

" + \ + \ + \ + []\ + \ + + + List of all items\ + " ); print_entries(f, &self.structs, "Structs", "structs"); print_entries(f, &self.enums, "Enums", "enums"); @@ -1349,20 +1350,20 @@ impl Setting { match *self { Setting::Section { ref description, ref sub_settings } => format!( "
\ -
{}
\ -
{}
-
", +
{}
\ +
{}
+ ", description, sub_settings.iter().map(|s| s.display()).collect::() ), Setting::Entry { ref js_data_name, ref description, ref default_value } => format!( "
\ - \ -
{}
\ -
", + \ +
{}
\ + ", js_data_name, if *default_value { " checked" } else { "" }, description, @@ -1876,30 +1877,29 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) { write!( w, "Non-exhaustive structs could have additional fields added in future. \ - Therefore, non-exhaustive structs cannot be constructed in external crates \ - using the traditional Struct {{ .. }} syntax; cannot be \ - matched against without a wildcard ..; and \ - struct update syntax will not work." + Therefore, non-exhaustive structs cannot be constructed in external crates \ + using the traditional Struct {{ .. }} syntax; cannot be \ + matched against without a wildcard ..; and \ + struct update syntax will not work." ); } else if item.is_enum() { write!( w, "Non-exhaustive enums could have additional variants added in future. \ - Therefore, when matching against variants of non-exhaustive enums, an \ - extra wildcard arm must be added to account for any future variants." + Therefore, when matching against variants of non-exhaustive enums, an \ + extra wildcard arm must be added to account for any future variants." ); } else if item.is_variant() { write!( w, "Non-exhaustive enum variants could have additional fields added in future. \ - Therefore, non-exhaustive enum variants cannot be constructed in external \ - crates and cannot be matched against." + Therefore, non-exhaustive enum variants cannot be constructed in external \ + crates and cannot be matched against." ); } else { write!( w, - "This type will require a wildcard arm in any match statements or \ - constructors." + "This type will require a wildcard arm in any match statements or 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(""); write!( w, - "\ - \ - {name}{unsafety_flag}\ - {stab_tags}{docs}\ - ", + "\ + {name}{unsafety_flag}\ + {stab_tags}{docs}\ + ", name = *myitem.name.as_ref().unwrap(), stab_tags = stability_tags(myitem), 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!( w, - "{vis}const \ - {name}: {typ}", + "{vis}const {name}: {typ}", vis = it.visibility.print_with_space(), name = it.name.as_ref().unwrap(), 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); write!( w, - "{vis}static {mutability}\ - {name}: {typ}", + "{vis}static {mutability} {name}: {typ}", vis = it.visibility.print_with_space(), mutability = s.mutability.print_with_space(), 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!( w, "{vis}{constness}{asyncness}{unsafety}{abi}fn \ - {name}{generics}{decl}{spotlight}{where_clause}", + {name}{generics}{decl}{spotlight}{where_clause}", vis = it.visibility.print_with_space(), constness = f.header.constness.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) { write!( w, - " -

\ - {1}\ -

{2}", + "

\ + {1}\ +

{2}", id, title, extra_content ) } @@ -2835,7 +2831,7 @@ fn render_assoc_item( write!( w, "{}{}{}{}{}{}{}fn {name}\ - {generics}{decl}{spotlight}{where_clause}", + {generics}{decl}{spotlight}{where_clause}", if parent == ItemType::Trait { " " } else { "" }, meth.visibility.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!( w, "\ - \ - {name}: {ty}\ - ", + \ + {name}: {ty}\ + ", item_type = ItemType::StructField, id = id, 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!( w, "\ - \ - {name}: {ty}\ - ", + \ + {name}: {ty}\ + ", id = id, name = name, shortty = ItemType::StructField, @@ -3081,9 +3077,9 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca write!( w, "\ - \ - {f}: {t}\ - ", + \ + {f}: {t}\ + ", id = id, f = field.name.as_ref().unwrap(), t = ty.print() @@ -3296,23 +3292,19 @@ fn render_assoc_items( AssocItemRender::All => { write!( w, - "\ -

\ - Implementations\ -

\ - " + "

\ + Implementations\ +

" ); RenderMode::Normal } AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => { write!( w, - "\ -

\ - Methods from {}<Target = {}>\ - \ -

\ - ", + "

\ + Methods from {}<Target = {}>\ + \ +

", trait_.print(), type_.print() ); @@ -3359,11 +3351,10 @@ fn render_assoc_items( if !impls.is_empty() { write!( w, - "\ -

\ - Trait Implementations\ -

\ -
{}
", + "

\ + Trait Implementations\ +

\ +
{}
", impls ); } @@ -3371,13 +3362,11 @@ fn render_assoc_items( if !synthetic.is_empty() { write!( w, - "\ -

\ - Auto Trait Implementations\ - \ -

\ -
\ - " + "

\ + Auto Trait Implementations\ + \ +

\ +
" ); render_impls(cx, w, &synthetic, containing_item, cache); write!(w, "
"); @@ -3386,13 +3375,11 @@ fn render_assoc_items( if !blanket_impl.is_empty() { write!( w, - "\ -

\ - Blanket Implementations\ - \ -

\ -
\ - " + "

\ + Blanket Implementations\ + \ +

\ +
" ); render_impls(cx, w, &blanket_impl, containing_item, cache); write!(w, "
"); @@ -3473,7 +3460,7 @@ fn spotlight_decl(decl: &clean::FnDecl) -> String { if out.is_empty() { out.push_str(&format!( "

Notable traits for {}

\ - ", + ", impl_.for_.print() )); 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!( buffer, "
\ -

Version {}

\ -
", +

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 { sidebar.push_str(&format!( "Fields\ -
{}
", +
{}
", fields )); } @@ -4312,8 +4299,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) { res.sort(); sidebar.push_str(&format!( "\ - Implementations on Foreign Types
{}
", + Implementations on Foreign Types\ +
{}
", res.into_iter() .map(|(name, id)| format!("{}", id, Escape(&name))) .collect::>() -- cgit 1.4.1-3-g733a5