From 52ff97cddc3722816f4d4fc5a9c0997a1bb7c487 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sun, 18 Aug 2019 12:26:29 -0400 Subject: [PATCH] Deny unused imports and remove unneeded --- src/blockdata/script.rs | 2 +- src/lib.rs | 2 ++ src/util/amount.rs | 11 ++++------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index b4b2e672..ab688071 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -696,7 +696,7 @@ impl<'de> serde::Deserialize<'de> for Script { where D: serde::Deserializer<'de>, { - use std::fmt::{self, Formatter}; + use std::fmt::Formatter; struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { diff --git a/src/lib.rs b/src/lib.rs index eb39a263..100425fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,8 @@ #![deny(non_camel_case_types)] #![deny(non_snake_case)] #![deny(unused_mut)] +#![deny(dead_code)] +#![deny(unused_imports)] #![deny(missing_docs)] #![forbid(unsafe_code)] diff --git a/src/util/amount.rs b/src/util/amount.rs index 9dbb4e9b..7d3c0f76 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -956,7 +956,7 @@ pub mod serde { //! Serialize and deserialize [Amount] as real numbers denominated in satoshi. //! Use with `#[serde(with = "amount::serde::as_sat")]`. - use serde::{Deserialize, Deserializer, Serialize, Serializer}; + use serde::{Deserializer, Serializer}; use util::amount::serde::SerdeAmount; pub fn serialize(a: &A, s: S) -> Result { @@ -971,7 +971,7 @@ pub mod serde { //! Serialize and deserialize [Optoin] as real numbers denominated in satoshi. //! Use with `#[serde(default, with = "amount::serde::as_sat::opt")]`. - use serde::{Deserialize, Deserializer, Serializer}; + use serde::{Deserializer, Serializer}; use util::amount::serde::SerdeAmount; pub fn serialize( @@ -996,7 +996,7 @@ pub mod serde { //! Serialize and deserialize [Amount] as JSON numbers denominated in BTC. //! Use with `#[serde(with = "amount::serde::as_btc")]`. - use serde::{Deserialize, Deserializer, Serialize, Serializer}; + use serde::{Deserializer, Serializer}; use util::amount::serde::SerdeAmount; pub fn serialize(a: &A, s: S) -> Result { @@ -1011,7 +1011,7 @@ pub mod serde { //! Serialize and deserialize [Option] as JSON numbers denominated in BTC. //! Use with `#[serde(default, with = "amount::serde::as_btc::opt")]`. - use serde::{Deserialize, Deserializer, Serializer}; + use serde::{Deserializer, Serializer}; use util::amount::serde::SerdeAmount; pub fn serialize( @@ -1247,7 +1247,6 @@ mod tests { #[cfg(feature = "serde")] #[test] fn serde_as_sat() { - use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, PartialEq, Debug)] struct T { @@ -1279,7 +1278,6 @@ mod tests { #[cfg(feature = "serde")] #[test] fn serde_as_btc() { - use serde::{Deserialize, Serialize}; use serde_json; #[derive(Serialize, Deserialize, PartialEq, Debug)] @@ -1314,7 +1312,6 @@ mod tests { #[cfg(feature = "serde")] #[test] fn serde_as_btc_opt() { - use serde::{Deserialize, Serialize}; use serde_json; #[derive(Serialize, Deserialize, PartialEq, Debug)]