Skip to main content


i think .collect::<Vec<_>>() is the ugliest piece of #rust code i have to write on a regular basis

yes i know i can avoid it with let x: Vec<_> = ... or even (collect_vec from itertools)[docs.rs/itertools/latest/itert…]

no i don't have anything against the beloved turbofish in general

#Rust
in reply to Lynnesbian

it's the combination of a full stop, a short lowercase word, two colons, an angle bracket, a short titlecase word, another angle bracket, an underscore, two angle brackets, then parentheses in quick succession

a simple turbofish like .lorem::<Ipsum>() is fine. it's when you add the generics that it gets gross.

and let's not get into .collect::<Result<HashMap<_, _>, _>()? (if that's how you even write it)

in reply to Lynnesbian

Agreed.

Similar to chaos.social/@soc/115486056084…, I think this is another place where Rust's punctuation situation is excessive.

I'd consider `.to[List]` to be the right level of ceremony/complexity for this functionality.

in reply to soc

@soc rust's syntax can be kind of unappealing when you really get into the weeds of things.

i think they do a much better job than C++ on super complex types, but that's not really saying much, is it?

oh and by the way -- congratulations on being the first person to reply to me with a quote toot (or as i've recently taken to calling it, a quoot). here is your award: πŸŽ–οΈ /lh

@soc

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.

⇧