Fix more clippy warnings

This commit is contained in:
Jonas Platte
2021-08-25 11:30:34 +02:00
committed by Sean McArthur
parent 4be5ec7ffd
commit 2881354c90
6 changed files with 12 additions and 14 deletions

View File

@@ -17,8 +17,7 @@ fn js_fetch(req: &web_sys::Request) -> Promise {
use wasm_bindgen::{JsCast, JsValue};
let global = js_sys::global();
if let Some(true) =
js_sys::Reflect::has(&global, &JsValue::from_str("ServiceWorkerGlobalScope")).ok()
if let Ok(true) = js_sys::Reflect::has(&global, &JsValue::from_str("ServiceWorkerGlobalScope"))
{
global
.unchecked_into::<web_sys::ServiceWorkerGlobalScope>()
@@ -213,7 +212,7 @@ async fn fetch(req: Request) -> crate::Result<Response> {
if let Some(body) = req.body() {
if !body.is_empty() {
init.body(Some(&body.to_js_value()?.as_ref().as_ref()));
init.body(Some(body.to_js_value()?.as_ref()));
}
}

View File

@@ -6,7 +6,6 @@ use http::{request::Parts, Method, Request as HttpRequest};
use serde::Serialize;
#[cfg(feature = "json")]
use serde_json;
use serde_urlencoded;
use url::Url;
use web_sys::RequestCredentials;
@@ -96,7 +95,7 @@ impl Request {
/// None is returned if a body is which can not be cloned.
pub fn try_clone(&self) -> Option<Request> {
let body = match self.body.as_ref() {
Some(ref body) => Some(body.try_clone()?),
Some(body) => Some(body.try_clone()?),
None => None,
};
@@ -106,7 +105,7 @@ impl Request {
headers: self.headers.clone(),
body,
cors: self.cors,
credentials: self.credentials.clone(),
credentials: self.credentials,
})
}
}