refactor: add macro_use_extern_crate rustc style/readability lint (#919)

This lint warns on each `macro_use` attribute on an extern crate. Such a
way of importing macros from a crate is being phased out. Instead of it,
we should directly import the needed macro using `use` import.
This commit is contained in:
Alex Yusiuk
2025-08-19 09:45:34 -04:00
committed by GitHub
parent 35c19ce444
commit c84b46be91
90 changed files with 103 additions and 95 deletions
+1
View File
@@ -65,6 +65,7 @@ unused_lifetimes = "warn"
unused_qualifications = "warn"
keyword_idents = "warn"
noop_method_call = "warn"
macro_use_extern_crate = "warn"
# missing_docs = "warn" # TODO: NOTE(@CBenoit): we probably want to ensure this in core tier crates only
# == Compile-time / optimization == #
@@ -7,6 +7,7 @@ use ironrdp_core::WriteBuf;
use ironrdp_pdu::x224::X224;
use ironrdp_pdu::{self as pdu};
use pdu::mcs;
use tracing::debug;
#[derive(Debug)]
pub struct ChannelConnectionSequence {
@@ -15,6 +15,7 @@ use pdu::rdp::headers::ShareControlPdu;
use pdu::rdp::server_error_info::{ErrorInfo, ProtocolIndependentCode, ServerSetErrorInfoPdu};
use pdu::rdp::server_license::{LicensePdu, LicensingErrorMessage};
use pdu::{gcc, mcs, nego, rdp};
use tracing::{debug, warn};
use super::channel_connection::ChannelConnectionSequence;
use super::finalization::FinalizationSequence;
+1
View File
@@ -10,6 +10,7 @@ use ironrdp_connector::{
};
use ironrdp_core::{other_err, WriteBuf};
use ironrdp_pdu::PduHint;
use tracing::debug;
#[derive(Debug)]
pub(crate) enum CredsspState {
@@ -3,6 +3,7 @@ use ironrdp_core::WriteBuf;
use ironrdp_pdu::x224::X224;
use ironrdp_pdu::{self as pdu};
use pdu::rdp;
use tracing::debug;
use crate::util::{self, wrap_share_data};
+1 -3
View File
@@ -1,14 +1,12 @@
#![cfg_attr(doc, doc = include_str!("../README.md"))]
#![doc(html_logo_url = "https://cdnweb.devolutions.net/images/projects/devolutions/logos/devolutions-icon-shadow.svg")]
#[macro_use]
extern crate tracing;
use ironrdp_async::{single_sequence_step, AsyncNetworkClient, Framed, FramedRead, FramedWrite, StreamWrapper};
use ironrdp_connector::sspi::credssp::EarlyUserAuthResult;
use ironrdp_connector::sspi::{AuthIdentity, KerberosServerConfig, Username};
use ironrdp_connector::{custom_err, general_err, ConnectorResult, ServerName};
use ironrdp_core::WriteBuf;
use tracing::{debug, instrument, trace};
mod channel_connection;
mod connection;
+1
View File
@@ -6,6 +6,7 @@ use ironrdp_connector::{
ServerName, State as _,
};
use ironrdp_core::WriteBuf;
use tracing::{debug, info, instrument, trace};
use crate::framed::{Framed, FramedRead, FramedWrite};
use crate::{single_sequence_step, AsyncNetworkClient};
+1
View File
@@ -4,6 +4,7 @@ use bytes::{Bytes, BytesMut};
use ironrdp_connector::{ConnectorResult, Sequence, Written};
use ironrdp_core::WriteBuf;
use ironrdp_pdu::PduHint;
use tracing::{debug, trace};
// TODO: investigate if we could use static async fn / return position impl trait in traits when stabilized:
// https://github.com/rust-lang/rust/issues/91611
-3
View File
@@ -1,9 +1,6 @@
#![cfg_attr(doc, doc = include_str!("../README.md"))]
#![doc(html_logo_url = "https://cdnweb.devolutions.net/images/projects/devolutions/logos/devolutions-icon-shadow.svg")]
#[macro_use]
extern crate tracing;
pub use bytes;
mod connector;
+1
View File
@@ -9,6 +9,7 @@ use ironrdp_connector::{
Sequence as _, ServerName, State as _,
};
use ironrdp_core::WriteBuf;
use tracing::{debug, info, instrument, trace};
use crate::framed::Framed;
+1
View File
@@ -2,6 +2,7 @@ use std::io::{self, Read, Write};
use bytes::{Bytes, BytesMut};
use ironrdp_pdu::PduHint;
use tracing::debug;
pub struct Framed<S> {
stream: S,
-3
View File
@@ -1,9 +1,6 @@
#![cfg_attr(doc, doc = include_str!("../README.md"))]
#![doc(html_logo_url = "https://cdnweb.devolutions.net/images/projects/devolutions/logos/devolutions-icon-shadow.svg")]
#[macro_use]
extern crate tracing;
mod connector;
mod framed;
mod session;
-3
View File
@@ -1,6 +1,3 @@
#[macro_use]
extern crate tracing;
mod config;
use std::sync::mpsc::sync_channel;
+1
View File
@@ -7,6 +7,7 @@ use std::time::Instant;
use raw_window_handle::{DisplayHandle, HasDisplayHandle as _};
use tokio::sync::mpsc;
use tracing::{debug, error, trace};
use winit::application::ApplicationHandler;
use winit::dpi::{LogicalPosition, PhysicalSize};
use winit::event::{self, WindowEvent};
+1
View File
@@ -1,5 +1,6 @@
use ironrdp::cliprdr::backend::{ClipboardMessage, ClipboardMessageProxy};
use tokio::sync::mpsc;
use tracing::error;
use crate::rdp::RdpInputEvent;
-3
View File
@@ -9,9 +9,6 @@
#![allow(clippy::cast_possible_wrap)]
#![allow(clippy::cast_sign_loss)]
#[macro_use]
extern crate tracing;
pub mod app;
pub mod clipboard;
pub mod config;
+1 -3
View File
@@ -1,13 +1,11 @@
#![allow(unused_crate_dependencies)] // false positives because there is both a library and a binary
#[macro_use]
extern crate tracing;
use anyhow::Context as _;
use ironrdp_client::app::App;
use ironrdp_client::config::{ClipboardType, Config};
use ironrdp_client::rdp::{DvcPipeProxyFactory, RdpClient, RdpInputEvent, RdpOutputEvent};
use tokio::runtime;
use tracing::debug;
use winit::event_loop::EventLoop;
fn main() -> anyhow::Result<()> {
+1
View File
@@ -23,6 +23,7 @@ use smallvec::SmallVec;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpStream;
use tokio::sync::mpsc;
use tracing::{debug, error, info, trace, warn};
use winit::event_loop::EventLoopProxy;
use crate::config::{Config, RDCleanPathConfig};
@@ -4,8 +4,11 @@ use std::collections::HashSet;
use ironrdp_core::WriteBuf;
use ironrdp_pdu::x224::X224;
use ironrdp_pdu::{mcs, PduHint};
use tracing::{debug, warn};
use crate::{ConnectorError, ConnectorErrorExt as _, ConnectorResult, Sequence, State, Written};
use crate::{
general_err, reason_err, ConnectorError, ConnectorErrorExt as _, ConnectorResult, Sequence, State, Written,
};
#[derive(Default, Debug)]
#[non_exhaustive]
+3 -2
View File
@@ -8,13 +8,14 @@ use ironrdp_pdu::rdp::client_info::{OptionalSystemTime, TimezoneInfo};
use ironrdp_pdu::x224::X224;
use ironrdp_pdu::{gcc, mcs, nego, rdp, PduHint};
use ironrdp_svc::{StaticChannelSet, StaticVirtualChannel, SvcClientProcessor};
use tracing::{debug, error, info, warn};
use crate::channel_connection::{ChannelConnectionSequence, ChannelConnectionState};
use crate::connection_activation::{ConnectionActivationSequence, ConnectionActivationState};
use crate::license_exchange::{LicenseExchangeSequence, NoopLicenseCache};
use crate::{
encode_x224_packet, Config, ConnectorError, ConnectorErrorExt as _, ConnectorErrorKind, ConnectorResult,
DesktopSize, NegotiationFailure, Sequence, State, Written,
encode_x224_packet, general_err, reason_err, Config, ConnectorError, ConnectorErrorExt as _, ConnectorErrorKind,
ConnectorResult, DesktopSize, NegotiationFailure, Sequence, State, Written,
};
#[derive(Debug)]

Some files were not shown because too many files have changed in this diff Show More