From 98e4e960735b24f5b835892c9f5a56618da1f336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sun, 13 Jul 2025 16:23:22 +0000 Subject: [PATCH] fix linter issues --- src/file/checked.rs | 1 + src/file/uploading.rs | 7 ++++--- src/output.rs | 2 +- src/sharry/ids.rs | 2 +- src/sharry/uri.rs | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/file/checked.rs b/src/file/checked.rs index 2af7f73..94798ec 100644 --- a/src/file/checked.rs +++ b/src/file/checked.rs @@ -15,6 +15,7 @@ use super::{FileTrait, Uploading}; /// - impl `serde` for cachefile handling /// - impl `PartialEq..Ord` to handle multiple files given /// - impl `AsRef<[u8]>` for hashing with `blake2b_simd` +#[allow(clippy::unsafe_derive_deserialize)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct Checked { /// canonical path to a regular file diff --git a/src/file/uploading.rs b/src/file/uploading.rs index 14eba21..b15478c 100644 --- a/src/file/uploading.rs +++ b/src/file/uploading.rs @@ -14,6 +14,7 @@ use super::{Checked, Chunk, FileTrait}; /// Description of a `file::Checked` that is actively being uploaded /// /// - impl `serde` for cachefile handling +#[allow(clippy::unsafe_derive_deserialize)] #[derive(Serialize, Deserialize, Debug)] pub struct Uploading { /// canonical path to a regular file @@ -217,7 +218,7 @@ mod tests { } else { assert!(eof.is_err()); assert_eq!(eof.unwrap_err(), path); - }; + } } } @@ -227,7 +228,7 @@ mod tests { let (mut upl, _share_id, _file) = create_uploading(content); // use oversized buffer - let mut buf = vec![0; (size + extra) as usize]; + let mut buf = vec![0; usize::try_from(size + extra).unwrap()]; let chunk_res = upl.read(&mut buf); if size > 0 { @@ -241,7 +242,7 @@ mod tests { assert_eq!(chunk.get_data(), content); } else { assert!(chunk_res.is_err()); - }; + } } } diff --git a/src/output.rs b/src/output.rs index f7f3598..ddc9bf2 100644 --- a/src/output.rs +++ b/src/output.rs @@ -7,7 +7,7 @@ use log::{info, warn}; type StaticStyled<'t> = LazyLock>; -pub const SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold()); +pub static SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold()); #[must_use] pub fn prompt_continue() -> bool { diff --git a/src/sharry/ids.rs b/src/sharry/ids.rs index d942da4..0aa8ef3 100644 --- a/src/sharry/ids.rs +++ b/src/sharry/ids.rs @@ -79,7 +79,7 @@ impl fmt::Display for FileID { /// - `/files/tus/` - literal path segment /// - `(?P[^/]+)` - capture FID (one or more non-slash chars) /// - `$` - end of string -const UPLOAD_URL_RE: LazyLock = LazyLock::new(|| { +static UPLOAD_URL_RE: LazyLock = LazyLock::new(|| { trace!("compiling UPLOAD_URL_RE"); Regex::new(r"^([^:/?#]+)://([^/?#]+)/api/v2/alias/upload/[^/]+/files/tus/(?P[^/]+)$") diff --git a/src/sharry/uri.rs b/src/sharry/uri.rs index 0f67907..24616ca 100644 --- a/src/sharry/uri.rs +++ b/src/sharry/uri.rs @@ -38,7 +38,7 @@ fn captured(caps: &Captures, name: &str) -> String { /// - `(?P[^/?#]+)` - capture authority/host (anything but `/?#`) /// - `(/.*)?` - maybe trailing slash and some path /// - `$` - end of string -const SHARRY_URI_RE: LazyLock = LazyLock::new(|| { +static SHARRY_URI_RE: LazyLock = LazyLock::new(|| { trace!("compiling SHARRY_URI_RE"); Regex::new(r"^(?P[^:/?#]+)://(?P[^/?#]+)(/.*)?$")