Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d616f47

Browse files
committedApr 9, 2017
Auto merge of #41084 - QuietMisdreavus:rustdoc-format-redux, r=frewsxcxv,GuillaumeGomez
rustdoc: update formatting of fn signatures and where clauses to match style rfcs Recent updates to style RFCs ([where clauses](rust-lang/style-team#38), [function definitions](rust-lang/style-team#39)) changed the "canonical" style for these items, so this is a rustdoc update to make it emit that style where necessary. This is mainly a conversion from visual indent to block indent, which helps out in situations where there was excessive indent causing lines to wrap regardless. Samples: ![std::iter::IntoIterator](https://cloud.githubusercontent.com/assets/5217170/24712947/e586604c-19e9-11e7-87ae-4fe64d689dc3.png) ![excerpt from std::iter::Iterator](https://cloud.githubusercontent.com/assets/5217170/24713209/91e65112-19ea-11e7-9ff8-d4cf6b31aae1.png) ![std::iter::FromIterator](https://cloud.githubusercontent.com/assets/5217170/24713138/59f36114-19ea-11e7-9dbb-5f5ba7126e2e.png) ![std::cmp::min](https://cloud.githubusercontent.com/assets/5217170/24713038/1bab88b4-19ea-11e7-935d-defed5648de4.png) ![some trait impls on std::collections::HashMap](https://cloud.githubusercontent.com/assets/5217170/24713251/b7ef69e8-19ea-11e7-94a7-e01fbf89fa31.png) ![`fn extract_code_blocks`, an example given in #40687](https://cloud.githubusercontent.com/assets/5217170/24713159/672717cc-19ea-11e7-9acb-6ac278b90339.png) ![excerpt from itertools::Itertools](https://cloud.githubusercontent.com/assets/5217170/24713323/f06716ea-19ea-11e7-94cc-6ef68d9980ec.png) fixes #41025 and #40687 r? @rust-lang/docs
2 parents fa332c9 + 8dd4c44 commit d616f47

File tree

6 files changed

+137
-133
lines changed

6 files changed

+137
-133
lines changed
 

‎src/librustdoc/html/format.rs

Lines changed: 76 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,38 @@ pub struct UnsafetySpace(pub hir::Unsafety);
4141
/// with a space after it.
4242
#[derive(Copy, Clone)]
4343
pub struct ConstnessSpace(pub hir::Constness);
44-
/// Wrapper struct for properly emitting a method declaration.
45-
pub struct Method<'a>(pub &'a clean::FnDecl, pub usize);
4644
/// Similar to VisSpace, but used for mutability
4745
#[derive(Copy, Clone)]
4846
pub struct MutableSpace(pub clean::Mutability);
4947
/// Similar to VisSpace, but used for mutability
5048
#[derive(Copy, Clone)]
5149
pub struct RawMutableSpace(pub clean::Mutability);
52-
/// Wrapper struct for emitting a where clause from Generics.
53-
pub struct WhereClause<'a>(pub &'a clean::Generics, pub usize);
5450
/// Wrapper struct for emitting type parameter bounds.
5551
pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
5652
/// Wrapper struct for emitting a comma-separated list of items
5753
pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
5854
pub struct AbiSpace(pub Abi);
5955

