From 4ac75898c377c433a2cb2698dd09c94dae14540e Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 10 May 2021 13:28:35 +0200 Subject: [PATCH] fix clippy warnings --- src/uu/factor/src/factor.rs | 3 ++- src/uu/ls/src/ls.rs | 4 ++-- src/uu/test/src/parser.rs | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 138254b51..ebe06a1c5 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -163,6 +163,7 @@ pub fn factor(mut n: u64) -> Factors { let (factors, n) = table::factor(n, factors); + #[allow(clippy::let_and_return)] let r = if n < (1 << 32) { _factor::>(n, factors) } else { @@ -280,6 +281,6 @@ impl std::ops::BitXor for Factors { } debug_assert_eq!(r.product(), self.product().pow(rhs.into())); - return r; + r } } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 16f2ce8ff..c5389295b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1413,11 +1413,11 @@ fn get_block_size(md: &Metadata, config: &Config) -> u64 { { // hard-coded for now - enabling setting this remains a TODO let ls_block_size = 1024; - return match config.size_format { + match config.size_format { SizeFormat::Binary => md.blocks() * 512, SizeFormat::Decimal => md.blocks() * 512, SizeFormat::Bytes => md.blocks() * 512 / ls_block_size, - }; + } } #[cfg(not(unix))] diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index f1ca9dad6..2c9c9db30 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -121,6 +121,8 @@ impl Parser { /// Test if the next token in the stream is a BOOLOP (-a or -o), without /// removing the token from the stream. fn peek_is_boolop(&mut self) -> bool { + // TODO: change to `matches!(self.peek(), Symbol::BoolOp(_))` once MSRV is 1.42 + // #[allow(clippy::match_like_matches_macro)] // needs MSRV 1.43 if let Symbol::BoolOp(_) = self.peek() { true } else {