Skip to content

Commit 0dbb7ba

Browse files
committed
Fix clippy lints
1 parent 6b51f8d commit 0dbb7ba

File tree

78 files changed

+522
-416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+522
-416
lines changed

Cargo.lock

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readme = "README.md"
1111
keywords = ["wasm", "webassembly", "frontend", "framework", "web"]
1212
categories = ["wasm", "web-programming"]
1313
edition = "2021"
14-
rust-version = "1.61.0"
14+
rust-version = "1.67.1"
1515

1616
[workspace]
1717
members = [
@@ -166,6 +166,6 @@ serde-wasm-bindgen = ["dep:serde", "dep:serde-wasm-bindgen"]
166166
version_check = "0.9.4"
167167

168168
[dev-dependencies]
169-
wasm-bindgen-test = "0.3.34"
170169
serde_json = "1.0.93"
171170
serde-wasm-bindgen = "0.4.5"
171+
wasm-bindgen-test = "0.3.34"

Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ args = ["clippy", "--all-features", "--",
252252
"--allow", "clippy::wildcard_imports", # for `use seed::{prelude::*, *};`
253253
"--allow", "clippy::future_not_send", # JS/WASM is single threaded
254254
"--allow", "clippy::used_underscore_binding", # some libraries break this rule
255-
"--allow", "clippy::eval_order_dependence", # false positives
255+
"--allow", "clippy::mixed_read_write_in_expression", # false positives
256256
"--allow", "clippy::vec_init_then_push", # Vec::new() + push are used in macros in shortcuts.rs
257257
]
258258
dependencies = ["default::install-clippy"]

examples/animation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Car {
4646

4747
fn generate_color() -> CarColor {
4848
let hue = thread_rng().gen_range(0..=360);
49-
format!("hsl({}, 80%, 50%)", hue)
49+
format!("hsl({hue}, 80%, 50%)")
5050
}
5151
}
5252

examples/auth/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ edition = "2018"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11+
gloo-console = "0.2.3"
1112
gloo-net = "0.2.6"
13+
gloo-storage = "0.2.2"
1214
seed = {path = "../../"}
1315
serde = "1.0.152"

examples/auth/src/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![allow(clippy::must_use_candidate)]
22

3+
use gloo_console::log;
34
use gloo_net::http::{Method, Request};
5+
use gloo_storage::{LocalStorage, Storage};
46
use seed::{prelude::*, *};
57
use serde::{Deserialize, Serialize};
68

@@ -77,8 +79,8 @@ fn send_request_to_top_secret(token: String, orders: &mut impl Orders<Msg>) {
7779
orders.perform_cmd(async move {
7880
Msg::TopSecretFetched(
7981
async {
80-
Request::get(&format!("{}/top_secret", API_URL))
81-
.header("Authorization", &format!("Bearer {}", token))
82+
Request::get(&format!("{API_URL}/top_secret"))
83+
.header("Authorization", &format!("Bearer {token}"))
8284
.send()
8385
.await?
8486
.text()
@@ -125,7 +127,7 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
125127
Msg::EmailChanged(email) => model.email = email,
126128
Msg::PasswordChanged(password) => model.password = password,
127129
Msg::LoginClicked => {
128-
let request = Request::new(&format!("{}/users/login", API_URL))
130+
let request = Request::new(&format!("{API_URL}/users/login"))
129131
.method(Method::POST)
130132
.json(&LoginRequestBody {
131133
email: &model.email,
@@ -136,16 +138,18 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
136138
});
137139
}
138140
Msg::LoginFetched(Ok(logged_user)) => {
139-
LocalStorage::insert(STORAGE_KEY, &logged_user).expect("save user");
141+
LocalStorage::set(STORAGE_KEY, &logged_user).expect("save user");
140142
model.user = Some(logged_user);
141143
orders.notify(subs::UrlRequested::new(Urls::new(&model.base_url).home()));
142144
}
143145
Msg::TopSecretFetched(Ok(secret_message)) => {
144146
model.secret_message = Some(secret_message);
145147
}
146-
Msg::LoginFetched(Err(error)) | Msg::TopSecretFetched(Err(error)) => log!(error),
148+
Msg::LoginFetched(Err(error)) | Msg::TopSecretFetched(Err(error)) => {
149+
log!(format!("{error}"));
150+
}
147151
Msg::LogoutClicked => {
148-
LocalStorage::remove(STORAGE_KEY).expect("remove saved user");
152+
LocalStorage::delete(STORAGE_KEY);
149153
model.user = None;
150154
model.secret_message = None;
151155
}

examples/charts/src/line.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn chart<Ms: Clone + 'static>(
3535
C!["chart"],
3636
style! { St::Display => "block" },
3737
attrs! {
38-
ViewBox => format!("0 0 {} {}", width, height),
38+
ViewBox => format!("0 0 {width} {height}"),
3939
},
4040
g![
4141
C!["x-axis"],

examples/custom_elements/src/checkbox_tristate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ impl fmt::Display for State {
5656
Self::Indeterminate => "indeterminate",
5757
Self::Checked => "checked",
5858
};
59-
write!(f, "{}", state)
59+
write!(f, "{state}")
6060
}
6161
}

examples/drag_and_drop/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ edition = "2018"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11+
gloo-console = "0.2.3"
1112
seed = {path = "../../"}

examples/drag_and_drop/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
use gloo_console::log;
12
use seed::{prelude::*, *};
23
use web_sys::{self, HtmlDivElement};
4+
35
// ------ ------
46
// Init
57
// ------ ------

0 commit comments

Comments
 (0)