Skip to content

Commit 0b33c48

Browse files
committed
Replace Box::pin with core::pin::pin! where possible
.. as we can do that in a few places now.
1 parent 562fdef commit 0b33c48

File tree

1 file changed

+4
-9
lines changed
  • lightning-background-processor/src

1 file changed

+4
-9
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ use futures_util::{Joiner, OptionalSelector, Selector, SelectorOutput};
668668
#[cfg_attr(feature = "std", doc = "")]
669669
/// let sleeper = move |d| {
670670
#[cfg_attr(feature = "std", doc = " let mut receiver = stop_receiver.clone();")]
671-
/// Box::pin(async move {
671+
/// core::pin::pin!(async move {
672672
/// tokio::select!{
673673
/// _ = tokio::time::sleep(d) => false,
674674
#[cfg_attr(feature = "std", doc = " _ = receiver.changed() => true,")]
@@ -769,7 +769,6 @@ where
769769
let logger = &logger;
770770
let kv_store = &kv_store;
771771
let fetch_time = &fetch_time;
772-
// We should be able to drop the Box once our MSRV is 1.68
773772
Box::pin(async move {
774773
if let Some(network_graph) = network_graph {
775774
handle_network_graph_update(network_graph, &event)
@@ -923,7 +922,6 @@ where
923922
)
924923
.await
925924
};
926-
// TODO: Once our MSRV is 1.68 we should be able to drop the Box
927925
let mut fut = Box::pin(fut);
928926

929927
// Because persisting the ChannelManager is important to avoid accidental
@@ -992,7 +990,6 @@ where
992990
Ok(())
993991
};
994992

995-
// TODO: Once our MSRV is 1.68 we should be able to drop the Box
996993
futures.set_b(Box::pin(fut));
997994

998995
have_pruned = true;
@@ -1038,7 +1035,6 @@ where
10381035
Ok(())
10391036
};
10401037

1041-
// TODO: Once our MSRV is 1.68 we should be able to drop the Box
10421038
futures.set_c(Box::pin(fut));
10431039
}
10441040
},
@@ -1055,7 +1051,6 @@ where
10551051
Ok(())
10561052
};
10571053

1058-
// TODO: Once our MSRV is 1.68 we should be able to drop the Box
10591054
futures.set_d(Box::pin(fut));
10601055
}
10611056
},
@@ -2616,7 +2611,7 @@ mod tests {
26162611
Arc::clone(&nodes[0].logger),
26172612
Some(Arc::clone(&nodes[0].scorer)),
26182613
move |dur: Duration| {
2619-
Box::pin(async move {
2614+
core::pin::pin!(async move {
26202615
tokio::time::sleep(dur).await;
26212616
false // Never exit
26222617
})
@@ -3126,7 +3121,7 @@ mod tests {
31263121
Some(Arc::clone(&nodes[0].scorer)),
31273122
move |dur: Duration| {
31283123
let mut exit_receiver = exit_receiver.clone();
3129-
Box::pin(async move {
3124+
core::pin::pin!(async move {
31303125
tokio::select! {
31313126
_ = tokio::time::sleep(dur) => false,
31323127
_ = exit_receiver.changed() => true,
@@ -3341,7 +3336,7 @@ mod tests {
33413336
Some(Arc::clone(&nodes[0].scorer)),
33423337
move |dur: Duration| {
33433338
let mut exit_receiver = exit_receiver.clone();
3344-
Box::pin(async move {
3339+
core::pin::pin!(async move {
33453340
tokio::select! {
33463341
_ = tokio::time::sleep(dur) => false,
33473342
_ = exit_receiver.changed() => true,

0 commit comments

Comments
 (0)