inner truncate methods for UEFI platforms · model-checking/verify-rust-std@37f78f4 (original) (raw)
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -557,6 +557,11 @@ impl OsString { | ||
557 | 557 | pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> { |
558 | 558 | self.inner.as_mut_vec_for_path_buf() |
559 | 559 | } |
560 | + | |
561 | +#[inline] | |
562 | +pub(crate) fn truncate(&mut self, len: usize) { | |
563 | +self.inner.truncate(len); | |
564 | +} | |
560 | 565 | } |
561 | 566 | |
562 | 567 | #[stable(feature = "rust1", since = "1.0.0")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1305,7 +1305,7 @@ impl PathBuf { | ||
1305 | 1305 | |
1306 | 1306 | // absolute `path` replaces `self` |
1307 | 1307 | if path.is_absolute() | |
1308 | -self.as_mut_vec().truncate(0); | |
1308 | +self.inner.truncate(0); | |
1309 | 1309 | |
1310 | 1310 | // verbatim paths need . and .. removed |
1311 | 1311 | } else if comps.prefix_verbatim() && !path.inner.is_empty() { |
@@ -1350,7 +1350,7 @@ impl PathBuf { | ||
1350 | 1350 | // `path` has a root but no prefix, e.g., `\windows` (Windows only) |
1351 | 1351 | } else if path.has_root() { |
1352 | 1352 | let prefix_len = self.components().prefix_remaining(); |
1353 | -self.as_mut_vec().truncate(prefix_len); | |
1353 | +self.inner.truncate(prefix_len); | |
1354 | 1354 | |
1355 | 1355 | // `path` is a pure relative path |
1356 | 1356 | } else if need_sep { |
@@ -1383,7 +1383,7 @@ impl PathBuf { | ||
1383 | 1383 | pub fn pop(&mut self) -> bool { |
1384 | 1384 | match self.parent().map(|p |
1385 | 1385 | Some(len) => { |
1386 | -self.as_mut_vec().truncate(len); | |
1386 | +self.inner.truncate(len); | |
1387 | 1387 | true |
1388 | 1388 | } |
1389 | 1389 | None => false, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -207,6 +207,11 @@ impl Buf { | ||
207 | 207 | pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> { |
208 | 208 | &mut self.inner |
209 | 209 | } |
210 | + | |
211 | +#[inline] | |
212 | +pub(crate) fn truncate(&mut self, len: usize) { | |
213 | +self.inner.truncate(len); | |
214 | +} | |
210 | 215 | } |
211 | 216 | |
212 | 217 | impl Slice { |