Fix unused (import) warnings in `no-std` builds
authorElias Rohrer <dev@tnull.de>
Tue, 12 Dec 2023 17:02:59 +0000 (18:02 +0100)
committerElias Rohrer <dev@tnull.de>
Mon, 18 Dec 2023 07:53:27 +0000 (08:53 +0100)
lightning/src/ln/payment_tests.rs
lightning/src/ln/reload_tests.rs
lightning/src/sync/nostd_sync.rs

index 6af0e63c98bf421bade346f89f1fff303f48e764..73cdf59bbb699fb6966ad964ac99d6f00f3efeb9 100644 (file)
@@ -43,10 +43,9 @@ use crate::ln::functional_test_utils;
 use crate::ln::functional_test_utils::*;
 use crate::routing::gossip::NodeId;
 #[cfg(feature = "std")]
-use {
-       crate::util::time::tests::SinceEpoch,
-       std::time::{SystemTime, Instant, Duration}
-};
+use std::time::{SystemTime, Instant, Duration};
+#[cfg(not(feature = "no-std"))]
+use crate::util::time::tests::SinceEpoch;
 
 #[test]
 fn mpp_failure() {
index b3d52b78f2b5a5a3921c66873325fde418601b2b..1ac290383a48761fa1e892bbc01fc73685aad983 100644 (file)
@@ -15,16 +15,14 @@ use crate::chain::channelmonitor::{CLOSED_CHANNEL_UPDATE_ID, ChannelMonitor};
 use crate::sign::EntropySource;
 use crate::chain::transaction::OutPoint;
 use crate::events::{ClosureReason, Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider};
-use crate::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, PaymentId, Retry, RecipientOnionFields};
+use crate::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, PaymentId, RecipientOnionFields};
 use crate::ln::msgs;
 use crate::ln::msgs::{ChannelMessageHandler, RoutingMessageHandler, ErrorAction};
-use crate::routing::router::{RouteParameters, PaymentParameters};
 use crate::util::test_channel_signer::TestChannelSigner;
 use crate::util::test_utils;
 use crate::util::errors::APIError;
 use crate::util::ser::{Writeable, ReadableArgs};
 use crate::util::config::UserConfig;
-use crate::util::string::UntrustedString;
 
 use bitcoin::hash_types::BlockHash;
 
@@ -496,6 +494,9 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
 
 #[cfg(feature = "std")]
 fn do_test_data_loss_protect(reconnect_panicing: bool, substantially_old: bool, not_stale: bool) {
+       use crate::routing::router::{RouteParameters, PaymentParameters};
+       use crate::ln::channelmanager::Retry;
+       use crate::util::string::UntrustedString;
        // When we get a data_loss_protect proving we're behind, we immediately panic as the
        // chain::Watch API requirements have been violated (e.g. the user restored from a backup). The
        // panic message informs the user they should force-close without broadcasting, which is tested
index 27cfb9b8f782c4bafabecd5180a5d0d2256105c3..0f92bd6caa3ad7c914b304db24d5fa69a8456b85 100644 (file)
@@ -37,10 +37,6 @@ impl<T> Mutex<T> {
                Ok(MutexGuard { lock: self.inner.borrow_mut() })
        }
 
-       pub fn try_lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
-               Ok(MutexGuard { lock: self.inner.borrow_mut() })
-       }
-
        pub fn into_inner(self) -> LockResult<T> {
                Ok(self.inner.into_inner())
        }