Skip to content

Commit 28bd8d9

Browse files
committed
fix: clippy
1 parent ecf1aa5 commit 28bd8d9

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

  • libs/@local/graph/api/src/rest

libs/@local/graph/api/src/rest/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,27 @@ pub struct JsonCompatHeader(pub bool);
175175
impl<S: Sync> FromRequestParts<S> for JsonCompatHeader {
176176
type Rejection = (StatusCode, Cow<'static, str>);
177177

178-
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
178+
fn from_request_parts(
179+
parts: &mut Parts,
180+
_state: &S,
181+
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
179182
let Some(value) = parts.headers.get("Json-Compat") else {
180-
return Ok(Self(false));
183+
return core::future::ready(Ok(Self(false)));
181184
};
182185

183186
let bytes = value.as_ref();
184187
if bytes.eq_ignore_ascii_case(b"true") || bytes.eq_ignore_ascii_case(b"1") {
185-
return Ok(Self(true));
188+
return core::future::ready(Ok(Self(true)));
186189
}
187190

188191
if bytes.eq_ignore_ascii_case(b"false") || bytes.eq_ignore_ascii_case(b"0") {
189-
return Ok(Self(false));
192+
return core::future::ready(Ok(Self(false)));
190193
}
191194

192-
Err((
195+
core::future::ready(Err((
193196
StatusCode::BAD_REQUEST,
194197
Cow::Borrowed("`Json-Compat` header must be either `true` (`1`) or `false` (`0`)"),
195-
))
198+
)))
196199
}
197200
}
198201

0 commit comments

Comments
 (0)