-
Notifications
You must be signed in to change notification settings - Fork 79
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
prefer From
/TryFrom
to Into
/TryInto
#1254
Comments
In the code you linked, are you thinking of strengthening the constraints, i.e., re-writing the constraints that are currently written with - <C::ClientState as TryFrom<Any>>::Error: Into<ClientError>,
+ <C::ClientState as TryFrom<Any>>::Error: From<ClientError>,
- <C::ConsensusState as TryFrom<Any>>::Error: From<ClientError>,
+ <C::ConsensusState as TryFrom<Any>>::Error: From<ClientError>, If that's not what you mean, I'm not actually sure how to re-write these lines to use ClientError: From<<C::ClientState as TryFrom<Any>>::Error>,
ClientError: From<<C::ConsensusState as TryFrom<Any>>::Error>, |
I want to relax them. Rewriting the
I believe this is alright - at least on latest Rust. (Check my comment at rollkit-ibc and the commit.) I guess, I have to check with the MSRV. |
Feature Summary
Currently, we have some
Into
/TryInto
trait bounds which can be rewritten inFrom
/TryFrom
.ibc-rs/ibc-clients/cw-context/src/context/client_ctx.rs
Lines 21 to 22 in 1ca0371
From
is preferred overInto
, asA: From<B>
impliesB: Into<A>
, but not the other way around.Proposal
Note that,
Into
in super traits may requireSized
.The text was updated successfully, but these errors were encountered: