Always check `next_route` in `TestRouter` is fully consumed
authorMatt Corallo <git@bluematt.me>
Fri, 3 Feb 2023 02:17:41 +0000 (02:17 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 16 Feb 2023 21:35:25 +0000 (21:35 +0000)
...rather than only in std.

lightning/src/util/test_utils.rs

index 83647a733853029b2501606bc41dc8cec266f1c0..2d68e74c2e594978ca645bc5ef1dd7f34466f860 100644 (file)
@@ -114,11 +114,12 @@ impl<'a> Router for TestRouter<'a> {
        fn notify_payment_probe_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {}
 }
 
-#[cfg(feature = "std")] // If we put this on the `if`, we get "attributes are not yet allowed on `if` expressions" on 1.41.1
 impl<'a> Drop for TestRouter<'a> {
        fn drop(&mut self) {
-               if std::thread::panicking() {
-                       return;
+               #[cfg(feature = "std")] {
+                       if std::thread::panicking() {
+                               return;
+                       }
                }
                assert!(self.next_routes.lock().unwrap().is_empty());
        }