diff --git a/Cargo.toml b/Cargo.toml index 6d04c87a4d..50540eb219 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,9 +10,6 @@ description = "General purpose library for using and interoperating with Bitcoin keywords = [ "crypto", "bitcoin" ] readme = "README.md" -[lib] -name = "bitcoin" -path = "src/lib.rs" [features] fuzztarget = ["secp256k1/fuzztarget", "bitcoin_hashes/fuzztarget"] diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index 56c3c6b51c..0df4b49080 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -142,7 +142,7 @@ impl error::Error for ParseOutPointError { /// It does not permit leading zeroes or non-digit characters. fn parse_vout(s: &str) -> Result { if s.len() > 1 { - let first = s.chars().nth(0).unwrap(); + let first = s.chars().next().unwrap(); if first == '0' || first == '+' { return Err(ParseOutPointError::VoutNotCanonical); } diff --git a/src/hash_types.rs b/src/hash_types.rs index fea1166aa9..3027008f23 100644 --- a/src/hash_types.rs +++ b/src/hash_types.rs @@ -16,10 +16,7 @@ //! to avoid mixing data of the same hash format (like SHA256d) but of different meaning //! (transaction id, block hash etc). -use consensus::encode::{Encodable, Decodable, Error}; -use hashes::{Hash, sha256, sha256d, ripemd160, hash160}; -use hashes::hex::{FromHex, ToHex}; -use util::key::PublicKey; +use hashes::{Hash, sha256, sha256d, hash160}; macro_rules! impl_hashencode { ($hashtype:ident) => { diff --git a/src/lib.rs b/src/lib.rs index 4804f69774..c36aa8543f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,17 +23,9 @@ //! software. //! -#![crate_name = "bitcoin"] -#![crate_type = "dylib"] -#![crate_type = "rlib"] - // Experimental features we need #![cfg_attr(all(test, feature = "unstable"), feature(test))] -// Clippy whitelist -#![cfg_attr(feature = "clippy", allow(needless_range_loop))] // suggests making a big mess of array newtypes -#![cfg_attr(feature = "clippy", allow(extend_from_slice))] // `extend_from_slice` only available since 1.6 - // Coding conventions #![forbid(unsafe_code)] #![deny(non_upper_case_globals)] @@ -44,23 +36,17 @@ #![deny(unused_imports)] #![deny(missing_docs)] -// In general, rust is absolutely horrid at supporting users doing things like, -// for example, compiling Rust code for real environments. Disable useless lints -// that don't do anything but annoy us and cant actually ever be resolved. -#![allow(bare_trait_objects)] -#![allow(ellipsis_inclusive_range_patterns)] - // Re-exported dependencies. #[macro_use] pub extern crate bitcoin_hashes as hashes; pub extern crate secp256k1; pub extern crate bech32; +#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus; #[cfg(feature = "serde")] extern crate serde; #[cfg(all(test, feature = "serde"))] #[macro_use] extern crate serde_derive; // for 1.22.0 compat #[cfg(all(test, feature = "serde"))] extern crate serde_json; #[cfg(all(test, feature = "serde"))] extern crate serde_test; #[cfg(all(test, feature = "unstable"))] extern crate test; -#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus; #[cfg(target_pointer_width = "16")] compile_error!("rust-bitcoin cannot be used on 16-bit architectures"); @@ -75,8 +61,6 @@ pub mod network; pub mod blockdata; pub mod util; pub mod consensus; -// Do not remove: required in order to get hash types implementation macros to work correctly -#[allow(unused_imports)] pub mod hash_types; pub use hash_types::*; diff --git a/src/util/hash.rs b/src/util/hash.rs index fa089135a0..f0020ce139 100644 --- a/src/util/hash.rs +++ b/src/util/hash.rs @@ -60,7 +60,7 @@ pub fn bitcoin_merkle_root(mut iter: I) -> T return Default::default(); } if iter.len() == 1 { - return T::from_inner(iter.nth(0).unwrap().into_inner()); + return T::from_inner(iter.next().unwrap().into_inner()); } // Recursion let half_len = iter.len() / 2 + iter.len() % 2; diff --git a/src/util/merkleblock.rs b/src/util/merkleblock.rs index 9c241ca46f..f4edaeb0cf 100644 --- a/src/util/merkleblock.rs +++ b/src/util/merkleblock.rs @@ -445,7 +445,7 @@ impl MerkleBlock { match_txids: &HashSet, ) -> Self { let matches: Vec = block_txids - .into_iter() + .iter() .map(|txid| match_txids.contains(txid)) .collect();