Go try this with std::sort (or std::adjacent_find or whatever) and tell me which of their implementations you had to modify.
Go try this with std::sort (or std::adjacent_find or whatever) and tell me which of their implementations you had to modify.
callback();
which cannot be changed into if Err(error) = callback() {
return error;
}
because that would break some invariants.Changing return type from "void" into some "result" is a mechanical change.
> What if they weren't?
Obviously the language wasn't designed for rebels. The implicit understanding with tools is that you use them the way they're meant to be used. Only in that case do you get to assume you'll reap the benefits they claim to provide. If you insist on deliberately dancing to a different tune, then you get exactly what you asked for. You can't drive against traffic and then complain people run into you.
.. but then checking the returned val for error in every call sites is very far from mechanical change. (Attribute about unused return result can help here, with obvious drawbacks.)