Use hashbrown replacements for std equivalents
[rust-lightning] / lightning / src / routing / router.rs
index 9f4b8ac3589a27ef7c713751eb1d98ad18596978..0edeef0c3cb3d9629ddcfd4445dbf2f1fccf3af4 100644 (file)
@@ -24,7 +24,6 @@ use util::logger::Logger;
 use prelude::*;
 use alloc::collections::BinaryHeap;
 use core::cmp;
-use std::collections::HashMap;
 use core::ops::Deref;
 
 /// A hop in a route
@@ -3843,6 +3842,7 @@ mod tests {
                }
        }
 
+       #[cfg(not(feature = "no_std"))]
        pub(super) fn random_init_seed() -> u64 {
                // Because the default HashMap in std pulls OS randomness, we can use it as a (bad) RNG.
                use core::hash::{BuildHasher, Hasher};
@@ -3850,9 +3850,11 @@ mod tests {
                println!("Using seed of {}", seed);
                seed
        }
+       #[cfg(not(feature = "no_std"))]
        use util::ser::Readable;
 
        #[test]
+       #[cfg(not(feature = "no_std"))]
        fn generate_routes() {
                let mut d = match super::test_utils::get_route_file() {
                        Ok(f) => f,
@@ -3880,6 +3882,7 @@ mod tests {
        }
 
        #[test]
+       #[cfg(not(feature = "no_std"))]
        fn generate_routes_mpp() {
                let mut d = match super::test_utils::get_route_file() {
                        Ok(f) => f,
@@ -3907,7 +3910,7 @@ mod tests {
        }
 }
 
-#[cfg(test)]
+#[cfg(all(test, not(feature = "no_std")))]
 pub(crate) mod test_utils {
        use std::fs::File;
        /// Tries to open a network graph file, or panics with a URL to fetch it.
@@ -3934,7 +3937,7 @@ pub(crate) mod test_utils {
        }
 }
 
-#[cfg(all(test, feature = "unstable"))]
+#[cfg(all(test, feature = "unstable", not(feature = "no_std")))]
 mod benches {
        use super::*;
        use util::logger::{Logger, Record};