clippy fixes

This commit is contained in:
Victor Brekenfeld 2020-04-21 20:17:37 +02:00
parent dcd6934d08
commit 260bfd9f86
5 changed files with 8 additions and 10 deletions

View File

@ -196,9 +196,7 @@ impl<A: AsRawFd + 'static> AtomicDrmDevice<A> {
let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm")); let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm"));
info!(log, "AtomicDrmDevice initializing"); info!(log, "AtomicDrmDevice initializing");
let dev_id = fstat(fd.as_raw_fd()) let dev_id = fstat(fd.as_raw_fd()).map_err(Error::UnableToGetDeviceId)?.st_rdev;
.map_err(|source| Error::UnableToGetDeviceId(source))?
.st_rdev;
let active = Arc::new(AtomicBool::new(true)); let active = Arc::new(AtomicBool::new(true));
let mut dev = Dev { let mut dev = Dev {

View File

@ -160,11 +160,11 @@ impl<A: AsRawFd + 'static> Surface for AtomicDrmSurfaceInternal<A> {
} }
fn current_mode(&self) -> Option<Mode> { fn current_mode(&self) -> Option<Mode> {
self.state.read().unwrap().mode.clone() self.state.read().unwrap().mode
} }
fn pending_mode(&self) -> Option<Mode> { fn pending_mode(&self) -> Option<Mode> {
self.pending.read().unwrap().mode.clone() self.pending.read().unwrap().mode
} }
fn add_connector(&self, conn: connector::Handle) -> Result<(), Error> { fn add_connector(&self, conn: connector::Handle) -> Result<(), Error> {
@ -713,7 +713,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurfaceInternal<A> {
let vec: Vec<(PlaneType, plane::Handle)> = planes let vec: Vec<(PlaneType, plane::Handle)> = planes
.planes() .planes()
.iter() .iter()
.map(|x| *x) .copied()
.filter(|plane| { .filter(|plane| {
card.get_plane(*plane) card.get_plane(*plane)
.map(|plane_info| { .map(|plane_info| {
@ -779,7 +779,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurfaceInternal<A> {
.compat() .compat()
.map_err(|_| Error::TestFailed(self.crtc))?; .map_err(|_| Error::TestFailed(self.crtc))?;
self.atomic_commit(&[AtomicCommitFlags::Nonblock], req.clone()) self.atomic_commit(&[AtomicCommitFlags::Nonblock], req)
.compat() .compat()
.map_err(|source| Error::Access { .map_err(|source| Error::Access {
errmsg: "Failed to commit on clear_plane", errmsg: "Failed to commit on clear_plane",

View File

@ -57,7 +57,7 @@ impl<
if let Some(backend) = backend.upgrade() { if let Some(backend) = backend.upgrade() {
// restart rendering loop, if it was previously running // restart rendering loop, if it was previously running
if let Some(fb) = backend.current_frame_buffer.get() { if let Some(fb) = backend.current_frame_buffer.get() {
if let Err(_) = backend.crtc.page_flip(fb) { if backend.crtc.page_flip(fb).is_err() {
// Try more! // Try more!
if let Err(err) = backend.recreate() { if let Err(err) = backend.recreate() {
error!( error!(

View File

@ -93,7 +93,7 @@ impl<D: RawDevice + 'static> GbmSurfaceInternal<D> {
pub fn recreate(&self) -> Result<(), Error<<<D as Device>::Surface as Surface>::Error>> { pub fn recreate(&self) -> Result<(), Error<<<D as Device>::Surface as Surface>::Error>> {
let (w, h) = self let (w, h) = self
.pending_mode() .pending_mode()
.or(self.current_mode()) .or_else(|| self.current_mode())
.ok_or(Error::NoModeSet)? .ok_or(Error::NoModeSet)?
.size(); .size();

View File

@ -129,7 +129,7 @@ impl<A: AsRawFd + 'static> Surface for LegacyDrmSurfaceInternal<A> {
.iter() .iter()
.all(|v| *v) .all(|v| *v)
{ {
pending.connectors = connectors.into_iter().cloned().collect(); pending.connectors = connectors.iter().cloned().collect();
} }
Ok(()) Ok(())