Hacker News new | past | comments | ask | show | jobs | submit login

Rust's Result type is a "must use" type, which makes it impossible to skip an error check.



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: