Skip to content

Commit

Permalink
Clippy fixes. (#2415)
Browse files Browse the repository at this point in the history
* Clippy fixes.

* Bump the web_sys required version.
  • Loading branch information
LaurentMazare authored Aug 14, 2024
1 parent 68aa9c7 commit 53ce65f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion candle-wasm-examples/llama2-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
12 changes: 5 additions & 7 deletions candle-wasm-examples/llama2-c/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down
2 changes: 1 addition & 1 deletion candle-wasm-examples/whisper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
12 changes: 5 additions & 7 deletions candle-wasm-examples/whisper/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down
2 changes: 1 addition & 1 deletion candle-wasm-examples/yolo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 5 additions & 6 deletions candle-wasm-examples/yolo/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down

0 comments on commit 53ce65f

Please sign in to comment.