- 
                Notifications
    You must be signed in to change notification settings 
- Fork 421
          Reduce Boxing using impl Trait in trait methods post-MSRV-bump
          #4175
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
  
    Reduce Boxing using impl Trait in trait methods post-MSRV-bump
  
  #4175
              Conversation
| 👋 Thanks for assigning @tnull as a reviewer! | 
| There's still a few  | 
e8fa417    to
    d54050d      
    Compare
  
    | Codecov Report❌ Patch coverage is  Additional details and impacted files@@            Coverage Diff             @@
##             main    #4175      +/-   ##
==========================================
- Coverage   88.85%   88.84%   -0.02%     
==========================================
  Files         180      180              
  Lines      137863   137884      +21     
  Branches   137863   137884      +21     
==========================================
+ Hits       122496   122498       +2     
- Misses      12561    12579      +18     
- Partials     2806     2807       +1     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
9d5a3e2    to
    724caa8      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how much this cleans up the new async traits, I do wonder if we want to ship this for 0.2 afterall?
| "lightning-macros", | ||
| "lightning-dns-resolver", | ||
| "lightning-liquidity", | ||
| "lightning-transaction-sync", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As BDK is about to bump their MSRV to 1.85, let's not bother with this if we need to move it out again shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought they agreed to keep the utility crates to 1.75?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I thought they were gonna walk it back to 1.75...
| 👋 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. | 
| 
 Meh, I don't think they clean them up that much, they just remove a  | 
Now that it has the same MSRV as everything else in the workspace, it doesn't need to live on its own.
Now that our MSRV is above 1.68 we can use the `pin!` macro to avoid having to `Box` various futures, avoiding some allocations, especially in `lightning-net-tokio`, which happens in a tight loop.
Now that our MSRV is 1.75, we can return `impl Trait` from trait methods. Here we use this to clean up `KVStore` methods, dropping the `Pin<Box<dyn ...>>` we had to use to have trait methods return a concrete type. Sadly, there's two places where we can't drop a `Box::pin` until we switch to edition 2024.
Now that our MSRV is 1.75, we can return `impl Trait` from trait methods. Here we use this to clean up `lightning-block-sync` trait methods, dropping the `Pin<Box<dyn ...>>` we had to use to have trait methods return a concrete type.
Now that our MSRV is 1.75, we can return `impl Trait` from trait methods. Here we use this to clean up `lightning` crate trait methods, dropping the `Pin<Box<dyn ...>>`/`AsyncResult` we had to use to have trait methods return a concrete type.
Now that we have an MSRV that supports returning `impl Trait` in trait methods, we can use it to avoid the `Box<dyn ...>` we had spewed all over our BOLT 11 invoice serialization.
724caa8    to
    a467664      
    Compare
  
    | Rebased to pick up #4180, this should now pass CI (modulo fuzzing, which still confuses me). | 
| The CI failure is bitcoindevkit/rust-electrum-client#181 which is unrelated to this PR and its just that we're now testing it. | 
A handful of cleanups now that we bumped the MSRV and can use
impl Traitin trait methods.