mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Implement Default for OsString
This commit is contained in:
@@ -173,6 +173,14 @@ fn deref(&self) -> &OsStr {
|
||||
}
|
||||
}
|
||||
|
||||
#[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 @@ fn test_os_string_reserve_exact() {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user