From f821768e628c040a9a993a02b50209fff8b4d775 Mon Sep 17 00:00:00 2001 From: akimakinai <105044389+akimakinai@users.noreply.github.com> Date: Sun, 20 Oct 2024 01:59:58 +0900 Subject: [PATCH] Resolve unused_qualifications warnings (#16001) # Objective Fixes the following warning when compiling to wasm. ``` warning: unnecessary qualification --> crates\bevy_asset\src\io\mod.rs:733:19 | 733 | _cx: &mut core::task::Context<'_>, | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: requested on the command line with `-W unused-qualifications` help: remove the unnecessary path segments | 733 - _cx: &mut core::task::Context<'_>, 733 + _cx: &mut Context<'_>, | ``` ## Solution - Removes the qualification. --- crates/bevy_asset/src/io/mod.rs | 5 +---- crates/bevy_tasks/src/wasm_task.rs | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/crates/bevy_asset/src/io/mod.rs b/crates/bevy_asset/src/io/mod.rs index 735c7527ca..948382ca31 100644 --- a/crates/bevy_asset/src/io/mod.rs +++ b/crates/bevy_asset/src/io/mod.rs @@ -728,10 +728,7 @@ struct EmptyPathStream; impl Stream for EmptyPathStream { type Item = PathBuf; - fn poll_next( - self: Pin<&mut Self>, - _cx: &mut core::task::Context<'_>, - ) -> Poll> { + fn poll_next(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(None) } } diff --git a/crates/bevy_tasks/src/wasm_task.rs b/crates/bevy_tasks/src/wasm_task.rs index 572b381043..cdf805b2b8 100644 --- a/crates/bevy_tasks/src/wasm_task.rs +++ b/crates/bevy_tasks/src/wasm_task.rs @@ -3,7 +3,7 @@ use core::{ future::{Future, IntoFuture}, panic::{AssertUnwindSafe, UnwindSafe}, pin::Pin, - task::Poll, + task::{Context, Poll}, }; use futures_channel::oneshot; @@ -53,10 +53,7 @@ impl Task { impl Future for Task { type Output = T; - fn poll( - mut self: core::pin::Pin<&mut Self>, - cx: &mut core::task::Context<'_>, - ) -> std::task::Poll { + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { match Pin::new(&mut self.0).poll(cx) { Poll::Ready(Ok(Ok(value))) => Poll::Ready(value), // NOTE: Propagating the panic here sorta has parity with the async_executor behavior. @@ -76,7 +73,7 @@ struct CatchUnwind(#[pin] F); impl Future for CatchUnwind { type Output = Result; - fn poll(self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { std::panic::catch_unwind(AssertUnwindSafe(|| self.project().0.poll(cx)))?.map(Ok) } }