mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 18:34:14 +00:00
apply clippy corrections
This commit is contained in:
parent
4cd0451aed
commit
f2e4d57d69
@ -79,7 +79,7 @@ impl Request {
|
|||||||
referrer: _,
|
referrer: _,
|
||||||
uri,
|
uri,
|
||||||
}
|
}
|
||||||
| Self::Titan(uri) => &uri,
|
| Self::Titan(uri) => uri,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@ const DOWNLOAD: &str = "download:";
|
|||||||
const SOURCE: &str = "source:";
|
const SOURCE: &str = "source:";
|
||||||
|
|
||||||
/// Feature wrapper for client `Request`
|
/// Feature wrapper for client `Request`
|
||||||
|
#[derive(Default)]
|
||||||
pub enum Feature {
|
pub enum Feature {
|
||||||
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
Download,
|
Download,
|
||||||
Source,
|
Source,
|
||||||
@ -37,9 +39,3 @@ impl Feature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Feature {
|
|
||||||
fn default() -> Self {
|
|
||||||
Feature::Default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -89,10 +89,7 @@ fn handle(
|
|||||||
Ok(text) => callback(Response::TextGemini {
|
Ok(text) => callback(Response::TextGemini {
|
||||||
base,
|
base,
|
||||||
source: text.data,
|
source: text.data,
|
||||||
is_source_request: match feature {
|
is_source_request: matches!(feature, Feature::Source),
|
||||||
Feature::Source => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
Err(e) => callback(Response::Failure(Failure::Mime {
|
Err(e) => callback(Response::Failure(Failure::Mime {
|
||||||
base,
|
base,
|
||||||
@ -177,7 +174,7 @@ fn redirect(
|
|||||||
// [Gemini protocol specifications](https://geminiprotocol.net/docs/protocol-specification.gmi#redirection)
|
// [Gemini protocol specifications](https://geminiprotocol.net/docs/protocol-specification.gmi#redirection)
|
||||||
if referrer.len() > 5 {
|
if referrer.len() > 5 {
|
||||||
return Response::Failure(Failure::Error {
|
return Response::Failure(Failure::Error {
|
||||||
message: format!("Max redirection count reached"),
|
message: "Max redirection count reached".to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
match data {
|
match data {
|
||||||
@ -190,9 +187,8 @@ fn redirect(
|
|||||||
|| base.host() != target.host()
|
|| base.host() != target.host()
|
||||||
{
|
{
|
||||||
return Response::Failure(Failure::Error {
|
return Response::Failure(Failure::Error {
|
||||||
message: format!(
|
message: "External redirects not allowed by protocol specification"
|
||||||
"External redirects not allowed by protocol specification"
|
.to_string(),
|
||||||
),
|
|
||||||
}); // @TODO placeholder page with optional link open button
|
}); // @TODO placeholder page with optional link open button
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user