Skip to content

Commit

Permalink
clippy::blocks_in_conditions
Browse files Browse the repository at this point in the history
warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
  --> src/cmd/count.rs:60:49
   |
60 |           match conf.indexed().unwrap_or_else(|_| {
   |  _________________________________________________^
61 | |             info!("index is stale");
62 | |             None
63 | |         }) {
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
   = note: `#[warn(clippy::blocks_in_conditions)]` on by default
  • Loading branch information
jqnatividad committed Dec 21, 2023
1 parent 22eceb9 commit 7d7417b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cmd/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let (count, width) = if args.flag_width {
count_input(&conf, args.flag_width)?
} else {
match conf.indexed().unwrap_or_else(|_| {
let index_status = conf.indexed().unwrap_or_else(|_| {
info!("index is stale");
None
}) {
});
match index_status {
Some(idx) => {
info!("index used");
(idx.count(), 0)
Expand Down

0 comments on commit 7d7417b

Please sign in to comment.