Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#![deny(missing_docs)]
#![cfg_attr(all(test, windows), feature(std_misc))]

#[allow(unused_imports)]
Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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 versions

Copy link
Contributor

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. :)

use std::ascii::AsciiExt;
use std::cmp;
use std::fmt;
Expand Down Expand Up @@ -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 {
Copy link
Contributor

@Kimundi Kimundi Feb 20, 2018

Choose a reason for hiding this comment

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

It seems a bit weird to have a into_error() method on a type that already is a Error - maybe something like into_io_error() to be more explicit?

Alternativly, if its clear in the API that this just wraps an io::Error, into_inner() might also be appropiate to follow the std conventions about wrapper types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with into_error() because the method directly above it (which returns io::Error) is called just error(). I do agree that I like into_io_error better, but should I also create an io_error() method and deprecate error()?

Copy link
Contributor

@Kimundi Kimundi Feb 21, 2018

Choose a reason for hiding this comment

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

I missed that there is precedent with the error() method. I guess then the name into_error() is the consistent choice.

self.error
}
}

impl Error for GlobError {
fn description(&self) -> &str {
self.error.description()
}

fn cause(&self) -> Option<&Error> {
Some(&self.error)
}
Expand Down