chore(rustfmt): use nightly (#2325)
Stable rustfmt lacks a lot of features resulting in worse formatted code, thus use nightly formatter.
This commit is contained in:
parent
7006c7ceca
commit
7b0c7b6cb2
154 changed files with 3439 additions and 5891 deletions
|
|
@ -1,29 +1,21 @@
|
|||
use std::{
|
||||
collections::{BTreeSet, VecDeque},
|
||||
hash::Hash,
|
||||
io, mem, ptr,
|
||||
};
|
||||
use std::collections::{BTreeSet, VecDeque};
|
||||
use std::hash::Hash;
|
||||
use std::{io, mem, ptr};
|
||||
|
||||
use windows_sys::Win32::{
|
||||
Foundation::{BOOL, HWND, LPARAM, POINT, RECT},
|
||||
Graphics::Gdi::{
|
||||
EnumDisplayMonitors, EnumDisplaySettingsExW, GetMonitorInfoW, MonitorFromPoint,
|
||||
MonitorFromWindow, DEVMODEW, DM_BITSPERPEL, DM_DISPLAYFREQUENCY, DM_PELSHEIGHT,
|
||||
DM_PELSWIDTH, ENUM_CURRENT_SETTINGS, HDC, HMONITOR, MONITORINFO, MONITORINFOEXW,
|
||||
MONITOR_DEFAULTTONEAREST, MONITOR_DEFAULTTOPRIMARY,
|
||||
},
|
||||
use windows_sys::Win32::Foundation::{BOOL, HWND, LPARAM, POINT, RECT};
|
||||
use windows_sys::Win32::Graphics::Gdi::{
|
||||
EnumDisplayMonitors, EnumDisplaySettingsExW, GetMonitorInfoW, MonitorFromPoint,
|
||||
MonitorFromWindow, DEVMODEW, DM_BITSPERPEL, DM_DISPLAYFREQUENCY, DM_PELSHEIGHT, DM_PELSWIDTH,
|
||||
ENUM_CURRENT_SETTINGS, HDC, HMONITOR, MONITORINFO, MONITORINFOEXW, MONITOR_DEFAULTTONEAREST,
|
||||
MONITOR_DEFAULTTOPRIMARY,
|
||||
};
|
||||
|
||||
use super::util::decode_wide;
|
||||
use crate::{
|
||||
dpi::{PhysicalPosition, PhysicalSize},
|
||||
monitor::VideoModeHandle as RootVideoModeHandle,
|
||||
platform_impl::platform::{
|
||||
dpi::{dpi_to_scale_factor, get_monitor_dpi},
|
||||
util::has_flag,
|
||||
window::Window,
|
||||
},
|
||||
};
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::monitor::VideoModeHandle as RootVideoModeHandle;
|
||||
use crate::platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
||||
use crate::platform_impl::platform::util::has_flag;
|
||||
use crate::platform_impl::platform::window::Window;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct VideoModeHandle {
|
||||
|
|
@ -144,10 +136,7 @@ pub(crate) fn get_monitor_info(hmonitor: HMONITOR) -> Result<MONITORINFOEXW, io:
|
|||
let mut monitor_info: MONITORINFOEXW = unsafe { mem::zeroed() };
|
||||
monitor_info.monitorInfo.cbSize = mem::size_of::<MONITORINFOEXW>() as u32;
|
||||
let status = unsafe {
|
||||
GetMonitorInfoW(
|
||||
hmonitor,
|
||||
&mut monitor_info as *mut MONITORINFOEXW as *mut MONITORINFO,
|
||||
)
|
||||
GetMonitorInfoW(hmonitor, &mut monitor_info as *mut MONITORINFOEXW as *mut MONITORINFO)
|
||||
};
|
||||
if status == false.into() {
|
||||
Err(io::Error::last_os_error())
|
||||
|
|
@ -164,11 +153,7 @@ impl MonitorHandle {
|
|||
#[inline]
|
||||
pub fn name(&self) -> Option<String> {
|
||||
let monitor_info = get_monitor_info(self.0).unwrap();
|
||||
Some(
|
||||
decode_wide(&monitor_info.szDevice)
|
||||
.to_string_lossy()
|
||||
.to_string(),
|
||||
)
|
||||
Some(decode_wide(&monitor_info.szDevice).to_string_lossy().to_string())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -212,10 +197,7 @@ impl MonitorHandle {
|
|||
get_monitor_info(self.0)
|
||||
.map(|info| {
|
||||
let rc_monitor = info.monitorInfo.rcMonitor;
|
||||
PhysicalPosition {
|
||||
x: rc_monitor.left,
|
||||
y: rc_monitor.top,
|
||||
}
|
||||
PhysicalPosition { x: rc_monitor.left, y: rc_monitor.top }
|
||||
})
|
||||
.unwrap_or(PhysicalPosition { x: 0, y: 0 })
|
||||
}
|
||||
|
|
@ -238,7 +220,7 @@ impl MonitorHandle {
|
|||
Err(error) => {
|
||||
tracing::warn!("Error from get_monitor_info: {error}");
|
||||
return modes.into_iter().map(mod_map);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let device_name = monitor_info.szDevice.as_ptr();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue