Implement Default for OsString
This commit is contained in:
parent
690f160f8f
commit
08eaf07dbc
@ -173,6 +173,14 @@ impl ops::Deref for OsString {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.9.0")]
|
||||
impl Default for OsString {
|
||||
#[inline]
|
||||
fn default() -> OsString {
|
||||
OsString::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Debug for OsString {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
@ -554,6 +562,12 @@ mod tests {
|
||||
assert!(os_string.capacity() >= 33)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_os_string_default() {
|
||||
let os_string: OsString = Default::default();
|
||||
assert_eq!("", &os_string);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_os_str_is_empty() {
|
||||
let mut os_string = OsString::new();
|
||||
|
Loading…
Reference in New Issue
Block a user