Skip to content

Commit

Permalink
Allow fallible from impls for now and leave todos
Browse files Browse the repository at this point in the history
  • Loading branch information
xla committed Jan 5, 2020
1 parent 85100a3 commit 71f0cd3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tendermint/src/amino_types/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ impl From<PubKeyResponse> for PublicKey {
}
}

// TODO(xla): Either complete implementation or convert to TryFrom.
#[allow(clippy::fallible_impl_from)]

This comment has been minimized.

Copy link
@liamsi

liamsi Jan 6, 2020

Member

This isn't actually used anywhere (only in a test). A viable alternative might be to delete this From impl for now.

This comment has been minimized.

Copy link
@xla

xla Jan 6, 2020

Author Contributor

Can we capture that in an issue.

This comment has been minimized.

Copy link
@liamsi

liamsi Jan 6, 2020

Member

Noted here: #123
They might actually be used in the kms (we should check before deleting any of those).

impl From<PublicKey> for PubKeyResponse {
fn from(public_key: PublicKey) -> Self {
match public_key {
Expand Down
2 changes: 2 additions & 0 deletions tendermint/src/amino_types/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ impl ParseTimestamp for Msg {
}
}

// TODO(xla): Convert to TryFrom.
#[allow(clippy::fallible_impl_from)]
impl From<Time> for Msg {
fn from(ts: Time) -> Self {
// TODO: non-panicking method for getting this?
Expand Down
2 changes: 2 additions & 0 deletions tendermint/src/chain/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ impl Display for Id {
}
}

// TODO(xla): Convert to TryFrom.
#[allow(clippy::fallible_impl_from)]

This comment has been minimized.

Copy link
@liamsi

liamsi Jan 6, 2020

Member

Just noting. Currently, this isn't used anywhere.

impl<'a> From<&'a str> for Id {
fn from(s: &str) -> Self {
Self::from_str(s).unwrap()
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)]
#![allow(clippy::result_unwrap_used)]
#![allow(clippy::implicit_return, clippy::multiple_crate_versions)]
#![deny(clippy::cast_possible_truncation)]
#![deny(clippy::fallible_impl_from)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tendermint/kms/master/img/tendermint.png",
html_root_url = "https://docs.rs/tendermint/0.11.0"
Expand Down
2 changes: 2 additions & 0 deletions tendermint/src/private_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ impl Ed25519Keypair {
}
}

// TODO(xla): Conver to TryFrom.
#[allow(clippy::fallible_impl_from)]
impl<'a> From<&'a Ed25519Keypair> for ed25519::Seed {
fn from(keypair: &'a Ed25519Keypair) -> Self {
Self::from_keypair(&keypair.0[..]).unwrap()
Expand Down
2 changes: 2 additions & 0 deletions tendermint/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ impl From<SystemTime> for Time {
}
}

// TODO(xla): Convert to TryFrom.
#[allow(clippy::fallible_impl_from)]
impl From<Time> for SystemTime {
fn from(t: Time) -> Self {
t.to_system_time().unwrap()
Expand Down

0 comments on commit 71f0cd3

Please sign in to comment.