Closed
Description
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.