Skip to content

Commit

Permalink
make dummy() functions const
Browse files Browse the repository at this point in the history
  • Loading branch information
filnet committed Aug 24, 2021
1 parent 898a6af commit a19fc33
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl DeviceId {
/// No other guarantees are made. This may be equal to a real `DeviceId`.
///
/// **Passing this into a winit function will result in undefined behavior.**
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId(platform_impl::DeviceId::dummy())
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl<T: 'static> EventLoopWindowTarget<T> {
pub struct WindowId;

impl WindowId {
pub fn dummy() -> Self {
pub const fn dummy() -> Self {
WindowId
}
}
Expand All @@ -452,7 +452,7 @@ impl WindowId {
pub struct DeviceId;

impl DeviceId {
pub fn dummy() -> Self {
pub const fn dummy() -> Self {
DeviceId
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub struct DeviceId {
}

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId {
uiscreen: std::ptr::null_mut(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ pub struct WindowId {
}

impl WindowId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
WindowId {
window: std::ptr::null_mut(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub enum WindowId {
}

impl WindowId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
#[cfg(feature = "wayland")]
return WindowId::Wayland(wayland::WindowId::dummy());
#[cfg(all(not(feature = "wayland"), feature = "x11"))]
Expand All @@ -158,7 +158,7 @@ pub enum DeviceId {
}

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
#[cfg(feature = "wayland")]
return DeviceId::Wayland(wayland::DeviceId::dummy());
#[cfg(all(not(feature = "wayland"), feature = "x11"))]
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/linux/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod window;
pub struct DeviceId;

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId
}
}
Expand All @@ -31,7 +31,7 @@ impl DeviceId {
pub struct WindowId(usize);

impl WindowId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
WindowId(0)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/linux/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl<'a> Deref for DeviceInfo<'a> {
pub struct WindowId(ffi::Window);

impl WindowId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
WindowId(0)
}
}
Expand All @@ -499,7 +499,7 @@ impl WindowId {
pub struct DeviceId(c_int);

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId(0)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/linux/x11/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ impl MonitorHandle {
})
}

pub fn dummy() -> Self {
pub const fn dummy() -> Self {
MonitorHandle {
id: 0,
name: "<dummy monitor>".into(),
name: String::from("<dummy monitor>"),
scale_factor: 1.0,
dimensions: (1, 1),
position: (0, 0),
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/linux/x11/util/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct AaRect {
}

impl AaRect {
pub fn new((x, y): (i32, i32), (width, height): (u32, u32)) -> Self {
pub const fn new((x, y): (i32, i32), (width, height): (u32, u32)) -> Self {
let (x, y) = (x as i64, y as i64);
let (width, height) = (width as i64, height as i64);
AaRect {
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) use crate::icon::NoIcon as PlatformIcon;
pub struct DeviceId;

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use objc::{
pub struct Id(pub usize);

impl Id {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
Id(0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/web/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pub struct Id(pub i32);

impl Id {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
Id(0)
}
}
4 changes: 2 additions & 2 deletions src/platform_impl/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ unsafe impl Sync for Cursor {}
pub struct DeviceId(u32);

impl DeviceId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
DeviceId(0)
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ unsafe impl Send for WindowId {}
unsafe impl Sync for WindowId {}

impl WindowId {
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
use std::ptr::null_mut;

WindowId(null_mut())
Expand Down
2 changes: 1 addition & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl WindowId {
/// No other guarantees are made. This may be equal to a real `WindowId`.
///
/// **Passing this into a winit function will result in undefined behavior.**
pub unsafe fn dummy() -> Self {
pub const unsafe fn dummy() -> Self {
WindowId(platform_impl::WindowId::dummy())
}
}
Expand Down

0 comments on commit a19fc33

Please sign in to comment.