Skip to content

Path::is_empty #39334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

clarfonthey
Copy link
Contributor

@clarfonthey clarfonthey commented Jan 27, 2017

While an empty path may not necessarily have semantic significance, because PathBuf::new returns an empty path, I feel that having this method is reasonable.

I left out len because it could easily be confused for the number of components in the path. However, is_empty seems useful and unambiguous.

@rust-highfive
Copy link
Contributor

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

/// use std::path::Path;
///
/// let path = Path::new("");
/// assert!(path.is_empty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ; to the end of the line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reason why it failed.

/// assert!(path.is_empty())
///
/// let path = Path::new("tmp");
/// assert!(!path.is_empty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ; to the end of the line.

@Kimundi Kimundi added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 27, 2017
@frewsxcv
Copy link
Member

This was attempted before, for the record: #31877

@clarfonthey
Copy link
Contributor Author

@frewsxcv Noted. I'll just close this, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants