Skip to content

Commit 7db394a

Browse files
committed
Add is_empty to OsStr, rename path_extras to os_extras, don\'t go through the unicode validity checking on Windows
1 parent d26fd3e commit 7db394a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libstd/ffi/os_str.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ impl OsStr {
283283
self.to_bytes().and_then(|b| CString::new(b).ok())
284284
}
285285

286+
#[unstable(feature = "os_extras", reason = "recently added")]
287+
pub fn is_empty(&self) -> bool {
288+
self.inner.inner.is_empty()
289+
}
290+
286291
/// Gets the underlying byte representation.
287292
///
288293
/// Note: it is *crucial* that this API is private, to avoid

src/libstd/path.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,13 +1873,9 @@ impl Path {
18731873
///
18741874
/// assert!(!path.is_empty());
18751875
/// ```
1876-
#[unstable(feature = "path_extras", reason = "recently added", issue = "30259")]
1876+
#[unstable(feature = "os_extras", reason = "recently added", issue = "30259")]
18771877
pub fn is_empty(&self) -> bool {
1878-
if let Some(b) = self.inner.to_bytes() {
1879-
b.is_empty()
1880-
} else {
1881-
true
1882-
}
1878+
self.inner.is_empty()
18831879
}
18841880
}
18851881

0 commit comments

Comments
 (0)