Skip to content

Commit 84c9d11

Browse files
committed
refactor: delete BufInsertFormatted::write_all() (YAGNI)
1 parent 9534d03 commit 84c9d11

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/insert_formatted.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -481,30 +481,6 @@ impl BufInsertFormatted {
481481
std::future::poll_fn(|cx| self.poll_write_inner(data, cx)).await
482482
}
483483

484-
/// Write all of `data` to the connection, flushing the buffer when it becomes full.
485-
///
486-
/// # Not Cancel-Safe
487-
/// This method is not cancel-safe because data may be partially written to the connection
488-
/// between yield points.
489-
#[inline(always)]
490-
pub async fn write_all(&mut self, mut data: &[u8]) -> Result<()> {
491-
std::future::poll_fn(|cx| {
492-
while !data.is_empty() {
493-
let written = ready!(self.poll_write_inner(data, cx))?;
494-
495-
debug_assert_ne!(
496-
written, 0,
497-
"BUG: `poll_write_inner` should never return a zero write"
498-
);
499-
500-
data = &data[written..];
501-
}
502-
503-
Poll::Ready(Ok(()))
504-
})
505-
.await
506-
}
507-
508484
// `poll_write` but it returns `crate::Result` instead of `io::Result`
509485
#[inline(always)]
510486
fn poll_write_inner(&mut self, data: &[u8], cx: &mut Context<'_>) -> Poll<Result<usize>> {

0 commit comments

Comments
 (0)