From eaf63bcc69dfbe576053f0744824ece4045b7ffa Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Fri, 2 Oct 2020 02:14:48 +0530 Subject: [PATCH] Fix clippy lints --- .github/workflows/cargo-clippy.yml | 2 +- .github/workflows/cargo-test.yml | 3 +++ src/subcommand/query.rs | 7 ++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml index fe4a1bd..9717ef4 100644 --- a/.github/workflows/cargo-clippy.yml +++ b/.github/workflows/cargo-clippy.yml @@ -17,5 +17,5 @@ jobs: components: clippy - uses: actions-rs/clippy-check@v1 with: - args: --workspace --all-targets --all-features -- -D clippy::all + args: --workspace --all-targets --all-features -- -D warnings -D clippy::all token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index 2ee0af9..4ae67fd 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -8,6 +8,9 @@ jobs: test: runs-on: ubuntu-latest steps: + - run: sudo apt update + - run: sudo apt install bash dash fish shellcheck xonsh zsh + - run: sudo snap install powershell --classic - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: diff --git a/src/subcommand/query.rs b/src/subcommand/query.rs index 5fb7a79..e4d10bd 100644 --- a/src/subcommand/query.rs +++ b/src/subcommand/query.rs @@ -84,9 +84,8 @@ impl Query { let now = util::get_current_time()?; let mut fzf = Fzf::new()?; - let mut matches = db.matches(now, &self.keywords); - while let Some(dir) = matches.next() { + for dir in db.matches(now, &self.keywords) { fzf.write(format!("{}", dir.display_score(now)))?; } @@ -111,12 +110,10 @@ impl Query { let mut db = util::get_db()?; let now = util::get_current_time()?; - let mut matches = db.matches(now, &self.keywords); - let stdout = io::stdout(); let mut handle = stdout.lock(); - while let Some(dir) = matches.next() { + for dir in db.matches(now, &self.keywords) { if self.score { writeln!(handle, "{}", dir.display_score(now)) } else {