rustdoc: fix position of default
in method rendering
This commit is contained in:
parent
c79d6be6a2
commit
c67aea7fdd
1 changed files with 4 additions and 4 deletions
|
@ -820,6 +820,7 @@ fn assoc_method(
|
||||||
let header = meth.fn_header(tcx).expect("Trying to get header from a non-function item");
|
let header = meth.fn_header(tcx).expect("Trying to get header from a non-function item");
|
||||||
let name = meth.name.as_ref().unwrap();
|
let name = meth.name.as_ref().unwrap();
|
||||||
let vis = visibility_print_with_space(meth.visibility(tcx), meth.item_id, cx).to_string();
|
let vis = visibility_print_with_space(meth.visibility(tcx), meth.item_id, cx).to_string();
|
||||||
|
let defaultness = print_default_space(meth.is_default());
|
||||||
// FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove
|
// FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove
|
||||||
// this condition.
|
// this condition.
|
||||||
let constness = match render_mode {
|
let constness = match render_mode {
|
||||||
|
@ -830,7 +831,6 @@ fn assoc_method(
|
||||||
};
|
};
|
||||||
let asyncness = header.asyncness.print_with_space();
|
let asyncness = header.asyncness.print_with_space();
|
||||||
let unsafety = header.unsafety.print_with_space();
|
let unsafety = header.unsafety.print_with_space();
|
||||||
let defaultness = print_default_space(meth.is_default());
|
|
||||||
let abi = print_abi_with_space(header.abi).to_string();
|
let abi = print_abi_with_space(header.abi).to_string();
|
||||||
let href = assoc_href_attr(meth, link, cx);
|
let href = assoc_href_attr(meth, link, cx);
|
||||||
|
|
||||||
|
@ -838,10 +838,10 @@ fn assoc_method(
|
||||||
let generics_len = format!("{:#}", g.print(cx)).len();
|
let generics_len = format!("{:#}", g.print(cx)).len();
|
||||||
let mut header_len = "fn ".len()
|
let mut header_len = "fn ".len()
|
||||||
+ vis.len()
|
+ vis.len()
|
||||||
|
+ defaultness.len()
|
||||||
+ constness.len()
|
+ constness.len()
|
||||||
+ asyncness.len()
|
+ asyncness.len()
|
||||||
+ unsafety.len()
|
+ unsafety.len()
|
||||||
+ defaultness.len()
|
|
||||||
+ abi.len()
|
+ abi.len()
|
||||||
+ name.as_str().len()
|
+ name.as_str().len()
|
||||||
+ generics_len;
|
+ generics_len;
|
||||||
|
@ -860,14 +860,14 @@ fn assoc_method(
|
||||||
w.reserve(header_len + "<a href=\"\" class=\"fn\">{".len() + "</a>".len());
|
w.reserve(header_len + "<a href=\"\" class=\"fn\">{".len() + "</a>".len());
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
"{indent}{vis}{constness}{asyncness}{unsafety}{defaultness}{abi}fn \
|
"{indent}{vis}{defaultness}{constness}{asyncness}{unsafety}{abi}fn \
|
||||||
<a{href} class=\"fn\">{name}</a>{generics}{decl}{notable_traits}{where_clause}",
|
<a{href} class=\"fn\">{name}</a>{generics}{decl}{notable_traits}{where_clause}",
|
||||||
indent = indent_str,
|
indent = indent_str,
|
||||||
vis = vis,
|
vis = vis,
|
||||||
|
defaultness = defaultness,
|
||||||
constness = constness,
|
constness = constness,
|
||||||
asyncness = asyncness,
|
asyncness = asyncness,
|
||||||
unsafety = unsafety,
|
unsafety = unsafety,
|
||||||
defaultness = defaultness,
|
|
||||||
abi = abi,
|
abi = abi,
|
||||||
href = href,
|
href = href,
|
||||||
name = name,
|
name = name,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue