Skip to content

Generated trait methods have trailing spaces after arguments #98803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
joshtriplett opened this issue Jul 2, 2022 · 1 comment · Fixed by #98806
Closed

Generated trait methods have trailing spaces after arguments #98803

joshtriplett opened this issue Jul 2, 2022 · 1 comment · Fixed by #98806
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@joshtriplett
Copy link
Member

See https://docs.rs/async-std/latest/async_std/io/trait.Write.html for an example. Copy-pasting the trait implementation produces:

pub trait Write {
    fn poll_write(
        self: Pin<&mut Self>, 
        cx: &mut Context<'_>, 
        buf: &[u8]
    ) -> Poll<Result<usize, Error>>;
    fn poll_flush(
        self: Pin<&mut Self>, 
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Error>>;
    fn poll_close(
        self: Pin<&mut Self>, 
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Error>>;

    fn poll_write_vectored(
        self: Pin<&mut Self>, 
        cx: &mut Context<'_>, 
        bufs: &[IoSlice<'_>]
    ) -> Poll<Result<usize, Error>> { ... }
}

Note the trailing spaces after every argument but the last. (Also note the lack of trailing comma.)

Copy-pasting the trait methods is a common first step when implementing a trait. Ideally, the methods should be formatted in a way that copy-pasting produces what the user should write.

@joshtriplett joshtriplett added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Jul 2, 2022
@GuillaumeGomez
Copy link
Member

It reminds me of #98256. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants