-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 io::Error::other
#91947
Add io::Error::other
#91947
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
I wonder if we could just add a |
Thought of that, but it wouldn't work because |
@ibraheemdev Oh, you're right; we probably can't support a general In that case, I think this is a fine shortcut to add and experiment with. @bors r+ rollup |
📌 Commit 85f786c has been approved by |
…riplett Add `io::Error::other` This PR adds a small utility constructor, `io::Error::other`, a shorthand for `io::Error::new(io::ErrorKind::Other, err)`, something I find myself writing often. For some concrete stats, a quick search on [grep.app](https://grep.app) shows that more than half of the uses of `io::Error::new` use `ErrorKind::Other`: ``` Error::new\((?:std::)?(?:io::)?ErrorKind:: => 3,898 results Error::new\((?:std::)?(?:io::)?ErrorKind::Other => 2,186 results ```
…riplett Add `io::Error::other` This PR adds a small utility constructor, `io::Error::other`, a shorthand for `io::Error::new(io::ErrorKind::Other, err)`, something I find myself writing often. For some concrete stats, a quick search on [grep.app](https://grep.app) shows that more than half of the uses of `io::Error::new` use `ErrorKind::Other`: ``` Error::new\((?:std::)?(?:io::)?ErrorKind:: => 3,898 results Error::new\((?:std::)?(?:io::)?ErrorKind::Other => 2,186 results ```
…riplett Add `io::Error::other` This PR adds a small utility constructor, `io::Error::other`, a shorthand for `io::Error::new(io::ErrorKind::Other, err)`, something I find myself writing often. For some concrete stats, a quick search on [grep.app](https://grep.app) shows that more than half of the uses of `io::Error::new` use `ErrorKind::Other`: ``` Error::new\((?:std::)?(?:io::)?ErrorKind:: => 3,898 results Error::new\((?:std::)?(?:io::)?ErrorKind::Other => 2,186 results ```
…riplett Add `io::Error::other` This PR adds a small utility constructor, `io::Error::other`, a shorthand for `io::Error::new(io::ErrorKind::Other, err)`, something I find myself writing often. For some concrete stats, a quick search on [grep.app](https://grep.app) shows that more than half of the uses of `io::Error::new` use `ErrorKind::Other`: ``` Error::new\((?:std::)?(?:io::)?ErrorKind:: => 3,898 results Error::new\((?:std::)?(?:io::)?ErrorKind::Other => 2,186 results ```
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91172 (Warn when a `#[test]`-like built-in attribute macro is present multiple times.) - rust-lang#91796 (Fix since attribute for const_manually_drop feature) - rust-lang#91879 (Remove `in_band_lifetimes` from `rustc_borrowck`) - rust-lang#91947 (Add `io::Error::other`) - rust-lang#91967 (Pull in libdevstat on FreeBSD) - rust-lang#91987 (Add module documentation for rustdoc passes) - rust-lang#92001 (Fix default_method_body_is_const when used across crates) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR adds a small utility constructor,
io::Error::other
, a shorthand forio::Error::new(io::ErrorKind::Other, err)
, something I find myself writing often.For some concrete stats, a quick search on grep.app shows that more than half of the uses of
io::Error::new
useErrorKind::Other
: