Skip to content

Commit 5f708f3

Browse files
authored
Merge pull request #270 from k-nasa/fix_clippy_warn
Fix clippy warning
2 parents 46ffe6a + cc21bdf commit 5f708f3

File tree

15 files changed

+36
-36
lines changed

15 files changed

+36
-36
lines changed

src/fs/dir_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::task::blocking;
1414
///
1515
/// [`os::unix::fs::DirBuilderExt`]: ../os/unix/fs/trait.DirBuilderExt.html
1616
/// [`std::fs::DirBuilder`]: https://doc.rust-lang.org/std/fs/struct.DirBuilder.html
17-
#[derive(Debug)]
17+
#[derive(Debug, Default)]
1818
pub struct DirBuilder {
1919
/// Set to `true` if non-existent parent directories should be created.
2020
recursive: bool,

src/fs/open_options.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ impl OpenOptions {
290290
}
291291
}
292292

293+
impl Default for OpenOptions {
294+
fn default() -> Self {
295+
Self::new()
296+
}
297+
}
298+
293299
cfg_if! {
294300
if #[cfg(feature = "docs")] {
295301
use crate::os::unix::fs::OpenOptionsExt;

src/io/stderr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Write for Stderr {
117117

118118
// Start the operation asynchronously.
119119
*state = State::Busy(blocking::spawn(async move {
120-
let res = std::io::Write::write(&mut inner.stderr, &mut inner.buf);
120+
let res = std::io::Write::write(&mut inner.stderr, &inner.buf);
121121
inner.last_op = Some(Operation::Write(res));
122122
State::Idle(Some(inner))
123123
}));

src/io/stdout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Write for Stdout {
117117

118118
// Start the operation asynchronously.
119119
*state = State::Busy(blocking::spawn(async move {
120-
let res = std::io::Write::write(&mut inner.stdout, &mut inner.buf);
120+
let res = std::io::Write::write(&mut inner.stdout, &inner.buf);
121121
inner.last_op = Some(Operation::Write(res));
122122
State::Idle(Some(inner))
123123
}));

src/net/udp/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,14 @@ impl UdpSocket {
391391
/// let mdns_addr = Ipv4Addr::new(224, 0, 0, 123);
392392
///
393393
/// let socket = UdpSocket::bind("127.0.0.1:0").await?;
394-
/// socket.join_multicast_v4(&mdns_addr, &interface)?;
394+
/// socket.join_multicast_v4(mdns_addr, interface)?;
395395
/// #
396396
/// # Ok(()) }) }
397397
/// ```
398-
pub fn join_multicast_v4(&self, multiaddr: &Ipv4Addr, interface: &Ipv4Addr) -> io::Result<()> {
398+
pub fn join_multicast_v4(&self, multiaddr: Ipv4Addr, interface: Ipv4Addr) -> io::Result<()> {
399399
self.watcher
400400
.get_ref()
401-
.join_multicast_v4(multiaddr, interface)
401+
.join_multicast_v4(&multiaddr, &interface)
402402
}
403403

404404
/// Executes an operation of the `IPV6_ADD_MEMBERSHIP` type.
@@ -435,10 +435,10 @@ impl UdpSocket {
435435
/// For more information about this option, see [`join_multicast_v4`].
436436
///
437437
/// [`join_multicast_v4`]: #method.join_multicast_v4
438-
pub fn leave_multicast_v4(&self, multiaddr: &Ipv4Addr, interface: &Ipv4Addr) -> io::Result<()> {
438+
pub fn leave_multicast_v4(&self, multiaddr: Ipv4Addr, interface: Ipv4Addr) -> io::Result<()> {
439439
self.watcher
440440
.get_ref()
441-
.leave_multicast_v4(multiaddr, interface)
441+
.leave_multicast_v4(&multiaddr, &interface)
442442
}
443443

444444
/// Executes an operation of the `IPV6_DROP_MEMBERSHIP` type.

src/stream/stream/filter.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ where
3636
let next = futures_core::ready!(self.as_mut().stream().poll_next(cx));
3737

3838
match next {
39-
Some(v) => match (self.as_mut().predicate())(&v) {
40-
true => Poll::Ready(Some(v)),
41-
false => {
42-
cx.waker().wake_by_ref();
43-
Poll::Pending
44-
}
45-
},
39+
Some(v) if (self.as_mut().predicate())(&v) => Poll::Ready(Some(v)),
40+
Some(_) => {
41+
cx.waker().wake_by_ref();
42+
Poll::Pending
43+
}
4644
None => Poll::Ready(None),
4745
}
4846
}

src/stream/stream/find.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ where
3636
let item = futures_core::ready!(Pin::new(&mut *self.stream).poll_next(cx));
3737

3838
match item {
39-
Some(v) => match (&mut self.p)(&v) {
40-
true => Poll::Ready(Some(v)),
41-
false => {
42-
cx.waker().wake_by_ref();
43-
Poll::Pending
44-
}
45-
},
39+
Some(v) if (&mut self.p)(&v) => Poll::Ready(Some(v)),
40+
Some(_) => {
41+
cx.waker().wake_by_ref();
42+
Poll::Pending
43+
}
4644
None => Poll::Ready(None),
4745
}
4846
}

src/stream/stream/skip_while.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ where
3838

3939
match next {
4040
Some(v) => match self.as_mut().predicate() {
41-
Some(p) => match p(&v) {
42-
true => (),
43-
false => {
41+
Some(p) => {
42+
if !p(&v) {
4443
*self.as_mut().predicate() = None;
4544
return Poll::Ready(Some(v));
4645
}
47-
},
46+
}
4847
None => return Poll::Ready(Some(v)),
4948
},
5049
None => return Poll::Ready(None),

src/sync/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::future::Future;
1010
use crate::task::{Context, Poll, Waker};
1111

1212
/// Set if the mutex is locked.
13-
const LOCK: usize = 1 << 0;
13+
const LOCK: usize = 1;
1414

1515
/// Set if there are tasks blocked on the mutex.
1616
const BLOCKED: usize = 1 << 1;

src/sync/rwlock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::future::Future;
1010
use crate::task::{Context, Poll, Waker};
1111

1212
/// Set if a write lock is held.
13-
const WRITE_LOCK: usize = 1 << 0;
13+
const WRITE_LOCK: usize = 1;
1414

1515
/// Set if there are read operations blocked on the lock.
1616
const BLOCKED_READS: usize = 1 << 1;

0 commit comments

Comments
 (0)