We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08eaf07 commit aa5afb0Copy full SHA for aa5afb0
src/libstd/ffi/os_str.rs
@@ -310,6 +310,14 @@ impl OsStr {
310
}
311
312
313
+#[stable(feature = "rust1", since = "1.9.0")]
314
+impl<'a> Default for &'a OsStr {
315
+ #[inline]
316
+ fn default() -> &'a OsStr {
317
+ ""
318
+ }
319
+}
320
+
321
#[stable(feature = "rust1", since = "1.0.0")]
322
impl PartialEq for OsStr {
323
fn eq(&self, other: &OsStr) -> bool {
@@ -591,4 +599,10 @@ mod tests {
591
599
os_string.clear();
592
600
assert_eq!(0, os_string.len());
593
601
602
603
+ #[test]
604
+ fn test_os_str_default() {
605
+ let os_str: &OsStr = Default::default();
606
+ assert_eq!("", os_str);
607
594
608
0 commit comments