Run clippy on CI

Fixes #1402.
This commit is contained in:
Kirill Chibisov 2022-06-10 13:43:33 +03:00 committed by GitHub
parent 57981b533d
commit 10419ff441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 377 additions and 312 deletions

View file

@ -98,7 +98,7 @@ pub struct LogicalFrameExtents {
pub bottom: f64,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FrameExtentsHeuristicPath {
Supported,
UnsupportedNested,
@ -370,8 +370,12 @@ impl XConnection {
let top = offset_y;
let bottom = diff_y.saturating_sub(offset_y);
let frame_extents =
FrameExtents::new(left.into(), right.into(), top.into(), bottom.into());
let frame_extents = FrameExtents::new(
left as c_ulong,
right as c_ulong,
top as c_ulong,
bottom as c_ulong,
);
FrameExtentsHeuristic {
frame_extents,
heuristic_path: UnsupportedNested,
@ -379,7 +383,7 @@ impl XConnection {
} else {
// This is the case for xmonad and dwm, AKA the only WMs tested that supplied a
// border value. This is convenient, since we can use it to get an accurate frame.
let frame_extents = FrameExtents::from_border(border.into());
let frame_extents = FrameExtents::from_border(border as c_ulong);
FrameExtentsHeuristic {
frame_extents,
heuristic_path: UnsupportedBordered,

View file

@ -173,6 +173,12 @@ impl MotifHints {
}
}
impl Default for MotifHints {
fn default() -> Self {
Self::new()
}
}
impl MwmHints {
fn as_slice(&self) -> &[c_ulong] {
unsafe { slice::from_raw_parts(self as *const _ as *const c_ulong, 5) }
@ -317,7 +323,7 @@ impl XConnection {
let mut hints = MotifHints::new();
if let Ok(props) = self.get_property::<c_ulong>(window, motif_hints, motif_hints) {
hints.hints.flags = props.get(0).cloned().unwrap_or(0);
hints.hints.flags = props.first().cloned().unwrap_or(0);
hints.hints.functions = props.get(1).cloned().unwrap_or(0);
hints.hints.decorations = props.get(2).cloned().unwrap_or(0);
hints.hints.input_mode = props.get(3).cloned().unwrap_or(0) as c_long;

View file

@ -1,3 +1,5 @@
#![allow(clippy::assertions_on_constants)]
use super::*;
use crate::icon::{Icon, Pixel, PIXEL_SIZE};

View file

@ -164,7 +164,9 @@ impl XConnection {
(self.xrandr.XRRFreeOutputInfo)(output_info);
Some((name, scale_factor, modes))
}
pub fn set_crtc_config(&self, crtc_id: RRCrtc, mode_id: RRMode) -> Result<(), ()> {
#[must_use]
pub fn set_crtc_config(&self, crtc_id: RRCrtc, mode_id: RRMode) -> Option<()> {
unsafe {
let mut major = 0;
let mut minor = 0;
@ -195,12 +197,13 @@ impl XConnection {
(self.xrandr.XRRFreeScreenResources)(resources);
if status == Success as i32 {
Ok(())
Some(())
} else {
Err(())
None
}
}
}
pub fn get_crtc_mode(&self, crtc_id: RRCrtc) -> RRMode {
unsafe {
let mut major = 0;

View file

@ -60,7 +60,7 @@ impl XConnection {
let root_window_wm_check = {
let result = self.get_property(root, check_atom, ffi::XA_WINDOW);
let wm_check = result.ok().and_then(|wm_check| wm_check.get(0).cloned());
let wm_check = result.ok().and_then(|wm_check| wm_check.first().cloned());
wm_check?
};
@ -70,7 +70,7 @@ impl XConnection {
let child_window_wm_check = {
let result = self.get_property(root_window_wm_check, check_atom, ffi::XA_WINDOW);
let wm_check = result.ok().and_then(|wm_check| wm_check.get(0).cloned());
let wm_check = result.ok().and_then(|wm_check| wm_check.first().cloned());
wm_check?
};