Rollup merge of #51306 - kennytm:impl-default-for-mut-str, r=SimonSapin
impl Default for &mut str Rationale: There is already `impl Default for &mut [T]`. Note: This impl is insta-stable.
This commit is contained in:
commit
5bbe1ebe00
@ -1326,6 +1326,7 @@ fn test_str_default() {
|
||||
|
||||
t::<&str>();
|
||||
t::<String>();
|
||||
t::<&mut str>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -3875,6 +3875,12 @@ impl<'a> Default for &'a str {
|
||||
fn default() -> &'a str { "" }
|
||||
}
|
||||
|
||||
#[stable(feature = "default_mut_str", since = "1.28.0")]
|
||||
impl<'a> Default for &'a mut str {
|
||||
/// Creates an empty mutable str
|
||||
fn default() -> &'a mut str { unsafe { from_utf8_unchecked_mut(&mut []) } }
|
||||
}
|
||||
|
||||
/// An iterator over the non-whitespace substrings of a string,
|
||||
/// separated by any amount of whitespace.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user