diff --git a/extract-generated-code-doc/src/main.rs b/extract-generated-code-doc/src/main.rs index 75cd3a0a..a26371a6 100644 --- a/extract-generated-code-doc/src/main.rs +++ b/extract-generated-code-doc/src/main.rs @@ -3,8 +3,7 @@ trivial_numeric_casts, unsafe_code, unreachable_pub, - unused_import_braces, - unused_must_use, + unused, unused_qualifications )] #![forbid(unsafe_code)] diff --git a/generator/src/generator/namespace/parse.rs b/generator/src/generator/namespace/parse.rs index c682fddb..04c99c51 100644 --- a/generator/src/generator/namespace/parse.rs +++ b/generator/src/generator/namespace/parse.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - use xcbgen::defs as xcbdefs; use super::{ diff --git a/generator/src/generator/namespace/request.rs b/generator/src/generator/namespace/request.rs index 465ef269..7a2feab8 100644 --- a/generator/src/generator/namespace/request.rs +++ b/generator/src/generator/namespace/request.rs @@ -253,7 +253,7 @@ pub(super) fn generate_request( ImplMode::Async, ); - super::special_cases::handle_request(request_def, proto_out); + special_cases::handle_request(request_def, proto_out); outln!(proto_out, ""); outln!(x11rb_out, ""); diff --git a/generator/src/generator/namespace/serialize.rs b/generator/src/generator/namespace/serialize.rs index 27ea155b..83908699 100644 --- a/generator/src/generator/namespace/serialize.rs +++ b/generator/src/generator/namespace/serialize.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::convert::TryFrom; use xcbgen::defs as xcbdefs; diff --git a/generator/src/main.rs b/generator/src/main.rs index 73f3e770..b4873078 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -3,8 +3,7 @@ trivial_numeric_casts, unsafe_code, unreachable_pub, - unused_import_braces, - unused_must_use, + unused, unused_qualifications )] #![forbid(unsafe_code)] diff --git a/x11rb-async/src/connection.rs b/x11rb-async/src/connection.rs index 4f239a48..4c2f3bb0 100644 --- a/x11rb-async/src/connection.rs +++ b/x11rb-async/src/connection.rs @@ -15,7 +15,6 @@ use x11rb_protocol::{DiscardMode, RawEventAndSeqNumber, SequenceNumber}; use crate::errors::{ConnectionError, ParseError, ReplyError, ReplyOrIdError}; use crate::{Cookie, CookieWithFds, VoidCookie}; -use std::boxed::Box; use std::future::Future; use std::io::IoSlice; use std::pin::Pin; diff --git a/x11rb-async/src/lib.rs b/x11rb-async/src/lib.rs index d5d10d2f..12d64465 100644 --- a/x11rb-async/src/lib.rs +++ b/x11rb-async/src/lib.rs @@ -41,6 +41,16 @@ //! * `extra-traits`: Implement extra traits for X11 types. This improves the output of the `Debug` //! impl and adds `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` where possible. +// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment +// explaining why it gets the weaker treatment. +#![deny( + // Contains unreachable_code and "?" generates an #[allow] for this + unused, + // #[derive] generates an #[allow] for this; not part of "unused" + unused_qualifications, + // Not everything in x11rb::protocol has doc comments + missing_docs, +)] #![forbid( missing_copy_implementations, missing_debug_implementations, @@ -50,20 +60,11 @@ trivial_casts, trivial_numeric_casts, unreachable_pub, - unused_import_braces, unused_must_use, unused_results, clippy::cast_lossless, clippy::needless_pass_by_value, )] -// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment -// explaining why it gets the weaker treatment. -#![deny( - // #[derive] generates an #[allow] for this - unused_qualifications, - // Not everything in x11rb::protocol has doc comments - missing_docs, -)] #![cfg_attr(not(feature = "allow-unsafe-code"), forbid(unsafe_code))] // -- Public Modules -- diff --git a/x11rb-protocol/src/connect.rs b/x11rb-protocol/src/connect.rs index d8cfc209..67e319e8 100644 --- a/x11rb-protocol/src/connect.rs +++ b/x11rb-protocol/src/connect.rs @@ -9,7 +9,6 @@ use crate::xauth::{get_auth, Family}; use alloc::{vec, vec::Vec}; -use core::convert::TryFrom; use core::fmt; /// The connection handshake used to connect to the X11 server. @@ -270,7 +269,6 @@ mod tests { use crate::protocol::xproto::{ImageOrder, Setup, SetupAuthenticate, SetupFailed}; use crate::x11_utils::Serialize; use alloc::vec; - use core::mem::drop; fn test_setup() -> Setup { let mut s = Setup { diff --git a/x11rb-protocol/src/lib.rs b/x11rb-protocol/src/lib.rs index de3fa10b..c653bc5b 100644 --- a/x11rb-protocol/src/lib.rs +++ b/x11rb-protocol/src/lib.rs @@ -40,6 +40,18 @@ //! * `extra-traits`: Implement extra traits for types. This improves the output of the `Debug` //! impl and adds `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` where possible. +// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment +// explaining why it gets the weaker treatment. +#![deny( + // Contains unreachable_code and "?" generates an #[allow] for this + unused, + // #[derive] generates an #[allow] for this; not part of "unused" + unused_qualifications, + // serde's Deserialize/Serialize impls add allows for this + rust_2018_idioms, + // Not everything in x11rb_protocol::protocol has doc comments + missing_docs, +)] #![forbid( missing_copy_implementations, missing_debug_implementations, @@ -49,22 +61,11 @@ trivial_numeric_casts, unreachable_pub, unsafe_code, - unused_import_braces, unused_must_use, unused_results, clippy::cast_lossless, clippy::needless_pass_by_value, )] -// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment -// explaining why it gets the weaker treatment. -#![deny( - // #[derive] generates an #[allow] for this - unused_qualifications, - // serde's Deserialize/Serialize impls add allows for this - rust_2018_idioms, - // Not everything in x11rb_protocol::protocol has doc comments - missing_docs, -)] #![no_std] // std crate imports diff --git a/x11rb-protocol/src/packet_reader.rs b/x11rb-protocol/src/packet_reader.rs index 5c1ee063..1a3950e7 100644 --- a/x11rb-protocol/src/packet_reader.rs +++ b/x11rb-protocol/src/packet_reader.rs @@ -1,6 +1,5 @@ //! Collects X11 data into "packets" to be parsed by a display. -use core::convert::TryInto; use core::fmt; use core::mem::replace; diff --git a/x11rb-protocol/src/resource_manager/mod.rs b/x11rb-protocol/src/resource_manager/mod.rs index 4cee35af..c2565fed 100644 --- a/x11rb-protocol/src/resource_manager/mod.rs +++ b/x11rb-protocol/src/resource_manager/mod.rs @@ -161,7 +161,7 @@ impl Database { } } else { // 5. Load `$HOME/.Xdefaults-[hostname]` - let mut file = std::ffi::OsString::from(".Xdefaults-"); + let mut file = OsString::from(".Xdefaults-"); file.push(hostname); let mut path = match var_os("HOME") { Some(home) => PathBuf::from(home), diff --git a/x11rb-protocol/src/x11_utils.rs b/x11rb-protocol/src/x11_utils.rs index 7e156b13..945a684b 100644 --- a/x11rb-protocol/src/x11_utils.rs +++ b/x11rb-protocol/src/x11_utils.rs @@ -4,8 +4,6 @@ //! [`Serialize`] traits. These traits are used internally for parsing incoming data and producing //! outgoing data when talking with the X11 server. -use core::convert::TryInto; - use alloc::string::String; use alloc::vec::Vec; diff --git a/x11rb/src/connection/mod.rs b/x11rb/src/connection/mod.rs index 22cf00bc..218602a7 100644 --- a/x11rb/src/connection/mod.rs +++ b/x11rb/src/connection/mod.rs @@ -3,7 +3,6 @@ //! This module contains the `Connection` trait and related definitions. The code in this module is //! used by each concrete implementation of the X11 protocol. -use std::convert::{TryFrom, TryInto}; use std::io::IoSlice; use x11rb_protocol::x11_utils::{ReplyFDsRequest, ReplyRequest, VoidRequest}; diff --git a/x11rb/src/cursor/parse_cursor.rs b/x11rb/src/cursor/parse_cursor.rs index 9535e240..b5a47bd8 100644 --- a/x11rb/src/cursor/parse_cursor.rs +++ b/x11rb/src/cursor/parse_cursor.rs @@ -4,7 +4,6 @@ // Copyright © 2013 Michael Stapelberg // and is covered by MIT/X Consortium License -use std::convert::TryInto; use std::io::{Read, Seek, SeekFrom}; const FILE_MAGIC: u32 = 0x7275_6358; diff --git a/x11rb/src/image.rs b/x11rb/src/image.rs index d82c3b12..d85cde72 100644 --- a/x11rb/src/image.rs +++ b/x11rb/src/image.rs @@ -25,7 +25,6 @@ // begins with the second bit of each pixel etc. use std::borrow::Cow; -use std::convert::{TryFrom, TryInto}; use crate::connection::Connection; use crate::cookie::VoidCookie; @@ -248,7 +247,6 @@ fn compute_stride(width: u16, bits_per_pixel: BitsPerPixel, scanline_pad: Scanli #[cfg(test)] mod test_stride { use super::compute_stride; - use std::convert::TryInto; #[test] fn test_stride() { @@ -370,7 +368,6 @@ impl ScanlinePad { #[cfg(test)] mod test_scanline_pad { use super::ScanlinePad; - use std::convert::TryInto; #[test] fn number_conversions() { diff --git a/x11rb/src/lib.rs b/x11rb/src/lib.rs index 39785f69..98ec298e 100644 --- a/x11rb/src/lib.rs +++ b/x11rb/src/lib.rs @@ -120,6 +120,16 @@ //! The [event_loop_integration](event_loop_integration/index.html) module contains some hints for //! integrating x11rb with an event loop as doc comments. +// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment +// explaining why it gets the weaker treatment. +#![deny( + // Contains unreachable_code and "?" generates an #[allow] for this + unused, + // #[derive] generates an #[allow] for this; not part of "unused" + unused_qualifications, + // Not everything in x11rb::protocol has doc comments + missing_docs, +)] #![forbid( missing_copy_implementations, missing_debug_implementations, @@ -129,20 +139,11 @@ trivial_casts, trivial_numeric_casts, unreachable_pub, - unused_import_braces, unused_must_use, unused_results, clippy::cast_lossless, clippy::needless_pass_by_value, )] -// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment -// explaining why it gets the weaker treatment. -#![deny( - // #[derive] generates an #[allow] for this - unused_qualifications, - // Not everything in x11rb::protocol has doc comments - missing_docs, -)] #![cfg_attr(not(feature = "allow-unsafe-code"), forbid(unsafe_code))] // Only contains documentation, but no "actual rust" diff --git a/x11rb/src/properties.rs b/x11rb/src/properties.rs index 38e63f8f..2e862a09 100644 --- a/x11rb/src/properties.rs +++ b/x11rb/src/properties.rs @@ -1,7 +1,5 @@ //! Utility functions for working with X11 properties -use std::convert::TryInto; - use crate::connection::RequestConnection; use crate::cookie::{Cookie, VoidCookie}; use crate::errors::{ConnectionError, ParseError, ReplyError}; @@ -572,8 +570,8 @@ impl WmHints { conn, xproto::PropMode::REPLACE, window, - xproto::AtomEnum::WM_HINTS, - xproto::AtomEnum::WM_HINTS, + AtomEnum::WM_HINTS, + AtomEnum::WM_HINTS, 32, NUM_WM_HINTS_ELEMENTS, &data, @@ -681,8 +679,6 @@ fn parse_with_flag( #[cfg(test)] mod test { - use std::convert::TryInto; - use super::{WmClass, WmHints, WmHintsState, WmSizeHints}; use crate::protocol::xproto::{Atom, AtomEnum, GetPropertyReply, Gravity}; use crate::x11_utils::Serialize; diff --git a/x11rb/src/rust_connection/mod.rs b/x11rb/src/rust_connection/mod.rs index 24a9559b..96055e56 100644 --- a/x11rb/src/rust_connection/mod.rs +++ b/x11rb/src/rust_connection/mod.rs @@ -1,8 +1,6 @@ //! A pure-rust implementation of a connection to an X11 server. -use std::convert::TryInto; use std::io::IoSlice; -use std::mem::drop; use std::sync::{Condvar, Mutex, MutexGuard, TryLockError}; use std::time::Instant; diff --git a/x11rb/src/rust_connection/packet_reader.rs b/x11rb/src/rust_connection/packet_reader.rs index 62477e57..b29d6ebb 100644 --- a/x11rb/src/rust_connection/packet_reader.rs +++ b/x11rb/src/rust_connection/packet_reader.rs @@ -1,7 +1,7 @@ //! Read X11 packets from a reader use std::io::{Error, ErrorKind, Result}; -use std::{cmp, fmt, io}; +use std::{cmp, fmt}; use super::Stream; use crate::utils::RawFdContainer; @@ -67,7 +67,7 @@ impl PacketReader { out_packets.push(packet); } } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => break, + Err(ref e) if e.kind() == ErrorKind::WouldBlock => break, Err(e) => return Err(e), } } else { @@ -81,7 +81,7 @@ impl PacketReader { )); } Ok(n) => n, - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => break, + Err(ref e) if e.kind() == ErrorKind::WouldBlock => break, Err(e) => return Err(e), }; crate::trace!("Read {} bytes into read buffer", nread); diff --git a/x11rb/src/tracing.rs b/x11rb/src/tracing.rs index da176ec9..415bd64f 100644 --- a/x11rb/src/tracing.rs +++ b/x11rb/src/tracing.rs @@ -102,6 +102,7 @@ macro_rules! warning_span { ( $name:expr ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Warn, $name, ) }; ( $name:expr, $($fields:tt)* ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Warn, $name, $($fields)*) }; } +#[allow(unused_macro_rules)] macro_rules! info_span { ( $name:expr ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Info, $name, ) }; ( $name:expr, $($fields:tt)* ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Info, $name, $($fields)*) }; @@ -110,6 +111,7 @@ macro_rules! debug_span { ( $name:expr ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Debug, $name, ) }; ( $name:expr, $($fields:tt)* ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Debug, $name, $($fields)*) }; } +#[allow(unused_macro_rules)] macro_rules! trace_span { ( $name:expr ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Trace, $name, ) }; ( $name:expr, $($fields:tt)* ) => { $crate::tracing::implementation::span!($crate::tracing::Level::Trace, $name, $($fields)*) }; diff --git a/x11rb/src/wrapper.rs b/x11rb/src/wrapper.rs index 5b35b885..9643f2c5 100644 --- a/x11rb/src/wrapper.rs +++ b/x11rb/src/wrapper.rs @@ -1,7 +1,5 @@ //! Some wrappers around the generated code to simplify use. -use std::convert::TryInto; - use super::cookie::VoidCookie; use super::errors::{ConnectionError, ReplyError}; use super::protocol::xproto::{Atom, ConnectionExt as XProtoConnectionExt, PropMode, Window}; diff --git a/x11rb/src/xcb_ffi/mod.rs b/x11rb/src/xcb_ffi/mod.rs index 7cbded96..be32134b 100644 --- a/x11rb/src/xcb_ffi/mod.rs +++ b/x11rb/src/xcb_ffi/mod.rs @@ -2,7 +2,6 @@ //! //! This module is only available when the `allow-unsafe-code` feature is enabled. -use std::convert::TryInto; use std::ffi::CStr; use std::io::{Error as IOError, ErrorKind, IoSlice}; use std::os::raw::c_int; diff --git a/xcbgen-rs/src/lib.rs b/xcbgen-rs/src/lib.rs index 51dcaf50..d942308e 100644 --- a/xcbgen-rs/src/lib.rs +++ b/xcbgen-rs/src/lib.rs @@ -11,8 +11,7 @@ trivial_numeric_casts, unsafe_code, unreachable_pub, - unused_import_braces, - unused_must_use, + unused, unused_qualifications, missing_copy_implementations, missing_debug_implementations, diff --git a/xtrace-example/src/connection.rs b/xtrace-example/src/connection.rs index 425d5a65..616a19de 100644 --- a/xtrace-example/src/connection.rs +++ b/xtrace-example/src/connection.rs @@ -1,6 +1,5 @@ use futures_io::{AsyncRead, AsyncWrite}; use std::cell::RefCell; -use std::convert::{TryFrom, TryInto}; use std::io::Result as IOResult; use std::sync::atomic::{AtomicBool, Ordering}; diff --git a/xtrace-example/src/connection_inner.rs b/xtrace-example/src/connection_inner.rs index 8b40fa79..db97a77e 100644 --- a/xtrace-example/src/connection_inner.rs +++ b/xtrace-example/src/connection_inner.rs @@ -6,7 +6,6 @@ use x11rb_protocol::x11_utils::{ }; use std::collections::VecDeque; -use std::convert::TryInto; /// Parse some data and print the resulting object. /// diff --git a/xtrace-example/src/main.rs b/xtrace-example/src/main.rs index e4459b94..fea07c65 100644 --- a/xtrace-example/src/main.rs +++ b/xtrace-example/src/main.rs @@ -36,18 +36,19 @@ //! The code in `connection_inner` then handles decoding X11 packets, updating the state of the //! connection, and generating output via `println!`. +#![deny( + // Contains unreachable_code and "?" generates an #[allow] for this + unused, + // #[derive] generates an #[allow] for this; not part of "unused" + unused_qualifications, +)] #![forbid( missing_docs, rust_2018_idioms, trivial_casts, trivial_numeric_casts, - unused_import_braces, unused_results )] -#![deny( - // #[derive] generates an #[allow] for this - unused_qualifications, -)] use smol::Async; use std::io::Result as IOResult;