From 8bd052b9869de1853c1251a28887d2213211a5b2 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sat, 20 Feb 2016 11:54:12 +0100 Subject: [PATCH 1/2] Fixed warnings --- ethcore/res/ethereum/tests | 2 +- ethcore/src/blockchain.rs | 2 +- ethcore/src/evm/tests.rs | 2 +- util/src/hash.rs | 2 +- util/src/panics.rs | 10 +--------- util/src/uint.rs | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/ethcore/res/ethereum/tests b/ethcore/res/ethereum/tests index 3116f85a499..f32954b3ddb 160000 --- a/ethcore/res/ethereum/tests +++ b/ethcore/res/ethereum/tests @@ -1 +1 @@ -Subproject commit 3116f85a499ceaf4dfdc46726060fc056e2d7829 +Subproject commit f32954b3ddb5af2dc3dc9ec6d9a28bee848fdf70 diff --git a/ethcore/src/blockchain.rs b/ethcore/src/blockchain.rs index 9240ff80075..2e9a867c4b5 100644 --- a/ethcore/src/blockchain.rs +++ b/ethcore/src/blockchain.rs @@ -696,7 +696,7 @@ mod tests { } #[test] - #[allow(cyclomatic_complexity)] + #[cfg_attr(feature="dev", allow(cyclomatic_complexity))] fn test_small_fork() { let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a059262c330941f3fe2a34d16d6e3c7b30d2ceb37c6a0e9a994c494ee1a61d2410885aa4c8bf8e56e264c0c0".from_hex().unwrap(); let b1 = "f90261f901f9a05716670833ec874362d65fea27a7cd35af5897d275b31a44944113111e4e96d2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a0e78628dd45a1f8dc495594d83b76c588a3ee67463260f8b7d4a42f574aeab29aa0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882520884562791e580a051b3ecba4e3f2b49c11d42dd0851ec514b1be3138080f72a2b6e83868275d98f8877671f479c414b47f862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca09e2709d7ec9bbe6b1bbbf0b2088828d14cd5e8642a1fee22dc74bfa89761a7f9a04bd8813dee4be989accdb708b1c2e325a7e9c695a8024e30e89d6c644e424747c0".from_hex().unwrap(); diff --git a/ethcore/src/evm/tests.rs b/ethcore/src/evm/tests.rs index 02f9291922b..9d4dd3bc423 100644 --- a/ethcore/src/evm/tests.rs +++ b/ethcore/src/evm/tests.rs @@ -25,7 +25,7 @@ struct FakeLogEntry { } #[derive(PartialEq, Eq, Hash, Debug)] -#[allow(enum_variant_names)] // Common prefix is C ;) +#[cfg_attr(feature="dev", allow(enum_variant_names))] // Common prefix is C ;) enum FakeCallType { CALL, CREATE } diff --git a/util/src/hash.rs b/util/src/hash.rs index d436c2d81ee..71c690ef6dc 100644 --- a/util/src/hash.rs +++ b/util/src/hash.rs @@ -635,7 +635,7 @@ mod tests { use std::str::FromStr; #[test] - #[allow(eq_op)] + #[cfg_attr(feature="dev", allow(eq_op))] fn hash() { let h = H64([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]); assert_eq!(H64::from_str("0123456789abcdef").unwrap(), h); diff --git a/util/src/panics.rs b/util/src/panics.rs index 18ed9ecb1fe..60d85ef146e 100644 --- a/util/src/panics.rs +++ b/util/src/panics.rs @@ -18,7 +18,6 @@ use std::thread; use std::ops::DerefMut; -use std::any::Any; use std::sync::{Arc, Mutex}; /// Thread-safe closure for handling possible panics @@ -75,7 +74,7 @@ impl PanicHandler { #[cfg_attr(feature="dev", allow(deprecated))] // TODO [todr] catch_panic is deprecated but panic::recover has different bounds (not allowing mutex) pub fn catch_panic(&self, g: G) -> thread::Result where G: FnOnce() -> R + Send + 'static { - let guard = PanicGuard { handler: self }; + let _guard = PanicGuard { handler: self }; let result = g(); Ok(result) } @@ -108,13 +107,6 @@ impl OnPanicListener for F } } -fn convert_to_string(t: &Box) -> Option { - let as_str = t.downcast_ref::<&'static str>().cloned().map(|t| t.to_owned()); - let as_string = t.downcast_ref::().cloned(); - - as_str.or(as_string) -} - #[test] #[ignore] // panic forwarding doesnt work on the same thread in beta fn should_notify_listeners_about_panic () { diff --git a/util/src/uint.rs b/util/src/uint.rs index 912088fb972..7206a521ead 100644 --- a/util/src/uint.rs +++ b/util/src/uint.rs @@ -991,7 +991,7 @@ mod tests { } #[test] - #[allow(eq_op)] + #[cfg_attr(feature="dev", allow(eq_op))] pub fn uint256_comp_test() { let small = U256([10u64, 0, 0, 0]); let big = U256([0x8C8C3EE70C644118u64, 0x0209E7378231E632, 0, 0]); From 7bc2853de96b672a64b5f56e405ded1c8e375830 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sat, 20 Feb 2016 15:14:54 +0100 Subject: [PATCH 2/2] Removed TODO --- util/src/panics.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/util/src/panics.rs b/util/src/panics.rs index 60d85ef146e..05d266b8bbc 100644 --- a/util/src/panics.rs +++ b/util/src/panics.rs @@ -72,7 +72,6 @@ impl PanicHandler { /// Invoke closure and catch any possible panics. /// In case of panic notifies all listeners about it. #[cfg_attr(feature="dev", allow(deprecated))] - // TODO [todr] catch_panic is deprecated but panic::recover has different bounds (not allowing mutex) pub fn catch_panic(&self, g: G) -> thread::Result where G: FnOnce() -> R + Send + 'static { let _guard = PanicGuard { handler: self }; let result = g();