-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add wrappers around std::fs::metadata #12636
Conversation
This adds wrappers around std::fs::metadata and std::fs::symlink_metadata which provide better error messages indicating the path that caused the error.
r? @epage (rustbot has picked a reviewer for you, use r? to override) |
Thanks for the incremental enhancments! @bors r+ |
Add wrappers around std::fs::metadata This adds wrappers around `std::fs::metadata` and `std::fs::symlink_metadata` which provide better error messages indicating the path that caused the error. This just helps clean up some duplicated code, and is also going to be used to assist with some code changes in #12634.
☀️ Test successful - checks-actions |
👀 Test was successful, but fast-forwarding failed: 422 Update is not a fast forward |
@bors retry |
☀️ Test successful - checks-actions |
/// Returns metadata for a file (follows symlinks). | ||
/// | ||
/// Equivalent to [`std::fs::metadata`] with better error messages. | ||
pub fn metadata<P: AsRef<Path>>(path: P) -> Result<Metadata> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on using something like fs-err instead?
Update cargo 14 commits in d14c85f4e6e7671673b1a1bc87231ff7164761e1..2fc85d15a542bfb610aff7682073412cf635352f 2023-09-05 22:28:10 +0000 to 2023-09-09 01:49:46 +0000 - feat: Stabilize lints (rust-lang/cargo#12648) - Ues strip_prefix for cleaner code (rust-lang/cargo#12631) - fix: don't print _TOKEN suggestion when not applicable (rust-lang/cargo#12644) - Bump cargo-credential-1password to v0.4.0 (rust-lang/cargo#12641) - refactor: put `Source` trait under `cargo::sources` (rust-lang/cargo#12527) - Error out if `cargo clean --doc` is mixed with `-p`. (rust-lang/cargo#12637) - Add wrappers around std::fs::metadata (rust-lang/cargo#12636) - Add with_stdout_unordered. (rust-lang/cargo#12635) - Fix example for creating a git project test. (rust-lang/cargo#12632) - Read/write the encoded `cargo update --precise` in the same place (rust-lang/cargo#12629) - docs(guide): Apply feedback on CI (rust-lang/cargo#12630) - fix: improve warning for both token & credential-provider (rust-lang/cargo#12626) - Skip clean up `profile.release.package."*"` (rust-lang/cargo#12624) - Add MSRV validation GitHub Action for cargo-credential (rust-lang/cargo#12623)
This adds wrappers around
std::fs::metadata
andstd::fs::symlink_metadata
which provide better error messages indicating the path that caused the error. This just helps clean up some duplicated code, and is also going to be used to assist with some code changes in #12634.