-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add io::Error doc examples #35109
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add io::Error doc examples #35109
Conversation
/// print_os_error(&Error::last_os_error()); | ||
/// // Will print "Not an OS error". | ||
/// print_os_error(&Error::new(ErrorKind::Other, "oh no!")); | ||
/// } |
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.
This example is weirdly indirect. Why not just println!("last OS error code: {:?}", Error::last_os_error().raw_os_error())
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.
To show the difference between the two types of error mainly.
@bors: r+ rollup |
📌 Commit fda473f has been approved by |
Add io::Error doc examples Fixes rust-lang#29359. r? @steveklabnik
Add io::Error doc examples Fixes rust-lang#29359. r? @steveklabnik
Add io::Error doc examples Fixes rust-lang#29359. r? @steveklabnik
Add io::Error doc examples Fixes rust-lang#29359. r? @steveklabnik
Rollup of 30 pull requests - Successful merges: #34319, #35041, #35042, #35076, #35109, #35137, #35175, #35181, #35182, #35189, #35239, #35264, #35266, #35281, #35285, #35289, #35291, #35294, #35296, #35297, #35298, #35299, #35318, #35319, #35324, #35326, #35328, #35333, #35359, #35362 - Failed merges:
Fixes #29359.
r? @steveklabnik