No need to do an extra copy in Location::add
It seems we do a copy already when passing self to this method.
@@ -48,10 +48,9 @@ impl std::ops::Sub for Location {
impl std::ops::Add<char> for Location {
type Output = Location;
- fn add(self, c: char) -> Self::Output {
- let mut l = self; // copy
- l.shift(c);
- l
+ fn add(mut self, c: char) -> Self::Output {
+ self.shift(c);
+ self
}
}
