mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Implement Default for OsStr
This commit is contained in:
@@ -310,6 +310,14 @@ fn bytes(&self) -> &[u8] {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.9.0")]
|
||||
impl<'a> Default for &'a OsStr {
|
||||
#[inline]
|
||||
fn default() -> &'a OsStr {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl PartialEq for OsStr {
|
||||
fn eq(&self, other: &OsStr) -> bool {
|
||||
@@ -591,4 +599,10 @@ fn test_os_str_len() {
|
||||
os_string.clear();
|
||||
assert_eq!(0, os_string.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_os_str_default() {
|
||||
let os_str: &OsStr = Default::default();
|
||||
assert_eq!("", os_str);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user