lint: clippy

This commit is contained in:
Victor Brekenfeld 2020-05-01 01:52:51 +02:00
parent 9300e35093
commit 26cae39598
6 changed files with 22 additions and 25 deletions

View File

@ -144,7 +144,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurfaceInternal<A> {
let pending = State { let pending = State {
mode, mode,
blob, blob,
connectors: connectors.into_iter().copied().collect(), connectors: connectors.iter().copied().collect(),
}; };
let (primary, cursor) = let (primary, cursor) =

View File

@ -174,12 +174,12 @@ impl<A: AsRawFd + Clone + 'static> FallbackDevice<AtomicDrmDevice<A>, LegacyDrmD
let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm_fallback")); let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm_fallback"));
info!(log, "Trying to initialize AtomicDrmDevice"); info!(log, "Trying to initialize AtomicDrmDevice");
if env::var("SMITHAY_USE_LEGACY") let force_legacy = env::var("SMITHAY_USE_LEGACY")
.map(|x| { .map(|x| {
x == "1" || x.to_lowercase() == "true" || x.to_lowercase() == "yes" || x.to_lowercase() == "y" x == "1" || x.to_lowercase() == "true" || x.to_lowercase() == "yes" || x.to_lowercase() == "y"
}) })
.unwrap_or(false) .unwrap_or(false);
{ if force_legacy {
info!(log, "SMITHAY_USE_LEGACY is set. Forcing LegacyDrmDevice."); info!(log, "SMITHAY_USE_LEGACY is set. Forcing LegacyDrmDevice.");
return Ok(FallbackDevice::Fallback(LegacyDrmDevice::new( return Ok(FallbackDevice::Fallback(LegacyDrmDevice::new(
fd, fd,

View File

@ -76,19 +76,16 @@ impl Into<SwapBuffersError> for Error {
fn into(self) -> SwapBuffersError { fn into(self) -> SwapBuffersError {
match self { match self {
x @ Error::DeviceInactive => SwapBuffersError::TemporaryFailure(Box::new(x)), x @ Error::DeviceInactive => SwapBuffersError::TemporaryFailure(Box::new(x)),
Error::Access { Error::Access { source, .. }
errmsg: _, if match source.get_ref() {
dev: _, drm::SystemError::Unknown {
source, errno: nix::errno::Errno::EBUSY,
} if match source.get_ref() { } => true,
drm::SystemError::Unknown { drm::SystemError::Unknown {
errno: nix::errno::Errno::EBUSY, errno: nix::errno::Errno::EINTR,
} => true, } => true,
drm::SystemError::Unknown { _ => false,
errno: nix::errno::Errno::EINTR, } =>
} => true,
_ => false,
} =>
{ {
SwapBuffersError::TemporaryFailure(Box::new(source)) SwapBuffersError::TemporaryFailure(Box::new(source))
} }

View File

@ -265,10 +265,10 @@ where
Error::FrontBuffersExhausted => SwapBuffersError::AlreadySwapped, Error::FrontBuffersExhausted => SwapBuffersError::AlreadySwapped,
Error::FramebufferCreationFailed(x) Error::FramebufferCreationFailed(x)
if match x.get_ref() { if match x.get_ref() {
&drm::SystemError::Unknown { drm::SystemError::Unknown {
errno: nix::errno::Errno::EBUSY, errno: nix::errno::Errno::EBUSY,
} => true, } => true,
&drm::SystemError::Unknown { drm::SystemError::Unknown {
errno: nix::errno::Errno::EINTR, errno: nix::errno::Errno::EINTR,
} => true, } => true,
_ => false, _ => false,

View File

@ -358,7 +358,7 @@ impl<A: AsRawFd + 'static> LegacyDrmSurfaceInternal<A> {
}; };
let pending = State { let pending = State {
mode, mode,
connectors: connectors.into_iter().copied().collect(), connectors: connectors.iter().copied().collect(),
}; };
let surface = LegacyDrmSurfaceInternal { let surface = LegacyDrmSurfaceInternal {
@ -437,9 +437,10 @@ impl<A: AsRawFd + 'static> Drop for LegacyDrmSurfaceInternal<A> {
let _ = self.set_cursor(self.crtc, Option::<&DumbBuffer>::None); let _ = self.set_cursor(self.crtc, Option::<&DumbBuffer>::None);
// disable connectors again // disable connectors again
let current = self.state.read().unwrap(); let current = self.state.read().unwrap();
if let Ok(_) = self if self
.dev .dev
.set_connector_state(current.connectors.iter().copied(), false) .set_connector_state(current.connectors.iter().copied(), false)
.is_ok()
{ {
// null commit // null commit
let _ = self.set_crtc(self.crtc, None, (0, 0), &[], None); let _ = self.set_crtc(self.crtc, None, (0, 0), &[], None);

View File

@ -304,7 +304,7 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
.collect::<Result<Vec<Option<ffi::egl::types::EGLConfig>>, EGLError>>() .collect::<Result<Vec<Option<ffi::egl::types::EGLConfig>>, EGLError>>()
.map_err(Error::ConfigFailed)? .map_err(Error::ConfigFailed)?
.into_iter() .into_iter()
.flat_map(|x| x) .flatten()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if config_ids.is_empty() { if config_ids.is_empty() {
@ -546,7 +546,7 @@ impl EGLBufferReader {
out.push(ffi::egl::NONE as i32); out.push(ffi::egl::NONE as i32);
images.push({ images.push({
let image = wrap_egl_call(|| unsafe { wrap_egl_call(|| unsafe {
ffi::egl::CreateImageKHR( ffi::egl::CreateImageKHR(
**self.display, **self.display,
ffi::egl::NO_CONTEXT, ffi::egl::NO_CONTEXT,
@ -555,8 +555,7 @@ impl EGLBufferReader {
out.as_ptr(), out.as_ptr(),
) )
}) })
.map_err(BufferAccessError::EGLImageCreationFailed)?; .map_err(BufferAccessError::EGLImageCreationFailed)?
image
}); });
} }