Avoid unnecessary calculation

This commit is contained in:
Shotaro Yamada
2018-03-04 09:43:29 +09:00
parent 683bdc7f0a
commit 3d58543d49

View File

@@ -2113,9 +2113,9 @@ impl str {
(buf.as_mut_ptr() as *mut u8).add(buf.len()), (buf.as_mut_ptr() as *mut u8).add(buf.len()),
rem_len, rem_len,
); );
// `buf.len() + rem_len` equals to `buf.capacity()` (`self.len() * n`). // `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
let buf_len = buf.len(); let buf_cap = buf.capacity();
buf.set_len(buf_len + rem_len); buf.set_len(buf_cap);
} }
} }