Revert "Allow unused imports for traits used in macros"
What changed, and why it matters
This commit is a simple cleanup that removes unnecessary 'allow unused import' annotations and rewrites trait imports to be explicit. It has no security relevance—it only affects compiler warnings and code style.
No security action needed. Treat as ordinary code-quality maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch reverts a previous change that added #[allow(unused_imports)] comments and imported traits using as _ (anonymous import). It replaces those with normal named trait imports. This is purely a lint/style fix with no functional code changes.
Changed components
lightning-block-sync/src/lib.rslightning/src/chain/chainmonitor.rslightning/src/chain/channelmonitor.rslightning/src/ln/channelmanager.rsInspect captured patch +4 / −10
diff --git a/lightning-block-sync/src/lib.rs b/lightning-block-sync/src/lib.rs
index 6cc8e2f..281a05a 100644
--- a/lightning-block-sync/src/lib.rs
+++ b/lightning-block-sync/src/lib.rs
@@ -49,8 +49,7 @@ use bitcoin::hash_types::BlockHash;
use bitcoin::pow::Work;
use lightning::chain;
-#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
-use lightning::chain::Listen as _;
+use lightning::chain::Listen;
use std::future::Future;
use std::ops::Deref;
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 58770d6..0de3728 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -33,9 +33,7 @@ use crate::chain::channelmonitor::{
WithChannelMonitor,
};
use crate::chain::transaction::{OutPoint, TransactionData};
-#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
-use crate::chain::Filter as _;
-use crate::chain::{ChannelMonitorUpdateStatus, WatchedOutput};
+use crate::chain::{ChannelMonitorUpdateStatus, Filter, WatchedOutput};
use crate::events::{self, Event, EventHandler, ReplayEvent};
use crate::ln::channel_state::ChannelDetails;
use crate::ln::msgs::{self, BaseMessageHandler, Init, MessageSendEvent, SendOnlyMessageHandler};
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index 7738fd2..c7011af 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -42,8 +42,7 @@ use crate::chain::package::{
HolderHTLCOutput, PackageSolvingData, PackageTemplate, RevokedHTLCOutput, RevokedOutput,
};
use crate::chain::transaction::{OutPoint, TransactionData};
-#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
-use crate::chain::Filter as _;
+use crate::chain::Filter;
use crate::chain::{BestBlock, WatchedOutput};
use crate::events::bump_transaction::{AnchorDescriptor, BumpTransactionEvent};
use crate::events::{ClosureReason, Event, EventHandler, ReplayEvent};
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 455f3e9..8ab1724 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -50,9 +50,7 @@ use crate::chain::channelmonitor::{
LATENCY_GRACE_PERIOD_BLOCKS, MAX_BLOCKS_FOR_CONF,
};
use crate::chain::transaction::{OutPoint, TransactionData};
-#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
-use crate::chain::Watch as _;
-use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm};
+use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Watch};
use crate::events::{
self, ClosureReason, Event, EventHandler, EventsProvider, HTLCHandlingFailureType,
InboundChannelFunds, PaymentFailureReason, ReplayEvent,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.