Commit 8d6e14d
committed
Auto merge of rust-lang#327 - JustForFun88:master, r=Amanieu
Removing additional third copy operation for OccupiedEntry::insert
Removing unnecessary additional third copy operation for `OccupiedEntry::insert` and `OccupiedEntryRef::insert` because with `swap` we have three operation:
1. `Read` from `x` to the third value `z`,
2. `Copy` from `y` to `x`,
3. `Copy` from `z` to the `y` value.
But when we use `replace` funtion we actually do only first two operation and immediatly return z value and skip third `copy` operation1 file changed
+4
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3587 | 3587 | | |
3588 | 3588 | | |
3589 | 3589 | | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
| 3590 | + | |
| 3591 | + | |
3594 | 3592 | | |
3595 | 3593 | | |
3596 | 3594 | | |
| |||
4256 | 4254 | | |
4257 | 4255 | | |
4258 | 4256 | | |
4259 | | - | |
4260 | | - | |
4261 | | - | |
4262 | | - | |
| 4257 | + | |
| 4258 | + | |
4263 | 4259 | | |
4264 | 4260 | | |
4265 | 4261 | | |
| |||
0 commit comments