From f9d31e997a02d7855b7e6fba9f3bae4aa8d40545 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 21 Jan 2025 12:21:37 +0000 Subject: [PATCH 1/5] ci: Bump rust toolchain to 1.83 Matching Debian testing --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e01461f..706f1b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.70 + - uses: dtolnay/rust-toolchain@master # avoid the tag here to prevent dependabot from updating it + with: + toolchain: "1.83" - run: cargo check --all-targets --all-features fmt: @@ -24,8 +26,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.70 + - uses: dtolnay/rust-toolchain@master # avoid the tag here to prevent dependabot from updating it with: + toolchain: "1.83" components: rustfmt - run: cargo fmt --all --check @@ -34,7 +37,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.70 + - uses: dtolnay/rust-toolchain@master # avoid the tag here to prevent dependabot from updating it + with: + toolchain: "1.83" - run: cargo test --all-targets --all-features clippy: @@ -42,8 +47,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.70 + - uses: dtolnay/rust-toolchain@master # avoid the tag here to prevent dependabot from updating it with: + toolchain: "1.83" components: clippy - run: cargo clippy --all-targets --all-features -- -D warnings From 5437c3db6b07f9035122fdc755a737aa62576170 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 21 Jan 2025 12:48:23 +0000 Subject: [PATCH 2/5] Elide lifetimes identified by clippy --- src/dsc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dsc.rs b/src/dsc.rs index 3a24782..177db13 100644 --- a/src/dsc.rs +++ b/src/dsc.rs @@ -18,7 +18,7 @@ impl<'de> Deserialize<'de> for FileEntry { { struct FileEntryVisitor; - impl<'de> Visitor<'de> for FileEntryVisitor { + impl Visitor<'_> for FileEntryVisitor { type Value = FileEntry; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { From 8b56d5c3c1fc8de57c7318c8cadd0e792fb35700 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 21 Jan 2025 13:09:40 +0000 Subject: [PATCH 3/5] Tag unused size field of FileEntry --- src/dsc.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dsc.rs b/src/dsc.rs index 177db13..cc8f9ad 100644 --- a/src/dsc.rs +++ b/src/dsc.rs @@ -7,6 +7,7 @@ use std::marker::PhantomData; #[derive(Debug)] pub struct FileEntry { pub hash: String, + #[allow(dead_code)] pub size: usize, pub filename: String, } From da52a31973b940a2bfb6d768dc084d15f5d195ff Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 21 Jan 2025 13:17:07 +0000 Subject: [PATCH 4/5] Remove unused timeline in ObsDscUploader::prepare --- src/upload.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/upload.rs b/src/upload.rs index 8df6f1b..caf6ed8 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -72,7 +72,7 @@ pub struct ObsDscUploader { } impl ObsDscUploader { - pub async fn prepare<'a>( + pub async fn prepare( client: obs::Client, mut project: String, branch_to: Option, From dcb6731309f7ee854f45b8e73b8935084d966497 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Tue, 21 Jan 2025 13:35:31 +0000 Subject: [PATCH 5/5] Replace use of `.map_or(false, _)` with `.is_some_and(_)` As suggested by clippy --- src/retry.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/retry.rs b/src/retry.rs index 8e47322..8112750 100644 --- a/src/retry.rs +++ b/src/retry.rs @@ -12,10 +12,10 @@ const INITIAL_INTERVAL: Duration = Duration::from_millis(300); fn is_client_error(err: &(dyn std::error::Error + 'static)) -> bool { err.downcast_ref::() .and_then(|e| e.status()) - .map_or(false, |status| status.is_client_error()) + .is_some_and(|status| status.is_client_error()) || err .downcast_ref::() - .map_or(false, |err| matches!(err, obs::Error::ApiError(_))) + .is_some_and(|err| matches!(err, obs::Error::ApiError(_))) } fn is_caused_by_client_error(report: &Report) -> bool { @@ -26,8 +26,7 @@ fn is_caused_by_client_error(report: &Report) -> bool { // source()), so we need to examine that error directly. || err .downcast_ref::() - .and_then(|err| err.get_ref()) - .map_or(false, |err| is_client_error(err)) + .and_then(|err| err.get_ref()).is_some_and(|err| is_client_error(err)) }) }