56+
/// Wrapper struct for properly emitting a method declaration.
57+
pub struct Method<'a> {
58+
/// The declaration to emit.
59+
pub decl: &'a clean::FnDecl,
60+
/// The length of the function's "name", used to determine line-wrapping.
61+
pub name_len: usize,
62+
/// The number of spaces to indent each successive line with, if line-wrapping is necessary.
63+
pub indent: usize,
64+
}
65+
66+
/// Wrapper struct for emitting a where clause from Generics.
67+
pub struct WhereClause<'a>{
68+
/// The Generics from which to emit a where clause.
69+
pub gens: &'a clean::Generics,
70+
/// The number of spaces to indent each line with.
71+
pub indent: usize,
72+
/// Whether the where clause needs to add a comma and newline after the last bound.
73+
pub end_newline: bool,
74+
}
75+
6076
pub struct HRef<'a> {
6177
pub did: DefId,
6278
pub text: &'a str,
@@ -167,24 +183,27 @@ impl fmt::Display for clean::Generics {
167183

168184
impl<'a> fmt::Display for WhereClause<'a> {
169185
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
170-
let &WhereClause(gens, pad) = self;
186+
let &WhereClause { gens, indent, end_newline } = self;
171187
if gens.where_predicates.is_empty() {
172188
return Ok(());
173189
}
174190
let mut clause = String::new();
175191
if f.alternate() {
176-
clause.push_str(" where ");
192+
clause.push_str(" where");
177193
} else {
178-
clause.push_str(" <span class=\"where fmt-newline\">where ");
194+
if end_newline {
195+
clause.push_str(" <span class=\"where fmt-newline\">where");
196+
} else {
197+
clause.push_str(" <span class=\"where\">where");
198+
}
179199
}
180200
for (i, pred) in gens.where_predicates.iter().enumerate() {
181-
if i > 0 {
182-
if f.alternate() {
183-
clause.push_str(", ");
184-
} else {
185-
clause.push_str(",<br>");
186-
}
201+
if f.alternate() {
202+
clause.push(' ');
203+
} else {
204+
clause.push_str("<br>");
187205
}
206+
188207
match pred {
189208
&clean::WherePredicate::BoundPredicate { ref ty, ref bounds } => {
190209
let bounds = bounds;
@@ -213,21 +232,29 @@ impl<'a> fmt::Display for WhereClause<'a> {
213232
}
214233
}
215234
}
235+
236+
if i < gens.where_predicates.len() - 1 || end_newline {
237+
clause.push(',');
238+
}
216239
}
240+
241+
if end_newline {
242+
//add a space so stripping <br> tags and breaking spaces still renders properly
243+
if f.alternate() {
244+
clause.push(' ');
245+
} else {
246+
clause.push_str("&nbsp;");
247+
}
248+
}
249+
217250
if !f.alternate() {
218251
clause.push_str("</span>");
219-
let plain = format!("{:#}", self);
220-
if plain.len() + pad > 80 {
221-
// break it onto its own line regardless, but make sure method impls and trait
222-
// blocks keep their fixed padding (2 and 9, respectively)
223-
let padding = if pad > 10 {
224-
repeat("&nbsp;").take(8).collect::<String>()
225-
} else {
226-
repeat("&nbsp;").take(pad + 6).collect::<String>()
227-
};
228-
clause = clause.replace("<br>", &format!("<br>{}", padding));
229-
} else {
230-
clause = clause.replace("<br>", " ");
252+
let padding = repeat("&nbsp;").take(indent + 4).collect::<String>();
253+
clause = clause.replace("<br>", &format!("<br>{}", padding));
254+
clause.insert_str(0, &repeat("&nbsp;").take(indent.saturating_sub(1))
255+
.collect::<String>());
256+
if !end_newline {
257+
clause.insert_str(0, "<br>");
231258
}
232259
}
233260
write!(f, "{}", clause)
@@ -838,43 +865,35 @@ fn fmt_impl(i: &clean::Impl,
838865
f: &mut fmt::Formatter,
839866
link_trait: bool,
840867
use_absolute: bool) -> fmt::Result {
841-
let mut plain = String::new();
842-
843868
if f.alternate() {
844869
write!(f, "impl{:#} ", i.generics)?;
845870
} else {
846871
write!(f, "impl{} ", i.generics)?;
847872
}
848-
plain.push_str(&format!("impl{:#} ", i.generics));
849873

850874
if let Some(ref ty) = i.trait_ {
851875
if i.polarity == Some(clean::ImplPolarity::Negative) {
852876
write!(f, "!")?;
853-
plain.push_str("!");
854877
}
855878

856879
if link_trait {
857880
fmt::Display::fmt(ty, f)?;
858-
plain.push_str(&format!("{:#}", ty));
859881
} else {
860882
match *ty {
861883
clean::ResolvedPath { typarams: None, ref path, is_generic: false, .. } => {
862884
let last = path.segments.last().unwrap();
863885
fmt::Display::fmt(&last.name, f)?;
864886
fmt::Display::fmt(&last.params, f)?;
865-
plain.push_str(&format!("{:#}{:#}", last.name, last.params));
866887
}
867888
_ => unreachable!(),
868889
}
869890
}
870891
write!(f, " for ")?;
871-
plain.push_str(" for ");
872892
}
873893

874894
fmt_type(&i.for_, f, use_absolute, true)?;
875-
plain.push_str(&format!("{:#}", i.for_));
876895

877-
fmt::Display::fmt(&WhereClause(&i.generics, plain.len() + 1), f)?;
896+
fmt::Display::fmt(&WhereClause { gens: &i.generics, indent: 0, end_newline: true }, f)?;
878897
Ok(())
879898
}
880899

@@ -939,12 +958,15 @@ impl fmt::Display for clean::FnDecl {
939958

940959
impl<'a> fmt::Display for Method<'a> {
941960
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
942-
let decl = self.0;
943-
let indent = self.1;
961+
let &Method { decl, name_len, indent } = self;
944962
let amp = if f.alternate() { "&" } else { "&amp;" };
945963
let mut args = String::new();
946964
let mut args_plain = String::new();
947965
for (i, input) in decl.inputs.values.iter().enumerate() {
966+
if i == 0 {
967+
args.push_str("<br>");
968+
}
969+
948970
if let Some(selfty) = input.to_self() {
949971
match selfty {
950972
clean::SelfValue => {
@@ -970,7 +992,7 @@ impl<'a> fmt::Display for Method<'a> {
970992
}
971993
} else {
972994
if i > 0 {
973-
args.push_str("<br> ");
995+
args.push_str(" <br>");
974996
args_plain.push_str(" ");
975997
}
976998
if !input.name.is_empty() {
@@ -986,8 +1008,8 @@ impl<'a> fmt::Display for Method<'a> {
9861008
args_plain.push_str(&format!("{:#}", input.type_));
9871009
}
9881010
if i + 1 < decl.inputs.values.len() {
989-
args.push_str(",");
990-
args_plain.push_str(",");
1011+
args.push(',');
1012+
args_plain.push(',');
9911013
}
9921014
}
9931015

@@ -1003,27 +1025,23 @@ impl<'a> fmt::Display for Method<'a> {
10031025
format!("{}", decl.output)
10041026
};
10051027

1006-
let mut output: String;
1007-
let plain: String;
1008-
let pad = repeat(" ").take(indent).collect::<String>();
1009-
if arrow.is_empty() {
1010-
output = format!("({})", args);
1011-
plain = format!("{}({})", pad, args_plain);
1028+
let pad = repeat(" ").take(name_len).collect::<String>();
1029+
let plain = format!("{pad}({args}){arrow}",
1030+
pad = pad,
1031+
args = args_plain,
1032+
arrow = arrow_plain);
1033+
1034+
let output = if plain.len() > 80 {
1035+
let full_pad = format!("<br>{}", repeat("&nbsp;").take(indent + 4).collect::<String>());
1036+
let close_pad = format!("<br>{}", repeat("&nbsp;").take(indent).collect::<String>());
1037+
format!("({args}{close}){arrow}",
1038+
args = args.replace("<br>", &full_pad),
1039+
close = close_pad,
1040+
arrow = arrow)
10121041
} else {
1013-
output = format!("({args})<br>{arrow}", args = args, arrow = arrow);
1014-
plain = format!("{pad}({args}){arrow}",
1015-
pad = pad,
1016-
args = args_plain,
1017-
arrow = arrow_plain);
1018-
}
1042+
format!("({args}){arrow}", args = args.replace("<br>", ""), arrow = arrow)
1043+
};
10191044

1020-
if plain.len() > 80 {
1021-
let pad = repeat("&nbsp;").take(indent).collect::<String>();
1022-
let pad = format!("<br>{}", pad);
1023-
output = output.replace("<br>", &pad);
1024-
} else {
1025-
output = output.replace("<br>", "");
1026-
}
10271045
if f.alternate() {
10281046
write!(f, "{}", output.replace("<br>", "\n"))
10291047
} else {

‎src/librustdoc/html/render.rs

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,13 +2016,13 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
20162016
UnstableFeatures::Allow => f.constness,
20172017
_ => hir::Constness::NotConst
20182018
};
2019-
let indent = format!("{}{}{}{:#}fn {}{:#}",
2020-
VisSpace(&it.visibility),
2021-
ConstnessSpace(vis_constness),
2022-
UnsafetySpace(f.unsafety),
2023-
AbiSpace(f.abi),
2024-
it.name.as_ref().unwrap(),
2025-
f.generics).len();
2019+
let name_len = format!("{}{}{}{:#}fn {}{:#}",
2020+
VisSpace(&it.visibility),
2021+
ConstnessSpace(vis_constness),
2022+
UnsafetySpace(f.unsafety),
2023+
AbiSpace(f.abi),
2024+
it.name.as_ref().unwrap(),
2025+
f.generics).len();
20262026
write!(w, "<pre class='rust fn'>")?;
20272027
render_attributes(w, it)?;
20282028
write!(w, "{vis}{constness}{unsafety}{abi}fn \
@@ -2033,8 +2033,12 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
20332033
abi = AbiSpace(f.abi),
20342034
name = it.name.as_ref().unwrap(),
20352035
generics = f.generics,
2036-
where_clause = WhereClause(&f.generics, 2),
2037-
decl = Method(&f.decl, indent))?;
2036+
where_clause = WhereClause { gens: &f.generics, indent: 0, end_newline: true },
2037+
decl = Method {
2038+
decl: &f.decl,
2039+
name_len: name_len,
2040+
indent: 0,
2041+
})?;
20382042
document(w, cx, it)
20392043
}
20402044

@@ -2062,14 +2066,18 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
20622066
// Output the trait definition
20632067
write!(w, "<pre class='rust trait'>")?;
20642068
render_attributes(w, it)?;
2065-
write!(w, "{}{}trait {}{}{}{} ",
2069+
write!(w, "{}{}trait {}{}{}",
20662070
VisSpace(&it.visibility),
20672071
UnsafetySpace(t.unsafety),
20682072
it.name.as_ref().unwrap(),
20692073
t.generics,
2070-
bounds,
2071-
// Where clauses in traits are indented nine spaces, per rustdoc.css
2072-
WhereClause(&t.generics, 9))?;
2074+
bounds)?;
2075+
2076+
if !t.generics.where_predicates.is_empty() {
2077+
write!(w, "{}", WhereClause { gens: &t.generics, indent: 0, end_newline: true })?;
2078+
} else {
2079+
write!(w, " ")?;
2080+
}
20732081

20742082
let types = t.items.iter().filter(|m| m.is_associated_type()).collect::<Vec<_>>();
20752083
let consts = t.items.iter().filter(|m| m.is_associated_const()).collect::<Vec<_>>();
@@ -2108,7 +2116,14 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21082116
for m in &provided {
21092117
write!(w, " ")?;
21102118
render_assoc_item(w, m, AssocItemLink::Anchor(None), ItemType::Trait)?;
2111-
write!(w, " {{ ... }}\n")?;
2119+
match m.inner {
2120+
clean::MethodItem(ref inner) if !inner.generics.where_predicates.is_empty() => {
2121+
write!(w, ",\n {{ ... }}\n")?;
2122+
},
2123+
_ => {
2124+
write!(w, " {{ ... }}\n")?;
2125+
},
2126+
}
21122127
}
21132128
write!(w, "}}")?;
21142129
}
@@ -2342,21 +2357,17 @@ fn render_assoc_item(w: &mut fmt::Formatter,
23422357
} else {
23432358
hir::Constness::NotConst
23442359
};
2345-
let prefix = format!("{}{}{:#}fn {}{:#}",
2346-
ConstnessSpace(vis_constness),
2347-
UnsafetySpace(unsafety),
2348-
AbiSpace(abi),
2349-
name,
2350-
*g);
2351-
let mut indent = prefix.len();
2352-
let where_indent = if parent == ItemType::Trait {
2353-
indent += 4;
2354-
8
2355-
} else if parent == ItemType::Impl {
2356-
2
2360+
let mut head_len = format!("{}{}{:#}fn {}{:#}",
2361+
ConstnessSpace(vis_constness),
2362+
UnsafetySpace(unsafety),
2363+
AbiSpace(abi),
2364+
name,
2365+
*g).len();
2366+
let (indent, end_newline) = if parent == ItemType::Trait {
2367+
head_len += 4;
2368+
(4, false)
23572369
} else {
2358-
let prefix = prefix + &format!("{:#}", Method(d, indent));
2359-
prefix.lines().last().unwrap().len() + 1
2370+
(0, true)
23602371
};
23612372
write!(w, "{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
23622373
{generics}{decl}{where_clause}",
@@ -2366,8 +2377,16 @@ fn render_assoc_item(w: &mut fmt::Formatter,
23662377
href = href,
23672378
name = name,
23682379
generics = *g,
2369-
decl = Method(d, indent),
2370-
where_clause = WhereClause(g, where_indent))
2380+
decl = Method {
2381+
decl: d,
2382+
name_len: head_len,
2383+
indent: indent,
2384+
},
2385+
where_clause = WhereClause {
2386+
gens: g,
2387+
indent: indent,
2388+
end_newline: end_newline,
2389+
})
23712390
}
23722391
match item.inner {
23732392
clean::StrippedItem(..) => Ok(()),
@@ -2480,15 +2499,11 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
24802499
e: &clean::Enum) -> fmt::Result {
24812500
write!(w, "<pre class='rust enum'>")?;
24822501
render_attributes(w, it)?;
2483-
let padding = format!("{}enum {}{:#} ",
2484-
VisSpace(&it.visibility),
2485-
it.name.as_ref().unwrap(),
2486-
e.generics).len();
24872502
write!(w, "{}enum {}{}{}",
24882503
VisSpace(&it.visibility),
24892504
it.name.as_ref().unwrap(),
24902505
e.generics,
2491-
WhereClause(&e.generics, padding))?;
2506+
WhereClause { gens: &e.generics, indent: 0, end_newline: true })?;
24922507
if e.variants.is_empty() && !e.variants_stripped {
24932508
write!(w, " {{}}")?;
24942509
} else {
@@ -2662,23 +2677,17 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
26622677
fields: &[clean::Item],
26632678
tab: &str,
26642679
structhead: bool) -> fmt::Result {
2665-
let mut plain = String::new();
26662680
write!(w, "{}{}{}",
26672681
VisSpace(&it.visibility),
26682682
if structhead {"struct "} else {""},
26692683
it.name.as_ref().unwrap())?;
2670-
plain.push_str(&format!("{}{}{}",
2671-
VisSpace(&it.visibility),
2672-
if structhead {"struct "} else {""},
2673-
it.name.as_ref().unwrap()));
26742684
if let Some(g) = g {
2675-
plain.push_str(&format!("{:#}", g));
26762685
write!(w, "{}", g)?
26772686
}
26782687
match ty {
26792688
doctree::Plain => {
26802689
if let Some(g) = g {
2681-
write!(w, "{}", WhereClause(g, plain.len() + 1))?
2690+
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: true })?
26822691
}
26832692
let mut has_visible_fields = false;
26842693
write!(w, " {{")?;
@@ -2707,35 +2716,30 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
27072716
}
27082717
doctree::Tuple => {
27092718
write!(w, "(")?;
2710-
plain.push_str("(");
27112719
for (i, field) in fields.iter().enumerate() {
27122720
if i > 0 {
27132721
write!(w, ", ")?;
2714-
plain.push_str(", ");
27152722
}
27162723
match field.inner {
27172724
clean::StrippedItem(box clean::StructFieldItem(..)) => {
2718-
plain.push_str("_");
27192725
write!(w, "_")?
27202726
}
27212727
clean::StructFieldItem(ref ty) => {
2722-
plain.push_str(&format!("{}{:#}", VisSpace(&field.visibility), *ty));
27232728
write!(w, "{}{}", VisSpace(&field.visibility), *ty)?
27242729
}
27252730
_ => unreachable!()
27262731
}
27272732
}
27282733
write!(w, ")")?;
2729-
plain.push_str(")");
27302734
if let Some(g) = g {
2731-
write!(w, "{}", WhereClause(g, plain.len() + 1))?
2735+
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: false })?
27322736
}
27332737
write!(w, ";")?;
27342738
}
27352739
doctree::Unit => {
27362740
// Needed for PhantomData.
27372741
if let Some(g) = g {
2738-
write!(w, "{}", WhereClause(g, plain.len() + 1))?
2742+
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: false })?
27392743
}
27402744
write!(w, ";")?;
27412745
}
@@ -2748,19 +2752,13 @@ fn render_union(w: &mut fmt::Formatter, it: &clean::Item,
27482752
fields: &[clean::Item],
27492753
tab: &str,
27502754
structhead: bool) -> fmt::Result {
2751-
let mut plain = String::new();
27522755
write!(w, "{}{}{}",
27532756
VisSpace(&it.visibility),
27542757
if structhead {"union "} else {""},
27552758
it.name.as_ref().unwrap())?;
2756-
plain.push_str(&format!("{}{}{}",
2757-
VisSpace(&it.visibility),
2758-
if structhead {"union "} else {""},
2759-
it.name.as_ref().unwrap()));
27602759
if let Some(g) = g {
27612760
write!(w, "{}", g)?;
2762-
plain.push_str(&format!("{:#}", g));
2763-
write!(w, "{}", WhereClause(g, plain.len() + 1))?;
2761+
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: true })?;
27642762
}
27652763

27662764
write!(w, " {{\n{}", tab)?;
@@ -3059,13 +3057,12 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
30593057

30603058
fn item_typedef(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
30613059
t: &clean::Typedef) -> fmt::Result {
3062-
let indent = format!("type {}{:#} ", it.name.as_ref().unwrap(), t.generics).len();
30633060
write!(w, "<pre class='rust typedef'>")?;
30643061
render_attributes(w, it)?;
30653062
write!(w, "type {}{}{where_clause} = {type_};</pre>",
30663063
it.name.as_ref().unwrap(),
30673064
t.generics,
3068-
where_clause = WhereClause(&t.generics, indent),
3065+
where_clause = WhereClause { gens: &t.generics, indent: 0, end_newline: true },
30693066
type_ = t.type_)?;
30703067

30713068
document(w, cx, it)

‎src/librustdoc/html/static/rustdoc.css

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,6 @@ h4 > code, h3 > code, .invisible > code {
379379
.content .where.fmt-newline {
380380
display: block;
381381
}
382-
/* Bit of whitespace to indent it */
383-
.content .method .where::before,
384-
.content .fn .where::before,
385-
.content .where.fmt-newline::before {
386-
content: ' ';
387-
}
388382

389383
.content .methods > div { margin-left: 40px; }
390384

@@ -399,11 +393,6 @@ h4 > code, h3 > code, .invisible > code {
399393
font-size: 90%;
400394
}
401395

402-
/* Shift where in trait listing down a line */
403-
pre.trait .where::before {
404-
content: '\a ';
405-
}
406-
407396
nav {
408397
border-bottom: 1px solid;
409398
padding-bottom: 10px;
@@ -772,4 +761,4 @@ span.since {
772761
nav.sub, .content .out-of-band, .collapse-toggle {
773762
display: none;
774763
}
775-
}
764+
}

‎src/test/rustdoc/impl-parts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl AnOibit for .. {}
1717
pub struct Foo<T> { field: T }
1818

1919
// @has impl_parts/struct.Foo.html '//*[@class="impl"]//code' \
20-
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync"
20+
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync,"
2121
// @has impl_parts/trait.AnOibit.html '//*[@class="item-list"]//code' \
22-
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync"
22+
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync,"
2323
impl<T: Clone> !AnOibit for Foo<T> where T: Sync {}

‎src/test/rustdoc/issue-20727-4.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
3535

3636
pub mod reexport {
3737
// @has issue_20727_4/reexport/trait.Index.html
38-
// @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized {'
38+
// @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized, {'
3939
// @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
4040
// @has - '//*[@class="rust trait"]' \
4141
// 'fn index(&self, index: Idx) -> &Self::Output'
4242
pub use issue_20727::Index;
4343

4444
// @has issue_20727_4/reexport/trait.IndexMut.html
4545
// @has - '//*[@class="rust trait"]' \
46-
// 'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized {'
46+
// 'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized, {'
4747
// @has - '//*[@class="rust trait"]' \
4848
// 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
4949
pub use issue_20727::IndexMut;

‎src/test/rustdoc/where.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ pub enum Foxtrot<F> { Foxtrot1(F) }
4444
impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}
4545

4646
// @has foo/type.Golf.html '//pre[@class="rust typedef"]' \
47-
// "type Golf<T> where T: Clone = (T, T)"
47+
// "type Golf<T> where T: Clone, = (T, T)"
4848
pub type Golf<T> where T: Clone = (T, T);

0 commit comments

Comments
 (0)
Please sign in to comment.