diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2024-08-14 09:13:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-14 10:13:53 +0200 |
commit | 53ce65f70697ff62a1a449270f87ee654779c8bd (patch) | |
tree | 2e050b82e9d3ec6bd37d7762d81c50e079634fe3 /candle-wasm-examples | |
parent | 68aa9c73208c8847bc7623a7eea4cbcbda0b31d6 (diff) | |
download | candle-53ce65f70697ff62a1a449270f87ee654779c8bd.tar.gz candle-53ce65f70697ff62a1a449270f87ee654779c8bd.tar.bz2 candle-53ce65f70697ff62a1a449270f87ee654779c8bd.zip |
Clippy fixes. (#2415)
* Clippy fixes.
* Bump the web_sys required version.
Diffstat (limited to 'candle-wasm-examples')
-rw-r--r-- | candle-wasm-examples/llama2-c/Cargo.toml | 2 | ||||
-rw-r--r-- | candle-wasm-examples/llama2-c/src/app.rs | 12 | ||||
-rw-r--r-- | candle-wasm-examples/whisper/Cargo.toml | 2 | ||||
-rw-r--r-- | candle-wasm-examples/whisper/src/app.rs | 12 | ||||
-rw-r--r-- | candle-wasm-examples/yolo/Cargo.toml | 2 | ||||
-rw-r--r-- | candle-wasm-examples/yolo/src/app.rs | 11 |
6 files changed, 18 insertions, 23 deletions
diff --git a/candle-wasm-examples/llama2-c/Cargo.toml b/candle-wasm-examples/llama2-c/Cargo.toml index d46cdafa..af473765 100644 --- a/candle-wasm-examples/llama2-c/Cargo.toml +++ b/candle-wasm-examples/llama2-c/Cargo.toml @@ -35,7 +35,7 @@ yew-agent = "0.2.0" yew = { version = "0.20.0", features = ["csr"] } [dependencies.web-sys] -version = "0.3.64" +version = "0.3.70" features = [ 'Blob', 'Document', diff --git a/candle-wasm-examples/llama2-c/src/app.rs b/candle-wasm-examples/llama2-c/src/app.rs index 1e40b77e..7456a5bd 100644 --- a/candle-wasm-examples/llama2-c/src/app.rs +++ b/candle-wasm-examples/llama2-c/src/app.rs @@ -9,13 +9,11 @@ use yew_agent::{Bridge, Bridged}; async fn fetch_url(url: &str) -> Result<Vec<u8>, JsValue> { use web_sys::{Request, RequestCache, RequestInit, RequestMode, Response}; let window = web_sys::window().ok_or("window")?; - let mut opts = RequestInit::new(); - let opts = opts - .method("GET") - .mode(RequestMode::Cors) - .cache(RequestCache::NoCache); - - let request = Request::new_with_str_and_init(url, opts)?; + let opts = RequestInit::new(); + opts.set_method("GET"); + opts.set_mode(RequestMode::Cors); + opts.set_cache(RequestCache::NoCache); + let request = Request::new_with_str_and_init(url, &opts)?; let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?; diff --git a/candle-wasm-examples/whisper/Cargo.toml b/candle-wasm-examples/whisper/Cargo.toml index 745b7ae7..526a6442 100644 --- a/candle-wasm-examples/whisper/Cargo.toml +++ b/candle-wasm-examples/whisper/Cargo.toml @@ -35,7 +35,7 @@ yew-agent = "0.2.0" yew = { version = "0.20.0", features = ["csr"] } [dependencies.web-sys] -version = "0.3.64" +version = "0.3.70" features = [ 'Blob', 'Document', diff --git a/candle-wasm-examples/whisper/src/app.rs b/candle-wasm-examples/whisper/src/app.rs index e344096c..a2c0ddab 100644 --- a/candle-wasm-examples/whisper/src/app.rs +++ b/candle-wasm-examples/whisper/src/app.rs @@ -18,13 +18,11 @@ const SAMPLE_NAMES: [&str; 6] = [ async fn fetch_url(url: &str) -> Result<Vec<u8>, JsValue> { use web_sys::{Request, RequestCache, RequestInit, RequestMode, Response}; let window = web_sys::window().ok_or("window")?; - let mut opts = RequestInit::new(); - let opts = opts - .method("GET") - .mode(RequestMode::Cors) - .cache(RequestCache::NoCache); - - let request = Request::new_with_str_and_init(url, opts)?; + let opts = RequestInit::new(); + opts.set_method("GET"); + opts.set_mode(RequestMode::Cors); + opts.set_cache(RequestCache::NoCache); + let request = Request::new_with_str_and_init(url, &opts)?; let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?; diff --git a/candle-wasm-examples/yolo/Cargo.toml b/candle-wasm-examples/yolo/Cargo.toml index ac76f9a7..e03319a0 100644 --- a/candle-wasm-examples/yolo/Cargo.toml +++ b/candle-wasm-examples/yolo/Cargo.toml @@ -35,7 +35,7 @@ yew-agent = "0.2.0" yew = { version = "0.20.0", features = ["csr"] } [dependencies.web-sys] -version = "0.3.64" +version = "0.3.70" features = [ 'Blob', 'CanvasRenderingContext2d', diff --git a/candle-wasm-examples/yolo/src/app.rs b/candle-wasm-examples/yolo/src/app.rs index a68284fa..61253fb5 100644 --- a/candle-wasm-examples/yolo/src/app.rs +++ b/candle-wasm-examples/yolo/src/app.rs @@ -8,13 +8,12 @@ use yew_agent::{Bridge, Bridged}; async fn fetch_url(url: &str) -> Result<Vec<u8>, JsValue> { use web_sys::{Request, RequestCache, RequestInit, RequestMode, Response}; let window = web_sys::window().ok_or("window")?; - let mut opts = RequestInit::new(); - let opts = opts - .method("GET") - .mode(RequestMode::Cors) - .cache(RequestCache::NoCache); + let opts = RequestInit::new(); + opts.set_method("GET"); + opts.set_mode(RequestMode::Cors); + opts.set_cache(RequestCache::NoCache); - let request = Request::new_with_str_and_init(url, opts)?; + let request = Request::new_with_str_and_init(url, &opts)?; let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?; |