Skip to content

Commit 937ef96

Browse files
authored
Remove unnecessary PhantomData from platform::WindowHandle definitions (#163)
These `PhantomData` fields are redundant, as the public `WindowHandle` struct already contains one.
1 parent 7d14a55 commit 937ef96

3 files changed

Lines changed: 1 addition & 19 deletions

File tree

src/macos/window.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::cell::{Cell, RefCell};
22
use std::ffi::c_void;
3-
use std::marker::PhantomData;
43
use std::ptr;
54
use std::sync::atomic::{AtomicBool, Ordering};
65
use std::sync::Arc;
@@ -38,9 +37,6 @@ pub struct WindowHandle {
3837
raw_window_handle: Option<RawWindowHandle>,
3938
close_requested: Arc<AtomicBool>,
4039
is_open: Arc<AtomicBool>,
41-
42-
// Ensure handle is !Send
43-
_phantom: PhantomData<*mut ()>,
4440
}
4541

4642
impl WindowHandle {
@@ -81,7 +77,6 @@ impl ParentHandle {
8177
raw_window_handle: Some(raw_window_handle),
8278
close_requested: Arc::clone(&close_requested),
8379
is_open: Arc::clone(&is_open),
84-
_phantom: PhantomData::default(),
8580
};
8681

8782
(Self { _close_requested: close_requested, is_open }, handle)

src/win/window.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use winapi::um::winuser::{
2121
use std::cell::{Cell, Ref, RefCell, RefMut};
2222
use std::collections::VecDeque;
2323
use std::ffi::{c_void, OsStr};
24-
use std::marker::PhantomData;
2524
use std::os::windows::ffi::OsStrExt;
2625
use std::ptr::null_mut;
2726
use std::rc::Rc;
@@ -68,9 +67,6 @@ const WIN_FRAME_TIMER: usize = 4242;
6867
pub struct WindowHandle {
6968
hwnd: Option<HWND>,
7069
is_open: Rc<Cell<bool>>,
71-
72-
// Ensure handle is !Send
73-
_phantom: PhantomData<*mut ()>,
7470
}
7571

7672
impl WindowHandle {
@@ -108,11 +104,7 @@ impl ParentHandle {
108104
pub fn new(hwnd: HWND) -> (Self, WindowHandle) {
109105
let is_open = Rc::new(Cell::new(true));
110106

111-
let handle = WindowHandle {
112-
hwnd: Some(hwnd),
113-
is_open: Rc::clone(&is_open),
114-
_phantom: PhantomData::default(),
115-
};
107+
let handle = WindowHandle { hwnd: Some(hwnd), is_open: Rc::clone(&is_open) };
116108

117109
(Self { is_open }, handle)
118110
}

src/x11/window.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::ffi::c_void;
2-
use std::marker::PhantomData;
32
use std::sync::atomic::{AtomicBool, Ordering};
43
use std::sync::mpsc;
54
use std::sync::Arc;
@@ -28,9 +27,6 @@ pub struct WindowHandle {
2827
raw_window_handle: Option<RawWindowHandle>,
2928
close_requested: Arc<AtomicBool>,
3029
is_open: Arc<AtomicBool>,
31-
32-
// Ensure handle is !Send
33-
_phantom: PhantomData<*mut ()>,
3430
}
3531

3632
impl WindowHandle {
@@ -75,7 +71,6 @@ impl ParentHandle {
7571
raw_window_handle: None,
7672
close_requested: Arc::clone(&close_requested),
7773
is_open: Arc::clone(&is_open),
78-
_phantom: PhantomData::default(),
7974
};
8075

8176
(Self { close_requested, is_open }, handle)

0 commit comments

Comments
 (0)