diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 33404a7683597..74cdf9b9b7985 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -208,7 +208,7 @@ impl clean::GenericParamDef {
if f.alternate() {
write!(f, ": {:#}", print_generic_bounds(bounds, cx))?;
} else {
- write!(f, ": {}", print_generic_bounds(bounds, cx))?;
+ write!(f, ": {}", print_generic_bounds(bounds, cx))?;
}
}
@@ -216,7 +216,7 @@ impl clean::GenericParamDef {
if f.alternate() {
write!(f, " = {:#}", ty.print(cx))?;
} else {
- write!(f, " = {}", ty.print(cx))?;
+ write!(f, " = {}", ty.print(cx))?;
}
}
@@ -226,14 +226,14 @@ impl clean::GenericParamDef {
if f.alternate() {
write!(f, "const {}: {:#}", self.name, ty.print(cx))?;
} else {
- write!(f, "const {}: {}", self.name, ty.print(cx))?;
+ write!(f, "const {}: {}", self.name, ty.print(cx))?;
}
if let Some(default) = default {
if f.alternate() {
write!(f, " = {:#}", default)?;
} else {
- write!(f, " = {}", default)?;
+ write!(f, " = {}", default)?;
}
}
@@ -354,12 +354,12 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
let mut br_with_padding = String::with_capacity(6 * indent + 28);
br_with_padding.push_str("
");
for _ in 0..indent + 4 {
- br_with_padding.push_str(" ");
+ br_with_padding.push_str(" ");
}
let where_preds = where_preds.to_string().replace("
", &br_with_padding);
if ending == Ending::Newline {
- let mut clause = " ".repeat(indent.saturating_sub(1));
+ let mut clause = " ".repeat(indent.saturating_sub(1));
write!(clause, "where{where_preds},")?;
clause
} else {
@@ -368,7 +368,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
format!("
where{where_preds}")
} else {
let mut clause = br_with_padding;
- clause.truncate(clause.len() - 4 * " ".len());
+ clause.truncate(clause.len() - 4);
write!(clause, "where{where_preds}")?;
clause
}
@@ -1391,8 +1391,8 @@ impl clean::FnDecl {
let declaration_len = header_len + args_plain.len() + arrow_plain.len();
let output = if declaration_len > 80 {
- let full_pad = format!("
{}", " ".repeat(indent + 4));
- let close_pad = format!("
{}", " ".repeat(indent));
+ let full_pad = format!("
{}", " ".repeat(indent + 4));
+ let close_pad = format!("
{}", " ".repeat(indent));
format!(
"({pad}{args}{close}){arrow}",
pad = if self.inputs.values.is_empty() { "" } else { &full_pad },
@@ -1611,7 +1611,7 @@ impl clean::TypeBinding {
if f.alternate() {
write!(f, ": {:#}", print_generic_bounds(bounds, cx))?;
} else {
- write!(f, ": {}", print_generic_bounds(bounds, cx))?;
+ write!(f, ": {}", print_generic_bounds(bounds, cx))?;
}
}
}
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index bd7548003ad3b..9a7a08ab80684 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -1157,7 +1157,7 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean:
fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]) {
for (i, ty) in s.iter().enumerate() {
if i > 0 {
- w.write_str(", ");
+ w.write_str(", ");
}
match *ty.kind {
clean::StrippedItem(box clean::StructFieldItem(_)) => w.write_str("_"),
@@ -1297,7 +1297,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
"
{f}: {t}
\
+ {f}: {t}
\
",
id = id,
f = field.name.unwrap(),
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index ee988090ca334..a1e91118303c2 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -184,6 +184,7 @@ h4.code-header {
font-weight: 600;
margin: 0;
padding: 0;
+ white-space: pre-wrap;
}
#crate-search,
@@ -642,6 +643,7 @@ pre, .rustdoc.source .example-wrap {
.fn .where,
.where.fmt-newline {
display: block;
+ white-space: pre-wrap;
font-size: 0.875rem;
}
diff --git a/tests/rustdoc/doc-notable_trait.some-struct-new.html b/tests/rustdoc/doc-notable_trait.some-struct-new.html
index 384be66895400..e8f4f6000457d 100644
--- a/tests/rustdoc/doc-notable_trait.some-struct-new.html
+++ b/tests/rustdoc/doc-notable_trait.some-struct-new.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/rustdoc/doc-notable_trait.wrap-me.html b/tests/rustdoc/doc-notable_trait.wrap-me.html
index 0cc1ee10fd335..e7909669b150a 100644
--- a/tests/rustdoc/doc-notable_trait.wrap-me.html
+++ b/tests/rustdoc/doc-notable_trait.wrap-me.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html
index 7bc9b780197bb..065ce757de1ab 100644
--- a/tests/rustdoc/whitespace-after-where-clause.enum2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html
@@ -1,4 +1,4 @@
-pub enum Cow2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
+pub enum Cow2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
Borrowed(&'a B),
Whatever(u32),
}
\ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html
index d872d516c0943..c647e8d71218e 100644
--- a/tests/rustdoc/whitespace-after-where-clause.struct2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html
@@ -1,4 +1,4 @@
-pub struct Struct2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
+pub struct Struct2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
pub a: &'a B,
pub b: u32,
}
\ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html
index fc78e9b6039b0..66ad30c92001f 100644
--- a/tests/rustdoc/whitespace-after-where-clause.union2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.union2.html
@@ -1,3 +1,3 @@
-pub union Union2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
+pub union Union2<'a, B: ?Sized + ToOwned<dyn Clone> + 'a> {
/* private fields */
}
\ No newline at end of file