Closed
Description
I have a function with this signature:
pub fn extract_code_blocks<'md, I: Iterator<Item=Event<'md>>>(md_events: I) -> Result<Vec<CodeBlock>, Error>
So far so good. In the original source, it's all on one line, but Rustdoc uses quite a large font, so it makes sense to split it up. The problem is with the way it tries to reformat the signature, i.e., by putting the return type directly beneath the opening bracket of the arguments:
And while it doesn't look great on a wide screen, resizing the window makes it look just broken:
To get a good idea how to format functions it might be wise to check the discussion of the fmt team in rust-lang/style-team#39, but I don't think Rustdoc has the same constraints as rustfmt.
In particular, I would render the function signature quoted above as:
pub fn extract_code_blocks<'md, I: Iterator<Item=Event<'md>>>(
md_events: I,
) -> Result<Vec<CodeBlock>, Error>
alternatively,
pub fn extract_code_blocks<'md, I: Iterator<Item=Event<'md>>>
(md_events: I)
-> Result<Vec<CodeBlock>, Error>
or even (introducing where clauses):
pub fn extract_code_blocks<'md, I>(md_events: I)
-> Result<Vec<CodeBlock>, Error>
where I: Iterator<Item=Event<'md>>
Metadata
Metadata
Assignees
Labels
No labels