fix linter issues
This commit is contained in:
parent
50098edc81
commit
98e4e96073
5 changed files with 8 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use log::{info, warn};
|
|||
|
||||
type StaticStyled<'t> = LazyLock<StyledObject<&'t str>>;
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ impl fmt::Display for FileID {
|
|||
/// - `/files/tus/` - literal path segment
|
||||
/// - `(?P<fid>[^/]+)` - capture FID (one or more non-slash chars)
|
||||
/// - `$` - end of string
|
||||
const UPLOAD_URL_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||
static UPLOAD_URL_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||
trace!("compiling UPLOAD_URL_RE");
|
||||
|
||||
Regex::new(r"^([^:/?#]+)://([^/?#]+)/api/v2/alias/upload/[^/]+/files/tus/(?P<fid>[^/]+)$")
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ fn captured(caps: &Captures, name: &str) -> String {
|
|||
/// - `(?P<host>[^/?#]+)` - capture authority/host (anything but `/?#`)
|
||||
/// - `(/.*)?` - maybe trailing slash and some path
|
||||
/// - `$` - end of string
|
||||
const SHARRY_URI_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||
static SHARRY_URI_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||
trace!("compiling SHARRY_URI_RE");
|
||||
|
||||
Regex::new(r"^(?P<scheme>[^:/?#]+)://(?P<host>[^/?#]+)(/.*)?$")
|
||||
|
|
|
|||
Loading…
Reference in a new issue