Reduce `Box`ing using `impl Trait` in trait methods post-MSRV-bump
A handful of cleanups now that we bumped the MSRV and can use impl Trait in trait methods.
👋 Thanks for assigning @tnull as a reviewer! I'll wait for their review and will help manage the review process. Once they submit their review, I'll check if a second reviewer would be helpful.
There's still a few Box::pins in lightning-background-processor that we really should be able to get rid of, but its not entirely trivial so I didn't do it here.
Codecov Report
:x: Patch coverage is 73.94636% with 68 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 89.32%. Comparing base (e42e74e) to head (b1f1ee2).
:warning: Report is 106 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #4175 +/- ##
==========================================
- Coverage 89.33% 89.32% -0.01%
==========================================
Files 180 180
Lines 138055 138076 +21
Branches 138055 138076 +21
==========================================
+ Hits 123326 123333 +7
- Misses 12122 12141 +19
+ Partials 2607 2602 -5
| Flag | Coverage Δ | |
|---|---|---|
| fuzzing | 33.56% <12.41%> (-0.01%) |
:arrow_down: |
| tests | 88.71% <73.94%> (-0.01%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
👋 The first review has been submitted!
Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.
Given how much this cleans up the new async traits, I do wonder if we want to ship this for 0.2 afterall?
Meh, I don't think they clean them up that much, they just remove a Box::pin, and actually they become a bit more annoying to work with (see the few places we have to keep the Box::pin cause of rustc mess). It becomes a bit easier to work with in edition 2024, which luckily a downstream crate could choose to use if they want.
Rebased to pick up #4180, this should now pass CI (modulo fuzzing, which still confuses me).
The CI failure is https://github.com/bitcoindevkit/rust-electrum-client/issues/181 which is unrelated to this PR and its just that we're now testing it.
Rebased for the restoration of the lazy flag.
Fixed a bunk rebase.
Oops, fixed a no-std error in the new BP stuff:
$ git diff-tree -U1 05717d0860 20697053c
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index 874c82f19d..bc0d42ac19 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -43,2 +43,4 @@ use lightning::util::ser::Writeable;
+#[cfg(not(c_bindings))]
+use lightning::io::Error;
use lightning::ln::channelmanager::AChannelManager;
@@ -53,2 +55,4 @@ use lightning::sign::{
};
+#[cfg(not(c_bindings))]
+use lightning::util::async_poll::MaybeSend;
use lightning::util::logger::Logger;
@@ -430,4 +434,3 @@ impl KVStore for DummyKVStore {
&self, _: &str, _: &str, _: &str,
- ) -> impl core::future::Future<Output = Result<Vec<u8>, lightning::io::Error>> + Send + 'static
- {
+ ) -> impl core::future::Future<Output = Result<Vec<u8>, Error>> + MaybeSend + 'static {
async { unimplemented!() }
@@ -437,3 +440,3 @@ impl KVStore for DummyKVStore {
&self, _: &str, _: &str, _: &str, _: Vec<u8>,
- ) -> impl core::future::Future<Output = Result<(), lightning::io::Error>> + Send + 'static {
+ ) -> impl core::future::Future<Output = Result<(), Error>> + MaybeSend + 'static {
async { unimplemented!() }
@@ -443,3 +446,3 @@ impl KVStore for DummyKVStore {
&self, _: &str, _: &str, _: &str, _: bool,
- ) -> impl core::future::Future<Output = Result<(), lightning::io::Error>> + Send + 'static {
+ ) -> impl core::future::Future<Output = Result<(), Error>> + MaybeSend + 'static {
async { unimplemented!() }
@@ -449,4 +452,3 @@ impl KVStore for DummyKVStore {
&self, _: &str, _: &str,
- ) -> impl core::future::Future<Output = Result<Vec<String>, lightning::io::Error>> + Send + 'static
- {
+ ) -> impl core::future::Future<Output = Result<Vec<String>, Error>> + MaybeSend + 'static {
async { unimplemented!() }
This needs another rebase unfortunately. Also, good opportunity to check whether the electrum-client release really fixed our doc builds.
Oops, no big deal, done.
Feel free to rebase once more as we just landed https://github.com/lightningdevkit/rust-lightning/pull/4206 to check for breakages.
Rebased to drop the duplicative CI fixes.