From 150225dd22750aa31478cbed2ff49924ac7a95fc Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 2 Mar 2019 09:33:45 -0800 Subject: [PATCH] clippy --- src/font/coretext.rs | 2 +- src/pty/unix.rs | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/font/coretext.rs b/src/font/coretext.rs index e655e1ba7..5f2134e6e 100644 --- a/src/font/coretext.rs +++ b/src/font/coretext.rs @@ -151,7 +151,7 @@ impl CoreTextFontImpl { let m_metrics = metrics('M', &ct_font); let zero_metrics = metrics('0', &ct_font); let metrics = w_metrics.unwrap_or_else(|| { - m_metrics.unwrap_or_else(|| zero_metrics.unwrap_or_else(|| Default::default())) + m_metrics.unwrap_or_else(|| zero_metrics.unwrap_or_else(Default::default)) }); Self { ct_font, diff --git a/src/pty/unix.rs b/src/pty/unix.rs index ecc052471..9b52fb760 100644 --- a/src/pty/unix.rs +++ b/src/pty/unix.rs @@ -205,12 +205,19 @@ impl SlavePty { return Err(io::Error::last_os_error()); } - // Set the pty as the controlling terminal. - // Failure to do this means that delivery of - // SIGWINCH won't happen when we resize the - // terminal, among other undesirable effects. - if libc::ioctl(0, libc::TIOCSCTTY as _, 0) == -1 { - return Err(io::Error::last_os_error()); + // Clippy wants us to explicitly cast TIOCSCTTY using + // type::from(), but the size and potentially signedness + // are system dependent, which is why we're using `as _`. + // Suppress this lint for this section of code. + #[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))] + { + // Set the pty as the controlling terminal. + // Failure to do this means that delivery of + // SIGWINCH won't happen when we resize the + // terminal, among other undesirable effects. + if libc::ioctl(0, libc::TIOCSCTTY as _, 0) == -1 { + return Err(io::Error::last_os_error()); + } } Ok(()) }