this post was submitted on 07 Aug 2025
68 points (100.0% liked)

Rust

7243 readers
6 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] anton@lemmy.blahaj.zone 4 points 6 days ago (1 children)

You can already :

res_res??;

I think it's more for cases where you don't want to return, like

let new_res = old_res.map(func).flatten();
[โ€“] sukhmel@programming.dev 4 points 6 days ago

This, it's not a thing that happens often, but there were a couple of times when flatten would've been handy

This was also usually a result of a chain of and_then that could do with some flattening. This could've been rewritten as a separate function to make use of ?, but it seems to be a bigger trouble than use