apply clippy corrections

This commit is contained in:
yggverse 2025-01-18 14:27:19 +02:00
parent 4cd0451aed
commit f2e4d57d69
3 changed files with 7 additions and 15 deletions

View File

@ -79,7 +79,7 @@ impl Request {
referrer: _,
uri,
}
| Self::Titan(uri) => &uri,
| Self::Titan(uri) => uri,
}
}
}

View File

@ -3,7 +3,9 @@ const DOWNLOAD: &str = "download:";
const SOURCE: &str = "source:";
/// Feature wrapper for client `Request`
#[derive(Default)]
pub enum Feature {
#[default]
Default,
Download,
Source,
@ -37,9 +39,3 @@ impl Feature {
}
}
}
impl Default for Feature {
fn default() -> Self {
Feature::Default
}
}

View File

@ -89,10 +89,7 @@ fn handle(
Ok(text) => callback(Response::TextGemini {
base,
source: text.data,
is_source_request: match feature {
Feature::Source => true,
_ => false,
},
is_source_request: matches!(feature, Feature::Source),
}),
Err(e) => callback(Response::Failure(Failure::Mime {
base,
@ -177,7 +174,7 @@ fn redirect(
// [Gemini protocol specifications](https://geminiprotocol.net/docs/protocol-specification.gmi#redirection)
if referrer.len() > 5 {
return Response::Failure(Failure::Error {
message: format!("Max redirection count reached"),
message: "Max redirection count reached".to_string(),
});
}
match data {
@ -190,9 +187,8 @@ fn redirect(
|| base.host() != target.host()
{
return Response::Failure(Failure::Error {
message: format!(
"External redirects not allowed by protocol specification"
),
message: "External redirects not allowed by protocol specification"
.to_string(),
}); // @TODO placeholder page with optional link open button
}