Avoid unnecessary calculation
This commit is contained in:
parent
683bdc7f0a
commit
3d58543d49
1 changed files with 3 additions and 3 deletions
|
|
@ -2113,9 +2113,9 @@ impl str {
|
|||
(buf.as_mut_ptr() as *mut u8).add(buf.len()),
|
||||
rem_len,
|
||||
);
|
||||
// `buf.len() + rem_len` equals to `buf.capacity()` (`self.len() * n`).
|
||||
let buf_len = buf.len();
|
||||
buf.set_len(buf_len + rem_len);
|
||||
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
|
||||
let buf_cap = buf.capacity();
|
||||
buf.set_len(buf_cap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue