Hacker News new | ask | show | jobs
by Animats 3333 days ago
The author tries too hard to avoid using the word "object".

"Must use" objects don't seem to be all that useful. More justification is needed. Is the author thinking of Javascript-like callback approaches, broken "promises", and such?

1 comments

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.