Hacker News new | ask | show | jobs
by moosingin3space 3332 days ago
Rust's Result type is a "must use" type, which makes it impossible to skip an error check.
2 comments

Hardly impossible, just prefix the expression with `[` and suffix with `]` and the warning is gone. Or with `(` and `,)` (creating a tuple of arity one).
Can you assign it to a variable and then ignore it?
Yes, assignment counts as a use.

That will get you an "unused variable" warning though, which you can suppress by binding to _ instead.