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 {
mode,
blob,
connectors: connectors.into_iter().copied().collect(),
connectors: connectors.iter().copied().collect(),
};
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"));
info!(log, "Trying to initialize AtomicDrmDevice");
if env::var("SMITHAY_USE_LEGACY")
let force_legacy = env::var("SMITHAY_USE_LEGACY")
.map(|x| {
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.");
return Ok(FallbackDevice::Fallback(LegacyDrmDevice::new(
fd,

View File

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

View File

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

View File

@ -358,7 +358,7 @@ impl<A: AsRawFd + 'static> LegacyDrmSurfaceInternal<A> {
};
let pending = State {
mode,
connectors: connectors.into_iter().copied().collect(),
connectors: connectors.iter().copied().collect(),
};
let surface = LegacyDrmSurfaceInternal {
@ -437,9 +437,10 @@ impl<A: AsRawFd + 'static> Drop for LegacyDrmSurfaceInternal<A> {
let _ = self.set_cursor(self.crtc, Option::<&DumbBuffer>::None);
// disable connectors again
let current = self.state.read().unwrap();
if let Ok(_) = self
if self
.dev
.set_connector_state(current.connectors.iter().copied(), false)
.is_ok()
{
// null commit
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>>()
.map_err(Error::ConfigFailed)?
.into_iter()
.flat_map(|x| x)
.flatten()
.collect::<Vec<_>>();
if config_ids.is_empty() {
@ -546,7 +546,7 @@ impl EGLBufferReader {
out.push(ffi::egl::NONE as i32);
images.push({
let image = wrap_egl_call(|| unsafe {
wrap_egl_call(|| unsafe {
ffi::egl::CreateImageKHR(
**self.display,
ffi::egl::NO_CONTEXT,
@ -555,8 +555,7 @@ impl EGLBufferReader {
out.as_ptr(),
)
})
.map_err(BufferAccessError::EGLImageCreationFailed)?;
image
.map_err(BufferAccessError::EGLImageCreationFailed)?
});
}