From 3df0571462952920051998de3979d382b132ae2b Mon Sep 17 00:00:00 2001 From: Afonso Jorge Ramos Date: Fri, 25 Feb 2022 20:03:57 +0000 Subject: [PATCH] fix: clippy for rust `1.59.0` (#162) * fix: clippy for rust `1.59.0` * add 2 new versions of Rust * update build with `actions-rs/toolchain` * bump: `1.3.0` --- .github/workflows/main.yml | 10 ++++++++-- Cargo.lock | 2 +- Cargo.toml | 2 +- src/commands/seek.rs | 6 ++---- src/sources/youtube.rs | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89adedd1..be7c8b79 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,13 +7,19 @@ jobs: name: Build strategy: matrix: - rust-version: ["1.55", "1.56", "1.57"] + rust-version: ["1.54", "stable"] runs-on: ubuntu-latest - container: rust:${{ matrix.rust-version }} steps: - name: Repository Checkout uses: actions/checkout@v2 + - name: Install Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust-version }} + profile: minimal + override: true + - name: Cache uses: Swatinem/rust-cache@v1 diff --git a/Cargo.lock b/Cargo.lock index 18241967..881b8d01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -836,7 +836,7 @@ dependencies = [ [[package]] name = "parrot" -version = "1.2.1" +version = "1.3.0" dependencies = [ "dotenv", "rand 0.8.4", diff --git a/Cargo.toml b/Cargo.toml index 9ec5e000..93751797 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parrot" -version = "1.2.1" +version = "1.3.0" authors = ["aquelemiguel"] edition = "2018" description = "A Discord music bot built in Rust" diff --git a/src/commands/seek.rs b/src/commands/seek.rs index 2550866d..98d7e475 100644 --- a/src/commands/seek.rs +++ b/src/commands/seek.rs @@ -25,12 +25,10 @@ pub async fn seek( let (minutes, seconds) = ( units_iter .next() - .map(|token| token.parse::().ok()) - .flatten(), + .and_then(|token| token.parse::().ok()), units_iter .next() - .map(|token| token.parse::().ok()) - .flatten(), + .and_then(|token| token.parse::().ok()), ); if minutes.is_none() || seconds.is_none() { diff --git a/src/sources/youtube.rs b/src/sources/youtube.rs index 7beff58b..fef9217e 100644 --- a/src/sources/youtube.rs +++ b/src/sources/youtube.rs @@ -174,7 +174,7 @@ async fn _ytdl_metadata(uri: &str) -> SongbirdResult { let end = (&o_vec) .iter() .position(|el| *el == NEWLINE_BYTE) - .unwrap_or_else(|| o_vec.len()); + .unwrap_or(o_vec.len()); let value = serde_json::from_slice(&o_vec[..end]).map_err(|err| SongbirdError::Json { error: err,