mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
chore: remove unnecessary conversion (#1332)
This commit is contained in:
@@ -35,6 +35,6 @@ where
|
|||||||
let std = ready!(crate::blocking_io(|| StdFile::create(&self.path)))?;
|
let std = ready!(crate::blocking_io(|| StdFile::create(&self.path)))?;
|
||||||
|
|
||||||
let file = File::from_std(std);
|
let file = File::from_std(std);
|
||||||
Poll::Ready(Ok(file.into()))
|
Poll::Ready(Ok(file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ impl Future for MetadataFuture {
|
|||||||
let metadata = ready!(crate::blocking_io(|| StdFile::metadata(inner.std())))?;
|
let metadata = ready!(crate::blocking_io(|| StdFile::metadata(inner.std())))?;
|
||||||
|
|
||||||
let file = inner.file.take().expect(POLL_AFTER_RESOLVE);
|
let file = inner.file.take().expect(POLL_AFTER_RESOLVE);
|
||||||
Poll::Ready(Ok((file, metadata).into()))
|
Poll::Ready(Ok((file, metadata)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ where
|
|||||||
let std = ready!(crate::blocking_io(|| self.options.open(&self.path)))?;
|
let std = ready!(crate::blocking_io(|| self.options.open(&self.path)))?;
|
||||||
|
|
||||||
let file = File::from_std(std);
|
let file = File::from_std(std);
|
||||||
Poll::Ready(Ok(file.into()))
|
Poll::Ready(Ok(file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ impl Future for SeekFuture {
|
|||||||
.expect("Cannot poll `SeekFuture` after it resolves")
|
.expect("Cannot poll `SeekFuture` after it resolves")
|
||||||
.poll_seek(inner_self.pos))?;
|
.poll_seek(inner_self.pos))?;
|
||||||
let inner = inner_self.inner.take().unwrap();
|
let inner = inner_self.inner.take().unwrap();
|
||||||
Poll::Ready(Ok((inner, pos).into()))
|
Poll::Ready(Ok((inner, pos)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ impl AtomicStack {
|
|||||||
/// on the stack, `Err` if the timer is shutdown.
|
/// on the stack, `Err` if the timer is shutdown.
|
||||||
pub fn push(&self, entry: &Arc<Entry>) -> Result<bool, Error> {
|
pub fn push(&self, entry: &Arc<Entry>) -> Result<bool, Error> {
|
||||||
// First, set the queued bit on the entry
|
// First, set the queued bit on the entry
|
||||||
let queued = entry.queued.fetch_or(true, SeqCst).into();
|
let queued = entry.queued.fetch_or(true, SeqCst);
|
||||||
|
|
||||||
if queued {
|
if queued {
|
||||||
// Already queued, nothing more to do
|
// Already queued, nothing more to do
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ impl Entry {
|
|||||||
|
|
||||||
self.waker.register_by_ref(cx.waker());
|
self.waker.register_by_ref(cx.waker());
|
||||||
|
|
||||||
curr = self.state.load(SeqCst).into();
|
curr = self.state.load(SeqCst);
|
||||||
|
|
||||||
if is_elapsed(curr) {
|
if is_elapsed(curr) {
|
||||||
return Poll::Ready(if curr == ERROR {
|
return Poll::Ready(if curr == ERROR {
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ where
|
|||||||
match self.with_context(ctx, |s| s.shutdown()) {
|
match self.with_context(ctx, |s| s.shutdown()) {
|
||||||
Ok(()) => Poll::Ready(Ok(())),
|
Ok(()) => Poll::Ready(Ok(())),
|
||||||
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return Poll::Pending,
|
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return Poll::Pending,
|
||||||
Err(e) => return Poll::Ready(Err(e.into())),
|
Err(e) => return Poll::Ready(Err(e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user