mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
chore: fix newly added warnings (#4253)
This commit is contained in:
@@ -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"
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+1
-1
@@ -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 },
|
||||
};
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user