Fix most rustc & clippy warnings
This commit is contained in:
parent
c4f64489e8
commit
bcc8f13b2b
|
@ -784,8 +784,6 @@ fn surface_commit(
|
||||||
.with_role_data(surface, |&mut role: &mut SubsurfaceRole| role)
|
.with_role_data(surface, |&mut role: &mut SubsurfaceRole| role)
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
let mut next_state = CommitedState::default();
|
|
||||||
|
|
||||||
let (refresh, apply_children) = token.with_surface_data(surface, |attributes| {
|
let (refresh, apply_children) = token.with_surface_data(surface, |attributes| {
|
||||||
attributes
|
attributes
|
||||||
.user_data
|
.user_data
|
||||||
|
@ -796,13 +794,12 @@ fn surface_commit(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.borrow_mut();
|
.borrow_mut();
|
||||||
|
|
||||||
if let Some(ref cached_state) = data.cached_state {
|
let mut next_state = match data.cached_state {
|
||||||
// There is a pending state, accumulate into it
|
// There is a pending state, accumulate into it
|
||||||
next_state = cached_state.clone();
|
Some(ref cached_state) => cached_state.clone(),
|
||||||
} else {
|
// Start from the current state
|
||||||
// start from the current state
|
None => data.current_state.clone(),
|
||||||
next_state = data.current_state.clone();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref data) = sub_data {
|
if let Some(ref data) = sub_data {
|
||||||
next_state.sub_location = data.location;
|
next_state.sub_location = data.location;
|
||||||
|
|
|
@ -28,8 +28,8 @@ use std::{
|
||||||
sync::Mutex,
|
sync::Mutex,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn get_property_by_name<'a, D: ControlDevice, T: ResourceHandle>(
|
fn get_property_by_name<D: ControlDevice, T: ResourceHandle>(
|
||||||
dev: &'a D,
|
dev: &D,
|
||||||
handle: T,
|
handle: T,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
) -> Option<(property::ValueType, property::RawValue)> {
|
) -> Option<(property::ValueType, property::RawValue)> {
|
||||||
|
@ -84,11 +84,7 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let encoder_info = device.get_encoder_info(encoder).unwrap();
|
let encoder_info = device.get_encoder_info(encoder).unwrap();
|
||||||
|
|
||||||
*res_handles
|
res_handles.filter_crtcs(encoder_info.possible_crtcs())[0]
|
||||||
.filter_crtcs(encoder_info.possible_crtcs())
|
|
||||||
.iter()
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
_ => unreachable!("CRTC_ID does not return another property type"),
|
_ => unreachable!("CRTC_ID does not return another property type"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,13 +67,7 @@ fn main() {
|
||||||
let crtc = encoder_info
|
let crtc = encoder_info
|
||||||
.crtc()
|
.crtc()
|
||||||
// or use the first one that is compatible with the encoder
|
// or use the first one that is compatible with the encoder
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| res_handles.filter_crtcs(encoder_info.possible_crtcs())[0]);
|
||||||
*res_handles
|
|
||||||
.filter_crtcs(encoder_info.possible_crtcs())
|
|
||||||
.iter()
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assuming we found a good connector and loaded the info into `connector_info`
|
// Assuming we found a good connector and loaded the info into `connector_info`
|
||||||
let mode = connector_info.modes()[0]; // Use first mode (usually highest resoltion, but in reality you should filter and sort and check and match with other connectors, if you use more then one.)
|
let mode = connector_info.modes()[0]; // Use first mode (usually highest resoltion, but in reality you should filter and sort and check and match with other connectors, if you use more then one.)
|
||||||
|
|
|
@ -97,13 +97,7 @@ fn main() {
|
||||||
let crtc = encoder_info
|
let crtc = encoder_info
|
||||||
.crtc()
|
.crtc()
|
||||||
// or use the first one that is compatible with the encoder
|
// or use the first one that is compatible with the encoder
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| res_handles.filter_crtcs(encoder_info.possible_crtcs())[0]);
|
||||||
*res_handles
|
|
||||||
.filter_crtcs(encoder_info.possible_crtcs())
|
|
||||||
.iter()
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
println!("Crtc {:?}", crtc);
|
println!("Crtc {:?}", crtc);
|
||||||
|
|
||||||
// Assuming we found a good connector and loaded the info into `connector_info`
|
// Assuming we found a good connector and loaded the info into `connector_info`
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub fn make_sure_egl_is_loaded() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::all, rust_2018_idioms)]
|
#[allow(clippy::all)]
|
||||||
pub mod egl {
|
pub mod egl {
|
||||||
use super::*;
|
use super::*;
|
||||||
use libloading::Library;
|
use libloading::Library;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use nix::libc::c_void;
|
||||||
|
|
||||||
use super::{PixelFormat, SwapBuffersError};
|
use super::{PixelFormat, SwapBuffersError};
|
||||||
|
|
||||||
#[allow(clippy::all, rust_2018_idioms, missing_docs)]
|
#[allow(clippy::all, missing_docs)]
|
||||||
pub(crate) mod ffi {
|
pub(crate) mod ffi {
|
||||||
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl EventSource for DBusConnection {
|
||||||
|
|
||||||
fn process_events<F>(&mut self, _: Readiness, _: Token, mut callback: F) -> io::Result<()>
|
fn process_events<F>(&mut self, _: Readiness, _: Token, mut callback: F) -> io::Result<()>
|
||||||
where
|
where
|
||||||
F: FnMut(Message, &mut DBusConnection) -> (),
|
F: FnMut(Message, &mut DBusConnection),
|
||||||
{
|
{
|
||||||
self.cx
|
self.cx
|
||||||
.channel()
|
.channel()
|
||||||
|
|
|
@ -245,7 +245,7 @@ macro_rules! define_roles(
|
||||||
Ok(data)
|
Ok(data)
|
||||||
} else {
|
} else {
|
||||||
// put it back in place
|
// put it back in place
|
||||||
::std::mem::replace(self, temp);
|
*self = temp;
|
||||||
Err($crate::wayland::compositor::roles::WrongRole)
|
Err($crate::wayland::compositor::roles::WrongRole)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::eq_op)]
|
||||||
fn serial_equals_self() {
|
fn serial_equals_self() {
|
||||||
let counter = create_serial_counter(0);
|
let counter = create_serial_counter(0);
|
||||||
let serial = counter.next_serial();
|
let serial = counter.next_serial();
|
||||||
|
|
Loading…
Reference in New Issue