This is just a style question, but it's bugged me for years so I wanted to see if anyone else had any ideas. It concerns methods that take ownership of instances of Self.
pub fn some_func(self) -> Self
I notice in the core, and std APIs I haven't seen any of them take mut self:
pub fn some_func(mut self) -> Self
That led me to conclude that explicitly specifying mut in the method signature when taking ownership is somehow ugly. Leaking implementation details unnecessarily. After all, it's taking ownership so the method can mutate it if it wants to.
I don't think this example showing that the pattern affects the API. The code compiles just as well if the destructuring into let (_i, mut x) = arg; is done locally. Also, all it shows is how the pattern being used determines whether the implementation compiles at all, whereas an example of something affecting the API would need two function implementations to compile, but the callers to behave differently or compile vs. not compile.