clippy fix
This commit is contained in:
parent
d1d7b55585
commit
9000c8a46b
5 changed files with 13 additions and 8 deletions
|
|
@ -41,6 +41,7 @@ impl AppState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn try_resume(args: &Cli) -> Option<Self> {
|
pub fn try_resume(args: &Cli) -> Option<Self> {
|
||||||
let inner = CacheFile::try_resume(args)
|
let inner = CacheFile::try_resume(args)
|
||||||
.inspect_err(|e| debug!("could not resume from hash {:?}: {e}", args.get_hash()))
|
.inspect_err(|e| debug!("could not resume from hash {:?}: {e}", args.get_hash()))
|
||||||
|
|
@ -138,6 +139,7 @@ impl AppState {
|
||||||
Ok(self.inner.peek_uploading().is_none() && self.inner.queue_empty())
|
Ok(self.inner.peek_uploading().is_none() && self.inner.queue_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn rewind_chunk(mut self) -> Option<Self> {
|
pub fn rewind_chunk(mut self) -> Option<Self> {
|
||||||
self.inner = self.inner.rewind_chunk()?;
|
self.inner = self.inner.rewind_chunk()?;
|
||||||
|
|
||||||
|
|
|
||||||
12
src/cli.rs
12
src/cli.rs
|
|
@ -101,26 +101,26 @@ fn parse_sharry_file(data: &str) -> io::Result<Checked> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Cli {
|
impl Cli {
|
||||||
pub fn get_timeout(&self) -> Option<Duration> {
|
#[must_use] pub fn get_timeout(&self) -> Option<Duration> {
|
||||||
(!self.timeout.is_zero()).then_some(self.timeout)
|
(!self.timeout.is_zero()).then_some(self.timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_uri(&self) -> Uri {
|
#[must_use] pub fn get_uri(&self) -> Uri {
|
||||||
Uri::new(&self.protocol, &self.url)
|
Uri::new(&self.protocol, &self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn may_retry(&self, tries: u32) -> bool {
|
#[must_use] pub fn may_retry(&self, tries: u32) -> bool {
|
||||||
match self.retry_limit {
|
match self.retry_limit {
|
||||||
0 => true,
|
0 => true,
|
||||||
limit => tries < limit,
|
limit => tries < limit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_share_request(&self) -> NewShareRequest {
|
#[must_use] pub fn get_share_request(&self) -> NewShareRequest {
|
||||||
NewShareRequest::new(&self.name, self.description.as_ref(), self.max_views)
|
NewShareRequest::new(&self.name, self.description.as_ref(), self.max_views)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_level_filter(&self) -> LevelFilter {
|
#[must_use] pub fn get_level_filter(&self) -> LevelFilter {
|
||||||
match self.verbose {
|
match self.verbose {
|
||||||
0 => LevelFilter::Error,
|
0 => LevelFilter::Error,
|
||||||
1 => LevelFilter::Warn,
|
1 => LevelFilter::Warn,
|
||||||
|
|
@ -134,7 +134,7 @@ impl Cli {
|
||||||
self.files.iter().map(FileTrait::get_name).collect()
|
self.files.iter().map(FileTrait::get_name).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_hash(&self) -> String {
|
#[must_use] pub fn get_hash(&self) -> String {
|
||||||
let file_refs = {
|
let file_refs = {
|
||||||
let mut refs: Vec<_> = self.files.iter().collect();
|
let mut refs: Vec<_> = self.files.iter().collect();
|
||||||
refs.sort_unstable();
|
refs.sort_unstable();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// TODO fix with documentation
|
||||||
|
#![allow(clippy::missing_errors_doc)]
|
||||||
|
|
||||||
mod appstate;
|
mod appstate;
|
||||||
mod cachefile;
|
mod cachefile;
|
||||||
mod cli;
|
mod cli;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ type StaticStyled<'t> = LazyLock<StyledObject<&'t str>>;
|
||||||
|
|
||||||
pub static SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold());
|
pub static SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold());
|
||||||
|
|
||||||
pub fn prompt_continue() -> bool {
|
#[must_use] pub fn prompt_continue() -> bool {
|
||||||
let prompt = format!(
|
let prompt = format!(
|
||||||
"This operation has previously been stopped. {}",
|
"This operation has previously been stopped. {}",
|
||||||
style("How to proceed?").cyan()
|
style("How to proceed?").cyan()
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ impl ClientError {
|
||||||
Self::Unknown(into_string(e))
|
Self::Unknown(into_string(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_fatal(&self) -> bool {
|
#[must_use] pub fn is_fatal(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::InvalidParameter(p) => p.is_fatal(),
|
Self::InvalidParameter(p) => p.is_fatal(),
|
||||||
Self::Unknown(_) => true,
|
Self::Unknown(_) => true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue