ascii::Char-ify the escaping code
This means that `EscapeIterInner::as_str` no longer needs unsafe code, because the type system ensures the internal buffer is only ASCII, and thus valid UTF-8.
This commit is contained in:
@@ -91,7 +91,7 @@ pub struct EscapeDefault(escape::EscapeIterInner<4>);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn escape_default(c: u8) -> EscapeDefault {
|
||||
let mut data = [0; 4];
|
||||
let mut data = [Char::Null; 4];
|
||||
let range = escape::escape_ascii_into(&mut data, c);
|
||||
EscapeDefault(escape::EscapeIterInner::new(data, range))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user