Skip to content

Commit

Permalink
chore: fix newly added warnings (#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Nov 22, 2021
1 parent 8b6542f commit fe770dc
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 18 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ jobs:
- name: Install Rust
run: rustup update stable
- uses: Swatinem/rust-cache@v1
- name: Install rustfmt
run: rustup component add rustfmt

# Check fmt
- name: "rustfmt --check"
Expand All @@ -285,7 +283,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update 1.52.1 && rustup default 1.52.1
run: rustup update 1.56 && rustup default 1.56
- uses: Swatinem/rust-cache@v1
- name: Install clippy
run: rustup component add clippy
Expand Down
2 changes: 1 addition & 1 deletion benches/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn rt() -> tokio::runtime::Runtime {
const BLOCK_COUNT: usize = 1_000;

const BUFFER_SIZE: usize = 4096;
const DEV_ZERO: &'static str = "/dev/zero";
const DEV_ZERO: &str = "/dev/zero";

fn async_read_codec(b: &mut Bencher) {
let rt = rt();
Expand Down
2 changes: 1 addition & 1 deletion examples/tinydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
}

fn handle_request(line: &str, db: &Arc<Database>) -> Response {
let request = match Request::parse(&line) {
let request = match Request::parse(line) {
Ok(req) => req,
Err(e) => return Response::Error { msg: e },
};
Expand Down
8 changes: 4 additions & 4 deletions tokio-stream/src/stream_ext/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ where
use Poll::Ready;

loop {
let mut me = self.as_mut().project();
let me = self.as_mut().project();

let item = match ready!(me.stream.poll_next(cx)) {
Some(item) => item,
None => {
return Ready(U::finalize(sealed::Internal, &mut me.collection));
return Ready(U::finalize(sealed::Internal, me.collection));
}
};

if !U::extend(sealed::Internal, &mut me.collection, item) {
return Ready(U::finalize(sealed::Internal, &mut me.collection));
if !U::extend(sealed::Internal, me.collection, item) {
return Ready(U::finalize(sealed::Internal, me.collection));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/io/async_fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyMutGuard<'a, Inner> {
&mut self,
f: impl FnOnce(&mut AsyncFd<Inner>) -> io::Result<R>,
) -> Result<io::Result<R>, TryIoError> {
let result = f(&mut self.async_fd);
let result = f(self.async_fd);

if let Err(e) = result.as_ref() {
if e.kind() == io::ErrorKind::WouldBlock {
Expand Down
3 changes: 1 addition & 2 deletions tokio/src/io/util/buf_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ impl<R: AsyncRead + AsyncSeek> AsyncSeek for BufReader<R> {
self.as_mut()
.get_pin_mut()
.start_seek(SeekFrom::Current(offset))?;
self.as_mut().get_pin_mut().poll_complete(cx)?
} else {
// seek backwards by our remainder, and then by the offset
self.as_mut()
Expand All @@ -221,8 +220,8 @@ impl<R: AsyncRead + AsyncSeek> AsyncSeek for BufReader<R> {
self.as_mut()
.get_pin_mut()
.start_seek(SeekFrom::Current(n))?;
self.as_mut().get_pin_mut().poll_complete(cx)?
}
self.as_mut().get_pin_mut().poll_complete(cx)?
}
SeekState::PendingOverflowed(n) => {
if self.as_mut().get_pin_mut().poll_complete(cx)?.is_pending() {
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/io/util/read_exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ where
type Output = io::Result<usize>;

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<usize>> {
let mut me = self.project();
let me = self.project();

loop {
// if our buffer is empty, then we need to read some data to continue.
let rem = me.buf.remaining();
if rem != 0 {
ready!(Pin::new(&mut *me.reader).poll_read(cx, &mut me.buf))?;
ready!(Pin::new(&mut *me.reader).poll_read(cx, me.buf))?;
if me.buf.remaining() == rem {
return Err(eof()).into();
}
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/task/task_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ impl<T: 'static, F> TaskLocalFuture<T, F> {
}
}

let mut project = self.project();
let project = self.project();
let val = project.slot.take();

let prev = project.local.inner.with(|c| c.replace(val));

let _guard = Guard {
prev,
slot: &mut project.slot,
slot: project.slot,
local: *project.local,
};

Expand Down
1 change: 0 additions & 1 deletion tokio/src/task/yield_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use std::task::{Context, Poll};
/// which order the runtime polls your tasks in.
///
/// [`tokio::select!`]: macro@crate::select
#[must_use = "yield_now does nothing unless polled/`await`-ed"]
#[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
pub async fn yield_now() {
/// Yield implementation
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/time/driver/wheel/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Level {
// However, that is only supported for arrays of size
// 32 or fewer. So in our case we have to explicitly
// invoke the constructor for each array element.
let ctor = || EntryList::default();
let ctor = EntryList::default;

Level {
level,
Expand Down

0 comments on commit fe770dc

Please sign in to comment.