summaryrefslogtreecommitdiffstats
path: root/winit/src
diff options
context:
space:
mode:
Diffstat (limited to 'winit/src')
-rw-r--r--winit/src/clipboard.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/winit/src/clipboard.rs b/winit/src/clipboard.rs
index f8b90777..7ae646fc 100644
--- a/winit/src/clipboard.rs
+++ b/winit/src/clipboard.rs
@@ -1,8 +1,8 @@
//! Access the clipboard.
use crate::core::clipboard::Kind;
-use winit::window::Window;
use std::sync::Arc;
+use winit::window::Window;
/// A buffer for short-term storage and transfer within and between
/// applications.
@@ -27,12 +27,14 @@ enum State {
impl Clipboard {
/// Creates a new [`Clipboard`] for the given window.
pub fn connect(window: Arc<Window>) -> Clipboard {
- #[allow(unsafe_code)]
// SAFETY: The window handle will stay alive throughout the entire
// lifetime of the `window_clipboard::Clipboard` because we hold
// the `Arc<Window>` together with `State`, and enum variant fields
// get dropped in declaration order.
- let clipboard = unsafe { window_clipboard::Clipboard::connect(&window) };
+ #[allow(unsafe_code)]
+ let clipboard =
+ unsafe { window_clipboard::Clipboard::connect(&window) };
+
let state = match clipboard {
Ok(clipboard) => State::Connected { clipboard, window },
Err(_) => State::Unavailable,