Skip to content

Commit

Permalink
Add is_empty to OsStr, rename path_extras to os_extras, don\'t go thr…
Browse files Browse the repository at this point in the history
…ough the unicode validity checking on Windows
  • Loading branch information
ticki committed Dec 22, 2015
1 parent d26fd3e commit 7db394a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ impl OsStr {
self.to_bytes().and_then(|b| CString::new(b).ok())
}

#[unstable(feature = "os_extras", reason = "recently added")]
pub fn is_empty(&self) -> bool {
self.inner.inner.is_empty()
}

/// Gets the underlying byte representation.
///
/// Note: it is *crucial* that this API is private, to avoid
Expand Down
8 changes: 2 additions & 6 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1873,13 +1873,9 @@ impl Path {
///
/// assert!(!path.is_empty());
/// ```
#[unstable(feature = "path_extras", reason = "recently added", issue = "30259")]
#[unstable(feature = "os_extras", reason = "recently added", issue = "30259")]
pub fn is_empty(&self) -> bool {
if let Some(b) = self.inner.to_bytes() {
b.is_empty()
} else {
true
}
self.inner.is_empty()
}
}

Expand Down

0 comments on commit 7db394a

Please sign in to comment.