Skip to content

Commit

Permalink
Avoid path when importing modules (#3755)
Browse files Browse the repository at this point in the history
Rust tooling generally works better this way. This includes
rust-analyzer, but more noticeably the output from `tracing` typically
prints the module path, which did not correspond to the actual file
system before.

Concretely, tracing output from the macOS backend changes from printing:
`winit::platform_impl::platform::util`
To printing:
`winit::platform_impl::macos::util`
  • Loading branch information
madsmtm authored and kchibisov committed Jul 16, 2024
1 parent 655fdc8 commit feca480
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
40 changes: 24 additions & 16 deletions src/platform_impl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoModeHandle as RootVideoModeHandle};
use crate::window::Fullscreen as RootFullscreen;

#[cfg(windows_platform)]
#[path = "windows/mod.rs"]
mod platform;
#[cfg(android_platform)]
mod android;
#[cfg(ios_platform)]
mod ios;
#[cfg(any(x11_platform, wayland_platform))]
#[path = "linux/mod.rs"]
mod platform;
mod linux;
#[cfg(macos_platform)]
#[path = "macos/mod.rs"]
mod platform;
mod macos;
#[cfg(orbital_platform)]
mod orbital;
#[cfg(web_platform)]
mod web;
#[cfg(windows_platform)]
mod windows;

#[cfg(android_platform)]
#[path = "android/mod.rs"]
mod platform;
use android as platform;
#[cfg(ios_platform)]
#[path = "ios/mod.rs"]
mod platform;
#[cfg(web_platform)]
#[path = "web/mod.rs"]
mod platform;
use ios as platform;
#[cfg(any(x11_platform, wayland_platform))]
use linux as platform;
#[cfg(macos_platform)]
use macos as platform;
#[cfg(orbital_platform)]
#[path = "orbital/mod.rs"]
mod platform;
use orbital as platform;
#[cfg(web_platform)]
use web as platform;
#[cfg(windows_platform)]
use windows as platform;

pub use self::platform::*;

Expand Down
5 changes: 2 additions & 3 deletions src/platform_impl/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ mod event_loop;
mod keyboard;
mod main_thread;
mod monitor;
mod web_sys;
mod window;

#[path = "web_sys/mod.rs"]
mod backend;

pub use self::device::DeviceId;
pub use self::error::OsError;
pub(crate) use self::event_loop::{
Expand All @@ -43,6 +41,7 @@ pub use self::monitor::{MonitorHandle, VideoModeHandle};
pub use self::window::{PlatformSpecificWindowAttributes, Window, WindowId};

pub(crate) use self::keyboard::KeyEventExtra;
use self::web_sys as backend;
pub(crate) use crate::icon::NoIcon as PlatformIcon;
pub(crate) use crate::platform_impl::Fullscreen;
pub(crate) use cursor::{
Expand Down

0 comments on commit feca480

Please sign in to comment.