diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index bfcf961a50..1e7f4d8780 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -1680,7 +1680,7 @@ mod test { let input = Input { features: OutputFeatures::Plain, - commit: commit, + commit, }; let block_hash = @@ -1696,7 +1696,7 @@ mod test { // different) and check it generates a different short_id let input = Input { features: OutputFeatures::Coinbase, - commit: commit, + commit, }; let short_id = input.short_id(&block_hash, nonce); diff --git a/core/src/libtx/build.rs b/core/src/libtx/build.rs index 1b1037f635..42aaff3f22 100644 --- a/core/src/libtx/build.rs +++ b/core/src/libtx/build.rs @@ -127,7 +127,7 @@ where ( tx.with_output(Output { features: OutputFeatures::Plain, - commit: commit, + commit, proof: rproof, }), kern, diff --git a/core/src/libtx/error.rs b/core/src/libtx/error.rs index 91071eb3df..7ce990834f 100644 --- a/core/src/libtx/error.rs +++ b/core/src/libtx/error.rs @@ -79,7 +79,7 @@ impl From for Error { impl From> for Error { fn from(inner: Context) -> Error { - Error { inner: inner } + Error { inner } } } diff --git a/core/src/libtx/reward.rs b/core/src/libtx/reward.rs index 5765ddc8f7..ee280df334 100644 --- a/core/src/libtx/reward.rs +++ b/core/src/libtx/reward.rs @@ -48,7 +48,7 @@ where let output = Output { features: OutputFeatures::Coinbase, - commit: commit, + commit, proof: rproof, }; @@ -81,7 +81,7 @@ where let proof = TxKernel { features: KernelFeatures::Coinbase, - excess: excess, + excess, excess_sig: sig, }; Ok((output, proof)) diff --git a/util/src/file.rs b/util/src/file.rs index 8ab4647cb3..52b011f66d 100644 --- a/util/src/file.rs +++ b/util/src/file.rs @@ -61,10 +61,10 @@ fn copy_to(src: &Path, src_type: &fs::FileType, dst: &Path) -> io::Result { } else if src_type.is_dir() { copy_dir_to(src, dst) } else { - return Err(io::Error::new( + Err(io::Error::new( io::ErrorKind::Other, format!("Could not copy: {}", src.display()), - )); + )) } } diff --git a/util/src/hex.rs b/util/src/hex.rs index fc5c637157..8a72552908 100644 --- a/util/src/hex.rs +++ b/util/src/hex.rs @@ -49,7 +49,7 @@ pub fn from_hex(hex_str: String) -> Result, num::ParseIntError> { } fn split_n(s: &str, n: usize) -> Vec<&str> { - (0..(s.len() - n + 1) / 2 + 1) + (0..=(s.len() - n + 1) / 2) .map(|i| &s[2 * i..2 * i + n]) .collect() } diff --git a/util/src/logger.rs b/util/src/logger.rs index 322098f1c9..4cc43e0144 100644 --- a/util/src/logger.rs +++ b/util/src/logger.rs @@ -88,14 +88,13 @@ pub fn init_logger(config: Option) { let level_stdout = convert_log_level(&c.stdout_log_level); let level_file = convert_log_level(&c.file_log_level); - let level_minimum; // Determine minimum logging level for Root logger - if level_stdout > level_file { - level_minimum = level_stdout; + let level_minimum = if level_stdout > level_file { + level_stdout } else { - level_minimum = level_file; - } + level_file + }; // Start logger let stdout = ConsoleAppender::builder() diff --git a/util/src/rate_counter.rs b/util/src/rate_counter.rs index dc94d645a4..cd03c151d3 100644 --- a/util/src/rate_counter.rs +++ b/util/src/rate_counter.rs @@ -77,7 +77,7 @@ impl RateCounter { fn truncate(&mut self) { let now_millis = millis_since_epoch(); - while self.last_min_entries.len() > 0 + while !self.last_min_entries.is_empty() && self.last_min_entries[0].timestamp + 60000 < now_millis { self.last_min_entries.remove(0); @@ -106,5 +106,5 @@ fn millis_since_epoch() -> u64 { let since_epoch = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap_or(Duration::new(0, 0)); - since_epoch.as_secs() * 1000 + since_epoch.subsec_millis() as u64 + since_epoch.as_secs() * 1000 + u64::from(since_epoch.subsec_millis()) }