|
|
|
|
|
by kevincox
1010 days ago
|
|
rust-analyzer has this as well. I've never actually used it though. In most cases where I would have found it useful the function was so simple that I just did it manually without thinking. This also seems to do a better job cleaning up the resulting code than rust-analyzer does for example. let cell = self.cell_mut(pos);
Becomes: let cell = {
let ref mut this = self;
&mut this.board[usize::from(pos)]
};
Instead of: let cell = &mut self.board[usize::from(pos)];
It did manage to simplify the argument (maybe because it was the same name?) but had to rename `self`. |
|