fix unnecessary cast lint (#2596)

* fix clippy lints on Windows

* fix lints on other platforms

* a couple more

* again

* don't know what's goging on anymore

* fix examples

* comon

* how about now?

* this is getting annoying

* hmmm

* explicitly set a type

* 😢

* don't cast on x64 targets

* apply code review requests

* fix attributes on expressions

* fix ios
This commit is contained in:
Amr Bashir 2022-12-22 21:35:33 +02:00 committed by GitHub
parent da7422c6e1
commit 402cbd55f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 63 additions and 64 deletions

View file

@ -108,6 +108,7 @@ impl std::hash::Hash for MonitorHandle {
#[inline]
pub fn mode_refresh_rate_millihertz(mode: &XRRModeInfo) -> Option<u32> {
if mode.dotClock > 0 && mode.hTotal > 0 && mode.vTotal > 0 {
#[allow(clippy::unnecessary_cast)]
Some((mode.dotClock as u64 * 1000 / (mode.hTotal as u64 * mode.vTotal as u64)) as u32)
} else {
None
@ -123,8 +124,8 @@ impl MonitorHandle {
primary: bool,
) -> Option<Self> {
let (name, scale_factor, video_modes) = unsafe { xconn.get_output_info(resources, crtc)? };
let dimensions = unsafe { ((*crtc).width as u32, (*crtc).height as u32) };
let position = unsafe { ((*crtc).x as i32, (*crtc).y as i32) };
let dimensions = unsafe { ((*crtc).width, (*crtc).height) };
let position = unsafe { ((*crtc).x, (*crtc).y) };
// Get the refresh rate of the current video mode.
let current_mode = unsafe { (*crtc).mode };
@ -175,7 +176,7 @@ impl MonitorHandle {
#[inline]
pub fn native_identifier(&self) -> u32 {
self.id as u32
self.id as _
}
pub fn size(&self) -> PhysicalSize<u32> {