snaggen@programming.dev to Rust@programming.dev · 11 months agoAnnouncing Rust 1.76.0blog.rust-lang.orgexternal-linkmessage-square23fedilinkarrow-up199arrow-down10
arrow-up199arrow-down1external-linkAnnouncing Rust 1.76.0blog.rust-lang.orgsnaggen@programming.dev to Rust@programming.dev · 11 months agomessage-square23fedilink
minus-squareanlumo@feddit.delinkfedilinkEnglisharrow-up14arrow-down2·11 months agolet bar: Result = ...; let foo = bar.inspect(|value| log::debug("{}", value)); is equivalent to let bar: Result = ...; let foo = bar.map(|value| { log::debug("{}", value); value });
minus-squarexav@programming.devlinkfedilinkarrow-up1·11 months agoWarning: in the first case “value” is actually a shared reference, not a value.
is equivalent to
Elegant. Thanks!
Warning: in the first case “value” is actually a shared reference, not a value.