6 ms·
It took me a few extra seconds to parse the headline. ("footgun" didn't help) Is <Vec<_>>() perhaps to become another ¯\_(ツ)_/¯ ?
by stcredzero 3y ago
It took me a few extra seconds to parse the headline. ("footgun" didn't help) Is
<Vec<_>>()
perhaps to become another
¯\_(ツ)_/¯
?
- avgcorrection 3y agoYes? What about unamused Vec?
- tialaramex 3y agoIt's interesting that HN zapped the second colon. The headline here (at time of my posting) is: "Identifying Rust's collect:<Vec<_>>() memory leak footgun" but the actual title of the blog post is: "Identifying Rust's collect::<Vec<_>>() memory leak footgun" That extra colon matters to Rust's syntax.
- unshavedyak 3y agoNot sure what you're asking. At risk of loosely explaining what you may already know, `<Vec<_>>` is a generic parameter `<T>` with the type `T` specified as `Vec`. Vec also has a param, `<_>`, where the type is ignored - as the compiler can figure that out. Sidenote, `<Vec<_>>` is missing the best part - the fish head, to become `::<Vec<_>>`, aka `::<>` - the Turbo Fish :D I admit to using this syntax more than necessary just so i can write a turbofish :D edit: Wait no, `<>` is the head - isn't it. hah. So i guess it's missing the fins? /shrug