Skip to content

Commit b232653

Browse files
taiki-ecramertj
authored andcommitted
Do not return &mut Self
1 parent ae72278 commit b232653

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

futures-util/src/io/window.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ impl<T: AsRef<[u8]>> Window<T> {
6767

6868
/// Changes the range of this window to the range specified.
6969
///
70-
/// Returns the windows back to chain multiple calls to this method.
71-
///
7270
/// # Panics
7371
///
7472
/// This method will panic if `range` is out of bounds for the underlying
7573
/// slice or if [`start_bound()`] of `range` comes after the [`end_bound()`].
7674
///
7775
/// [`start_bound()`]: std::ops::RangeBounds::start_bound
7876
/// [`end_bound()`]: std::ops::RangeBounds::end_bound
79-
pub fn set<R: RangeBounds<usize>>(&mut self, range: R) -> &mut Self {
77+
pub fn set<R: RangeBounds<usize>>(&mut self, range: R) {
8078
let start = match range.start_bound() {
8179
Bound::Included(n) => *n,
8280
Bound::Excluded(n) => *n + 1,
@@ -93,7 +91,6 @@ impl<T: AsRef<[u8]>> Window<T> {
9391

9492
self.range.start = start;
9593
self.range.end = end;
96-
self
9794
}
9895
}
9996

futures/tests/io_window.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use futures::io::Window;
33
#[test]
44
fn set() {
55
let mut buffer = Window::new(&[1, 2, 3]);
6-
buffer.set(..3)
7-
.set(3..3)
8-
.set(3..=2) // == 3..3
9-
.set(0..2);
6+
buffer.set(..3);
7+
buffer.set(3..3);
8+
buffer.set(3..=2); // == 3..3
9+
buffer.set(0..2);
1010

1111
assert_eq!(buffer.as_ref(), &[1, 2]);
1212
}

0 commit comments

Comments
 (0)