|
|
Subscribe / Log in / New account

Underscores in Rust

Underscores in Rust

Posted Feb 11, 2025 15:59 UTC (Tue) by farnz (subscriber, #17727)
In reply to: Underscores in Rust by adobriyan
Parent article: Maintainer opinions on Rust-for-Linux

It's very specifically a special case where you name a let binding _; you can't read it (_ isn't a real variable), and it drops anything bound to it immediately. _foo and foo behave in exactly the same way, however.


to post comments

Underscores in Rust

Posted Feb 11, 2025 20:42 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

A small nitpick: `_foo` will not trigger diagnostics if it is not used whereas an unused `foo` will.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds