@[email protected] to [email protected] • 11 months agoAnnouncing Rust 1.76.0blog.rust-lang.orgexternal-linkmessage-square23fedilinkarrow-up1100arrow-down10
arrow-up1100arrow-down1external-linkAnnouncing Rust 1.76.0blog.rust-lang.org@[email protected] to [email protected] • 11 months agomessage-square23fedilink
minus-square@[email protected]linkfedilinkEnglish12•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-square@[email protected]linkfedilink1•11 months agoWarning: in the first case “value” is actually a shared reference, not a value.
let 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 });
Warning: in the first case “value” is actually a shared reference, not a value.
Elegant. Thanks!