diff --git a/examples/reparent.rs b/examples/reparent.rs index 32506df279..4407f58085 100644 --- a/examples/reparent.rs +++ b/examples/reparent.rs @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use objc2::rc::Retained; -use objc2_app_kit::NSWindow; use tao::{ event::{ElementState, Event, KeyEvent, WindowEvent}, event_loop::{ControlFlow, EventLoop}, @@ -13,7 +11,10 @@ use tao::{ use wry::WebViewBuilder; #[cfg(target_os = "macos")] -use {tao::platform::macos::WindowExtMacOS, wry::WebViewExtMacOS}; +use { + objc2::rc::Retained, objc2_app_kit::NSWindow, tao::platform::macos::WindowExtMacOS, + wry::WebViewExtMacOS, +}; #[cfg(target_os = "windows")] use {tao::platform::windows::WindowExtWindows, wry::WebViewExtWindows}; diff --git a/src/lib.rs b/src/lib.rs index 51cd0a3707..ac211c004c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -222,15 +222,18 @@ use android::*; #[cfg(gtk)] pub(crate) mod webkitgtk; -use objc2::rc::Retained; -use objc2_app_kit::NSWindow; -use objc2_web_kit::WKUserContentController; /// Re-exported [raw-window-handle](https://docs.rs/raw-window-handle/latest/raw_window_handle/) crate. pub use raw_window_handle; use raw_window_handle::HasWindowHandle; #[cfg(gtk)] use webkitgtk::*; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use objc2::rc::Retained; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use objc2_app_kit::NSWindow; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use objc2_web_kit::WKUserContentController; #[cfg(any(target_os = "macos", target_os = "ios"))] pub(crate) mod wkwebview; #[cfg(any(target_os = "macos", target_os = "ios"))] diff --git a/src/wkwebview/mod.rs b/src/wkwebview/mod.rs index 702d21e737..784aa086be 100644 --- a/src/wkwebview/mod.rs +++ b/src/wkwebview/mod.rs @@ -196,7 +196,8 @@ impl InnerWebView { ) { unsafe { #[cfg(feature = "tracing")] - tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty).entered(); + let span = tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty) + .entered(); let task_key = (*task).hash(); // hash by task object address let task_uuid = (*webview).add_custom_task_key(task_key); @@ -216,7 +217,7 @@ impl InnerWebView { let uri = url.absoluteString().unwrap().to_string(); #[cfg(feature = "tracing")] - span.record("uri", uri); + span.record("uri", uri.clone()); // Get request method (GET, POST, PUT etc...) let method = request.HTTPMethod().unwrap().to_string();