]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix compilation warnings with --features=no-std
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 3 Mar 2022 23:41:44 +0000 (15:41 -0800)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 9 Mar 2022 05:23:25 +0000 (23:23 -0600)
lightning-invoice/src/utils.rs
lightning/src/routing/router.rs
lightning/src/util/test_utils.rs

index fc82541a564e8cbd82c64f75fd37d4fa87ecd8af..78a092e24cc53de30e1f2cd92740625053375a05 100644 (file)
@@ -10,7 +10,9 @@ use lightning::chain;
 use lightning::chain::chaininterface::{BroadcasterInterface, FeeEstimator};
 use lightning::chain::keysinterface::{Recipient, KeysInterface, Sign};
 use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
-use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY, MIN_CLTV_EXPIRY_DELTA};
+use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, MIN_FINAL_CLTV_EXPIRY};
+#[cfg(feature = "std")]
+use lightning::ln::channelmanager::{PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA};
 use lightning::ln::msgs::LightningError;
 use lightning::routing::scoring::Score;
 use lightning::routing::network_graph::{NetworkGraph, RoutingFees};
index c45ce59ac13581a3312c535f5e143747fd52220e..1360aa3ddf475b4791dfafffa503fcd56a46b209 100644 (file)
@@ -1537,9 +1537,9 @@ where L::Target: Logger {
 
 #[cfg(test)]
 mod tests {
-       use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters, Score};
        use routing::network_graph::{NetworkGraph, NetGraphMsgHandler, NodeId};
        use routing::router::{get_route, PaymentParameters, Route, RouteHint, RouteHintHop, RouteHop, RoutingFees};
+       use routing::scoring::Score;
        use chain::transaction::OutPoint;
        use ln::features::{ChannelFeatures, InitFeatures, InvoiceFeatures, NodeFeatures};
        use ln::msgs::{ErrorAction, LightningError, OptionalField, UnsignedChannelAnnouncement, ChannelAnnouncement, RoutingMessageHandler,
@@ -4970,6 +4970,8 @@ mod tests {
        #[test]
        #[cfg(not(feature = "no-std"))]
        fn generate_routes() {
+               use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters};
+
                let mut d = match super::test_utils::get_route_file() {
                        Ok(f) => f,
                        Err(e) => {
@@ -5002,6 +5004,8 @@ mod tests {
        #[test]
        #[cfg(not(feature = "no-std"))]
        fn generate_routes_mpp() {
+               use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters};
+
                let mut d = match super::test_utils::get_route_file() {
                        Ok(f) => f,
                        Err(e) => {
index 9cd2f9ec13e8bd49de15be2fc0f283fe34660eee..2ec679232b9909aaa49727b500221b4fdd46f5e1 100644 (file)
@@ -411,7 +411,10 @@ impl events::MessageSendEventsProvider for TestRoutingMessageHandler {
 
 pub struct TestLogger {
        level: Level,
+       #[cfg(feature = "std")]
        id: String,
+       #[cfg(not(feature = "std"))]
+       _id: String,
        pub lines: Mutex<HashMap<(String, String), usize>>,
 }
 
@@ -422,7 +425,10 @@ impl TestLogger {
        pub fn with_id(id: String) -> TestLogger {
                TestLogger {
                        level: Level::Trace,
+                       #[cfg(feature = "std")]
                        id,
+                       #[cfg(not(feature = "std"))]
+                       _id: id,
                        lines: Mutex::new(HashMap::new())
                }
        }