-
Notifications
You must be signed in to change notification settings - Fork 86
add GlobError::into_error so that errors can be easily converted #66
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
#![deny(missing_docs)] | ||
#![cfg_attr(all(test, windows), feature(std_misc))] | ||
|
||
#[allow(unused_imports)] | ||
use std::ascii::AsciiExt; | ||
use std::cmp; | ||
use std::fmt; | ||
|
@@ -279,12 +280,18 @@ impl GlobError { | |
pub fn error(&self) -> &io::Error { | ||
&self.error | ||
} | ||
|
||
/// Consumes self, returning the _raw_ underlying `io::Error` | ||
pub fn into_error(self) -> io::Error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems a bit weird to have a Alternativly, if its clear in the API that this just wraps an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed that there is precedent with the |
||
self.error | ||
} | ||
} | ||
|
||
impl Error for GlobError { | ||
fn description(&self) -> &str { | ||
self.error.description() | ||
} | ||
|
||
fn cause(&self) -> Option<&Error> { | ||
Some(&self.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.
I thought I would throw this in as well.
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.
What imports cause these warning?
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.
it only affects the next statement, so
use std::ascii::AsciiExt
. This was introduced in recent rust versionsThere 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.
Ah, yeah that makes sense then. :)