Implement Default for OsStr
This commit is contained in:
parent
08eaf07dbc
commit
aa5afb0c17
@ -310,6 +310,14 @@ impl OsStr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl PartialEq for OsStr {
|
impl PartialEq for OsStr {
|
||||||
fn eq(&self, other: &OsStr) -> bool {
|
fn eq(&self, other: &OsStr) -> bool {
|
||||||
@ -591,4 +599,10 @@ mod tests {
|
|||||||
os_string.clear();
|
os_string.clear();
|
||||||
assert_eq!(0, os_string.len());
|
assert_eq!(0, os_string.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_os_str_default() {
|
||||||
|
let os_str: &OsStr = Default::default();
|
||||||
|
assert_eq!("", os_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user