Skip to content

Commit 36a704e

Browse files
committed
Signed-off-by: tison <[email protected]>
1 parent f17cb6a commit 36a704e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/std/src/path.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1577,13 +1577,12 @@ impl PathBuf {
15771577
// this is necessary for trimming the trailing slash
15781578
let end_file_name = file_name[file_name.len()..].as_ptr().addr();
15791579
let start = self.inner.as_encoded_bytes().as_ptr().addr();
1580-
let v = self.as_mut_vec();
1581-
v.truncate(end_file_name.wrapping_sub(start));
1580+
self.inner.truncate(end_file_name.wrapping_sub(start));
15821581

15831582
// append the new extension
1584-
v.reserve_exact(new.len() + 1);
1585-
v.push(b'.');
1586-
v.extend_from_slice(new);
1583+
self.inner.reserve_exact(new.len() + 1);
1584+
self.inner.push(b'.');
1585+
self.inner.extend_from_slice(new);
15871586
}
15881587

15891588
true

0 commit comments

Comments
 (0)