Skip to content
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

Use TryInto instead of custom type #7542

Merged
merged 2 commits into from Apr 29, 2019

Conversation

Projects
None yet
2 participants
@illicitonion
Copy link
Contributor

commented Apr 12, 2019

No description provided.

@stuhood
Copy link
Member

left a comment

There is another one!

// TODO: These traits exist in the stdlib, but are marked unstable.
// see https://github.com/rust-lang/rust/issues/33417
pub trait TryFrom<T>: Sized {
type Err;
fn try_from(t: T) -> Result<Self, Self::Err>;
}
pub trait TryInto<T>: Sized {
type Err;
fn try_into(self) -> Result<T, Self::Err>;
}
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,
{
type Err = U::Err;
fn try_into(self) -> Result<U, U::Err> {
U::try_from(self)
}
}

@illicitonion illicitonion force-pushed the twitter:dwagnerhall/tryinto branch from 29d24a3 to 9edfc7c Apr 26, 2019

@illicitonion illicitonion merged commit def541f into pantsbuild:master Apr 29, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@illicitonion illicitonion deleted the twitter:dwagnerhall/tryinto branch Apr 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.