clippy lints enabled for crypto, message, p2p, pbtc, primitives and serialization

This commit is contained in:
debris 2016-11-08 11:51:34 +01:00
parent 23807c65ba
commit 436d925ba6
21 changed files with 186 additions and 35 deletions

72
Cargo.lock generated
View File

@ -5,6 +5,7 @@ dependencies = [
"app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"chain 0.1.0",
"clap 2.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"db 0.1.0",
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"import 0.1.0",
@ -75,6 +76,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "bitcrypto"
version = "0.1.0"
dependencies = [
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"primitives 0.1.0",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -126,6 +128,28 @@ dependencies = [
"yaml-rust 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy"
version = "0.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"clippy_lints 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy_lints"
version = "0.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam"
version = "0.2.10"
@ -301,6 +325,11 @@ name = "log"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "matches"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memchr"
version = "0.1.11"
@ -316,6 +345,7 @@ dependencies = [
"bitcrypto 0.1.0",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"chain 0.1.0",
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"primitives 0.1.0",
"serialization 0.1.0",
]
@ -391,6 +421,11 @@ dependencies = [
"odds 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nom"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ns-dns-tokio"
version = "0.1.0"
@ -435,6 +470,7 @@ version = "0.1.0"
dependencies = [
"abstract-ns 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitcrypto 0.1.0",
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -474,6 +510,7 @@ dependencies = [
name = "primitives"
version = "0.1.0"
dependencies = [
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -483,6 +520,11 @@ name = "quick-error"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "quine-mc_cluskey"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.14"
@ -583,11 +625,20 @@ name = "semver"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "semver"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serialization"
version = "0.1.0"
dependencies = [
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)",
"primitives 0.1.0",
]
@ -694,6 +745,19 @@ dependencies = [
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "toml"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-normalization"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-segmentation"
version = "0.1.2"
@ -778,6 +842,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
"checksum clap 2.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27dac76762fb56019b04aed3ccb43a770a18f80f9c2eb62ee1a18d9fb4ea2430"
"checksum clippy 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "932afd50f572178f12db751606b7922376bdc3a860fc1611ffb06d7498df17cf"
"checksum clippy_lints 0.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "36892e8eb217e2119e7c048ceb031f071cc7d7fffeb992f0d3c6ab6a8a0684b0"
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
"checksum csv 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)" = "266c1815d7ca63a5bd86284043faf91e8c95e943e55ce05dc0ae08e952de18bc"
"checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf"
@ -795,12 +861,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8"
"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
"checksum mio 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "410a1a0ff76f5a226f1e4e3ff1756128e65cd30166e39c3892283e2ac09d5b67"
"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a"
"checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2"
"checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b"
"checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5"
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
"checksum ns-dns-tokio 0.1.0 (git+https://github.com/debris/abstract-ns)" = "<none>"
"checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad"
"checksum odds 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "97b2d7c12734955740d14f7a6723d8dd8ed53cf16770ab38ca6a1aaf3124fc0d"
@ -809,6 +877,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e1435e7a2a00dfebededd6c6bdbd54008001e94b4a2aadd6aef0dc4c56317621"
"checksum parking_lot_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb1b97670a2ffadce7c397fb80a3d687c4f3060140b885621ef1653d0e5d5068"
"checksum quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5"
"checksum rayon 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0783f5880c56f5a308e219ac9309dbe781e064741dd5def4c617c440890305"
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
@ -820,6 +889,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
"checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f"
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410"
@ -829,6 +899,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af"
"checksum tokio-core 0.1.0 (git+https://github.com/debris/tokio-core)" = "<none>"
"checksum toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "0590d72182e50e879c4da3b11c6488dae18fccb1ae0c7a3eda18e16795844796"
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
"checksum unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6722facc10989f63ee0e20a83cd4e1714a9ae11529403ac7e0afd069abc39e"
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"

View File

@ -24,3 +24,11 @@ import = { path = "import" }
[[bin]]
path = "pbtc/main.rs"
name = "pbtc"
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy", "message/dev", "p2p/dev"]

View File

@ -6,3 +6,11 @@ authors = ["debris <marek.kotewicz@gmail.com>"]
[dependencies]
rust-crypto = "0.2.36"
primitives = { path = "../primitives" }
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy", "primitives/dev"]

View File

@ -1,3 +1,6 @@
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate crypto as rcrypto;
extern crate primitives;
@ -12,8 +15,8 @@ pub struct DHash160 {
ripemd: Ripemd160,
}
impl DHash160 {
pub fn new() -> Self {
impl Default for DHash160 {
fn default() -> Self {
DHash160 {
sha256: Sha256::new(),
ripemd: Ripemd160::new(),
@ -21,6 +24,12 @@ impl DHash160 {
}
}
impl DHash160 {
pub fn new() -> Self {
DHash160::default()
}
}
impl Digest for DHash160 {
fn input(&mut self, d: &[u8]) {
self.sha256.input(d)
@ -51,14 +60,20 @@ pub struct DHash256 {
hasher: Sha256,
}
impl DHash256 {
pub fn new() -> Self {
impl Default for DHash256 {
fn default() -> Self {
DHash256 {
hasher: Sha256::new(),
}
}
}
impl DHash256 {
pub fn new() -> Self {
DHash256::default()
}
}
impl Digest for DHash256 {
fn input(&mut self, d: &[u8]) {
self.hasher.input(d)

View File

@ -11,3 +11,10 @@ chain = { path = "../chain" }
primitives = { path = "../primitives" }
serialization = { path = "../serialization" }
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy", "primitives/dev", "serialization/dev"]

View File

@ -33,6 +33,10 @@ impl Command {
self.0.len() - trailing_zeros
}
pub fn is_empty(&self) -> bool {
self.0.is_zero()
}
fn as_string(&self) -> String {
String::from_utf8_lossy(&self.0[..self.len()]).to_ascii_lowercase()
}

View File

@ -1,3 +1,6 @@
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate byteorder;
extern crate bitcrypto as crypto;
extern crate chain;

View File

@ -65,16 +65,16 @@ impl Payload for Version {
impl Version {
pub fn version(&self) -> u32 {
match *self {
Version::V0(ref s) => s.version,
Version::V106(ref s, _) => s.version,
Version::V0(ref s) |
Version::V106(ref s, _) |
Version::V70001(ref s, _, _) => s.version,
}
}
pub fn services(&self) -> Services {
match *self {
Version::V0(ref s) => s.services,
Version::V106(ref s, _) => s.services,
Version::V0(ref s) |
Version::V106(ref s, _) |
Version::V70001(ref s, _, _) => s.services,
}
}

View File

@ -19,3 +19,11 @@ primitives = { path = "../primitives"}
bitcrypto = { path = "../crypto" }
message = { path = "../message" }
serialization = { path = "../serialization"}
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy", "primitives/dev", "message/dev", "bitcrypto/dev"]

View File

@ -1,3 +1,6 @@
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#[macro_use]
extern crate futures;
extern crate futures_cpupool;

View File

@ -107,7 +107,7 @@ impl Context {
let peers = context.node_table.read().nodes_with_services(&Services::default(), max);
let addresses = peers.into_iter()
.map(|peer| peer.address())
.filter(|address| !used_addresses.contains(&address))
.filter(|address| !used_addresses.contains(address))
.take(needed)
.collect::<Vec<_>>();
@ -396,12 +396,12 @@ impl P2P {
}
pub fn run(&self) -> Result<(), Box<error::Error>> {
for peer in self.config.peers.iter() {
for peer in &self.config.peers {
self.connect::<NormalSessionFactory>(*peer);
}
let resolver = try!(DnsResolver::system_config(&self.event_loop_handle));
for seed in self.config.seeds.iter() {
for seed in &self.config.seeds {
self.connect_to_seednode(&resolver, seed);
}

View File

@ -129,7 +129,7 @@ impl Ord for Node {
let self_port = self_addr.port();
let other_port = other_addr.port();
if self_port == other_port {
self_addr.ip().cmp(&other_addr.ip())
self_addr.ip().cmp(other_addr.ip())
}
else {
self_port.cmp(&other_port)
@ -143,7 +143,7 @@ impl Ord for Node {
let self_port = self_addr.port();
let other_port = other_addr.port();
if self_port == other_port {
self_addr.ip().cmp(&other_addr.ip())
self_addr.ip().cmp(other_addr.ip())
}
else {
self_port.cmp(&other_port)
@ -175,14 +175,13 @@ pub struct NodeTable<T = RealTime> where T: Time {
impl NodeTable {
/// Opens a file loads node_table from it.
pub fn from_file<P>(path: P) -> Result<Self, io::Error> where P: AsRef<path::Path> {
let res = fs::OpenOptions::new()
fs::OpenOptions::new()
.create(true)
.read(true)
// without opening for write, mac os returns os error 22
.write(true)
.open(path)
.and_then(Self::load);
res
.and_then(Self::load)
}
/// Saves node table to file

View File

@ -27,7 +27,7 @@ pub fn import(cfg: Config, matches: &ArgMatches) -> Result<(), String> {
Err(Error::OutOfOrderBlock) => {
skipped += 1;
},
Err(_) => return Err(format!("Cannot append block")),
Err(_) => return Err("Cannot append block".into()),
}
}

View File

@ -1,5 +1,8 @@
//! Parity bitcoin client.
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#[macro_use]
extern crate clap;
#[macro_use]
@ -26,9 +29,8 @@ pub const APP_INFO: AppInfo = AppInfo { name: "pbtc", author: "Parity" };
fn main() {
env_logger::init().unwrap();
match run() {
Err(err) => println!("{}", err),
Ok(_) => (),
if let Err(err) = run() {
println!("{}", err);
}
}

View File

@ -6,14 +6,11 @@ use {db, APP_INFO};
use config::Config;
pub fn open_db(cfg: &Config) -> Arc<db::Store> {
match cfg.use_disk_database {
true => {
let db_path = app_dir(AppDataType::UserData, &APP_INFO, "db").expect("Failed to get app dir");
Arc::new(db::Storage::new(db_path).expect("Failed to open database"))
},
false => {
Arc::new(db::TestStorage::default())
}
if cfg.use_disk_database {
let db_path = app_dir(AppDataType::UserData, &APP_INFO, "db").expect("Failed to get app dir");
Arc::new(db::Storage::new(db_path).expect("Failed to open database"))
} else {
Arc::new(db::TestStorage::default())
}
}

View File

@ -6,3 +6,11 @@ authors = ["debris <marek.kotewicz@gmail.com>"]
[dependencies]
heapsize = "0.3"
rustc-serialize = "0.3"
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy"]

View File

@ -1,3 +1,6 @@
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate rustc_serialize;
#[macro_use] extern crate heapsize;

View File

@ -6,3 +6,11 @@ authors = ["debris <marek.kotewicz@gmail.com>"]
[dependencies]
byteorder = "0.5"
primitives = { path = "../primitives" }
[dependencies.clippy]
optional = true
version = "0.0.97"
[features]
default = []
dev = ["clippy", "primitives/dev"]

View File

@ -201,7 +201,7 @@ impl Serializable for Bytes {
fn serialize(&self, stream: &mut Stream) {
stream
.append(&CompactInteger::from(self.len()))
.append_slice(&self);
.append_slice(self);
}
#[inline]

View File

@ -1,3 +1,6 @@
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate byteorder;
extern crate primitives;

View File

@ -5,9 +5,10 @@ pub fn deserialize<R, T>(buffer: R) -> Result<T, Error> where R: io::Read, T: De
let mut reader = Reader::from_read(buffer);
let result = try!(reader.read());
match reader.is_finished() {
false => Err(Error::UnreadData),
true => Ok(result),
if reader.is_finished() {
Ok(result)
} else {
Err(Error::UnreadData)
}
}
@ -113,6 +114,7 @@ impl<R> Reader<R> where R: io::Read {
Ok(result)
}
#[cfg_attr(feature="clippy", allow(wrong_self_convention))]
pub fn is_finished(&mut self) -> bool {
if self.peeked.is_some() {
return false;
@ -139,9 +141,10 @@ impl<R, T> Iterator for ReadIterator<R, T> where R: io::Read, T: Deserializable
type Item = Result<T, Error>;
fn next(&mut self) -> Option<Self::Item> {
match self.reader.is_finished() {
true => None,
false => Some(self.reader.read())
if self.reader.is_finished() {
None
} else {
Some(self.reader.read())
}
}
}