mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
style: use Self to avoid unnecessary repetition (#3396)
This commit is contained in:
@@ -38,7 +38,7 @@ where
|
||||
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
// Within Forwarded header
|
||||
if let Some(scheme) = parse_forwarded(&parts.headers) {
|
||||
return Ok(Scheme(scheme.to_owned()));
|
||||
return Ok(Self(scheme.to_owned()));
|
||||
}
|
||||
|
||||
// X-Forwarded-Proto
|
||||
@@ -47,12 +47,12 @@ where
|
||||
.get(X_FORWARDED_PROTO_HEADER_KEY)
|
||||
.and_then(|scheme| scheme.to_str().ok())
|
||||
{
|
||||
return Ok(Scheme(scheme.to_owned()));
|
||||
return Ok(Self(scheme.to_owned()));
|
||||
}
|
||||
|
||||
// From parts of an HTTP/2 request
|
||||
if let Some(scheme) = parts.uri.scheme_str() {
|
||||
return Ok(Scheme(scheme.to_owned()));
|
||||
return Ok(Self(scheme.to_owned()));
|
||||
}
|
||||
|
||||
Err(SchemeMissing)
|
||||
|
||||
Reference in New Issue
Block a user