clippy fix
This commit is contained in:
parent
783346c888
commit
01bcf92d9c
2 changed files with 12 additions and 10 deletions
|
|
@ -33,7 +33,7 @@ fn find_cause(
|
|||
|
||||
if let Some(msg) = error.get_ref().map(ToString::to_string) {
|
||||
if msg == "failed to lookup address information: Name does not resolve" {
|
||||
ClientError::InvalidParameter(sharry::Parameter::URI(uri.to_string()))
|
||||
ClientError::InvalidParameter(sharry::Parameter::Uri(uri.to_string()))
|
||||
} else {
|
||||
error.into()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ pub trait Client {
|
|||
Ok(fid)
|
||||
} else {
|
||||
Err(super::ClientError::unknown(format!(
|
||||
"Could not extract File ID from {:?}",
|
||||
uri
|
||||
"Could not extract File ID from {uri:?}"
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
|
@ -90,7 +89,7 @@ pub trait Client {
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Parameter {
|
||||
#[error("given URI {0:?}")]
|
||||
URI(String),
|
||||
Uri(String),
|
||||
|
||||
#[error("given Alias ID {0:?}")]
|
||||
AliasID(String),
|
||||
|
|
@ -104,10 +103,7 @@ pub enum Parameter {
|
|||
|
||||
impl Parameter {
|
||||
fn is_fatal(&self) -> bool {
|
||||
match self {
|
||||
Self::URI(_) | Self::AliasID(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Self::Uri(_) | Self::AliasID(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +122,12 @@ pub enum ClientError {
|
|||
Unknown(String),
|
||||
}
|
||||
|
||||
fn into_string(val: impl ToString) -> String {
|
||||
let result = val.to_string();
|
||||
drop(val);
|
||||
result
|
||||
}
|
||||
|
||||
impl ClientError {
|
||||
pub fn res_status_check<T>(actual: T, expected: T) -> super::Result<()>
|
||||
where
|
||||
|
|
@ -141,11 +143,11 @@ impl ClientError {
|
|||
}
|
||||
|
||||
pub fn response(e: impl ToString) -> Self {
|
||||
Self::Response(e.to_string())
|
||||
Self::Response(into_string(e))
|
||||
}
|
||||
|
||||
pub fn unknown(e: impl ToString) -> Self {
|
||||
Self::Unknown(e.to_string())
|
||||
Self::Unknown(into_string(e))
|
||||
}
|
||||
|
||||
pub fn is_fatal(&self) -> bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue