3 ms·
I think the recommendation is to phrase the error message that is given to .expect() not as what went wrong but as what we had expected to happen.[1] If the exa
by nequo 4y ago
I think the recommendation is to phrase the error message that is given to .expect() not as what went wrong but as what we had expected to happen.[1] If the example that you show was consistent with that recommendation, it might look like this:
supervisor
.broadcast("A message containing data.")
.expect("message broadcast should not fail");
Although even if you are a native English speaker, this is dubious improvement if you don’t know what Option types are and what .expect() does with them.
[1] https://doc.rust-lang.org/std/option/enum.Option.html#recommended-message-style https://doc.rust-lang.org/std/option/enum.Option.html#recomm...