Skip to content

Commit a762a0d

Browse files
taiki-ecramertj
authored andcommitted
Unify the order of the arguments of read_*_internal functions
Unify to the same order as public read_* methods.
1 parent 4d5743a commit a762a0d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

futures-util/src/io/lines.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<R: AsyncBufRead> Stream for Lines<R> {
3535
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
3636
let Self { reader, buf, bytes, read } = unsafe { self.get_unchecked_mut() };
3737
let reader = unsafe { Pin::new_unchecked(reader) };
38-
let n = ready!(read_line_internal(reader, buf, bytes, read, cx))?;
38+
let n = ready!(read_line_internal(reader, cx, buf, bytes, read))?;
3939
if n == 0 && buf.is_empty() {
4040
return Poll::Ready(None)
4141
}

futures-util/src/io/read_line.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ impl<'a, R: AsyncBufRead + ?Sized + Unpin> ReadLine<'a, R> {
3232

3333
pub(super) fn read_line_internal<R: AsyncBufRead + ?Sized>(
3434
reader: Pin<&mut R>,
35+
cx: &mut Context<'_>,
3536
buf: &mut String,
3637
bytes: &mut Vec<u8>,
3738
read: &mut usize,
38-
cx: &mut Context<'_>,
3939
) -> Poll<io::Result<usize>> {
40-
let ret = ready!(read_until_internal(reader, b'\n', bytes, read, cx));
40+
let ret = ready!(read_until_internal(reader, cx, b'\n', bytes, read));
4141
if str::from_utf8(&bytes).is_err() {
4242
Poll::Ready(ret.and_then(|_| {
4343
Err(io::Error::new(io::ErrorKind::InvalidData, "stream did not contain valid UTF-8"))
@@ -56,6 +56,6 @@ impl<R: AsyncBufRead + ?Sized + Unpin> Future for ReadLine<'_, R> {
5656

5757
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
5858
let Self { reader, buf, bytes, read } = &mut *self;
59-
read_line_internal(Pin::new(reader), buf, bytes, read, cx)
59+
read_line_internal(Pin::new(reader), cx, buf, bytes, read)
6060
}
6161
}

futures-util/src/io/read_until.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ impl<'a, R: AsyncBufRead + ?Sized + Unpin> ReadUntil<'a, R> {
2525

2626
pub(super) fn read_until_internal<R: AsyncBufRead + ?Sized>(
2727
mut reader: Pin<&mut R>,
28+
cx: &mut Context<'_>,
2829
byte: u8,
2930
buf: &mut Vec<u8>,
3031
read: &mut usize,
31-
cx: &mut Context<'_>,
3232
) -> Poll<io::Result<usize>> {
3333
loop {
3434
let (done, used) = {
@@ -54,6 +54,6 @@ impl<R: AsyncBufRead + ?Sized + Unpin> Future for ReadUntil<'_, R> {
5454

5555
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
5656
let Self { reader, byte, buf, read } = &mut *self;
57-
read_until_internal(Pin::new(reader), *byte, buf, read, cx)
57+
read_until_internal(Pin::new(reader), cx, *byte, buf, read)
5858
}
5959
}

0 commit comments

Comments
 (0)