Skip to content

Commit 4357cbf

Browse files
committed
Made unsafely safe functions unsafe again, for safety
1 parent 276293a commit 4357cbf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,20 +2319,20 @@ pub mod raw {
23192319
}
23202320

23212321
/// Removes the last byte from a string and returns it. (Not UTF-8 safe).
2322-
pub fn pop_byte(s: &mut ~str) -> u8 {
2322+
pub unsafe fn pop_byte(s: &mut ~str) -> u8 {
23232323
let len = len(*s);
23242324
assert!((len > 0u));
23252325
let b = s[len - 1u];
2326-
unsafe { set_len(s, len - 1u) };
2326+
set_len(s, len - 1u);
23272327
return b;
23282328
}
23292329

23302330
/// Removes the first byte from a string and returns it. (Not UTF-8 safe).
2331-
pub fn shift_byte(s: &mut ~str) -> u8 {
2331+
pub unsafe fn shift_byte(s: &mut ~str) -> u8 {
23322332
let len = len(*s);
23332333
assert!((len > 0u));
23342334
let b = s[0];
2335-
*s = unsafe { raw::slice_bytes_owned(*s, 1u, len) };
2335+
*s = raw::slice_bytes_owned(*s, 1u, len);
23362336
return b;
23372337
}
23382338

0 commit comments

Comments
 (0)