Skip to content

Commit ed0c997

Browse files
authored
Remove needless borrows and method calls (#2259)
1 parent f521ecc commit ed0c997

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

futures-channel/src/mpsc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ impl<T> UnboundedSenderInner<T> {
483483

484484
/// Returns whether the sender send to this receiver.
485485
fn is_connected_to(&self, inner: &Arc<UnboundedInner<T>>) -> bool {
486-
Arc::ptr_eq(&self.inner, &inner)
486+
Arc::ptr_eq(&self.inner, inner)
487487
}
488488

489489
/// Returns pointer to the Arc containing sender
@@ -664,7 +664,7 @@ impl<T> BoundedSenderInner<T> {
664664

665665
/// Returns whether the sender send to this receiver.
666666
fn is_connected_to(&self, receiver: &Arc<BoundedInner<T>>) -> bool {
667-
Arc::ptr_eq(&self.inner, &receiver)
667+
Arc::ptr_eq(&self.inner, receiver)
668668
}
669669

670670
/// Returns pointer to the Arc containing sender

futures-util/src/future/future/shared.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ where
137137
/// is `COMPLETE`
138138
unsafe fn output(&self) -> &Fut::Output {
139139
match &*self.future_or_output.get() {
140-
FutureOrOutput::Output(ref item) => &item,
140+
FutureOrOutput::Output(ref item) => item,
141141
FutureOrOutput::Future(_) => unreachable!(),
142142
}
143143
}

futures-util/src/io/read_line.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(super) fn read_line_internal<R: AsyncBufRead + ?Sized>(
3838
read: &mut usize,
3939
) -> Poll<io::Result<usize>> {
4040
let ret = ready!(read_until_internal(reader, cx, b'\n', bytes, read));
41-
if str::from_utf8(&bytes).is_err() {
41+
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"))
4444
}))

futures-util/src/io/read_to_string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn read_to_string_internal<R: AsyncRead + ?Sized>(
3838
start_len: usize,
3939
) -> Poll<io::Result<usize>> {
4040
let ret = ready!(read_to_end_internal(reader, cx, bytes, start_len));
41-
if str::from_utf8(&bytes).is_err() {
41+
if str::from_utf8(bytes).is_err() {
4242
Poll::Ready(ret.and_then(|_| {
4343
Err(io::Error::new(
4444
io::ErrorKind::InvalidData,

futures-util/src/io/write_all_vectored.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ mod tests {
186186
(vec![IoSlice::new(&[1, 1, 1]), IoSlice::new(&[2, 2, 2]), IoSlice::new(&[3, 3, 3])], &[1, 1, 1, 2, 2, 2, 3, 3, 3]),
187187
];
188188

189-
for (mut input, wanted) in tests.into_iter() {
189+
for (mut input, wanted) in tests {
190190
let mut dst = test_writer(2, 2);
191191
{
192192
let mut future = dst.write_all_vectored(&mut *input);

futures-util/src/stream/futures_ordered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<Fut: Future> Extend<Fut> for FuturesOrdered<Fut> {
214214
where
215215
I: IntoIterator<Item = Fut>,
216216
{
217-
for item in iter.into_iter() {
217+
for item in iter {
218218
self.push(item);
219219
}
220220
}

futures-util/src/stream/futures_unordered/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ impl<Fut> Extend<Fut> for FuturesUnordered<Fut> {
626626
where
627627
I: IntoIterator<Item = Fut>,
628628
{
629-
for item in iter.into_iter() {
629+
for item in iter {
630630
self.push(item);
631631
}
632632
}

0 commit comments

Comments
 (0)