Skip to content

Commit 03585fb

Browse files
committed
fix clippy
1 parent bc5f37d commit 03585fb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

crates/yew-hooks/src/hooks/use_websocket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub fn use_websocket_with_options(url: String, options: UseWebSocketOptions) ->
257257
&& ws
258258
.borrow()
259259
.as_ref()
260-
.map_or(false, |ws: &WebSocket| ws.ready_state() != WebSocket::OPEN)
260+
.is_some_and(|ws: &WebSocket| ws.ready_state() != WebSocket::OPEN)
261261
{
262262
let connect_ws = connect_ws.clone();
263263
let reconnect_times_ref = reconnect_times_ref.clone();

examples/yew-app/src/app/hooks/use_async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn UseAsync() -> Html {
8383
}
8484

8585
async fn fetch_repo(repo: String) -> Result<Repo, Error> {
86-
fetch::<Repo>(format!("https://api.github.com/repos/{}", repo)).await
86+
fetch::<Repo>(format!("https://api.github.com/repos/{repo}")).await
8787
}
8888

8989
/// You can use reqwest or other crates to fetch your api.

examples/yew-app/src/app/hooks/use_websocket.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn UseWebSocket() -> Html {
1616
Callback::from(move |_| {
1717
let message = "Hello, world!".to_string();
1818
ws.send(message.clone());
19-
history.push(format!("ws1 [send]: {}", message));
19+
history.push(format!("ws1 [send]: {message}"));
2020
})
2121
};
2222
{
@@ -38,7 +38,7 @@ pub fn UseWebSocket() -> Html {
3838
Callback::from(move |_| {
3939
let message = b"Hello, world!\r\n".to_vec();
4040
ws.send_bytes(message.clone());
41-
history.push(format!("ws1 [send]: bytes {:?}", message));
41+
history.push(format!("ws1 [send]: bytes {message:?}"));
4242
})
4343
};
4444
{
@@ -61,7 +61,7 @@ pub fn UseWebSocket() -> Html {
6161
UseWebSocketOptions {
6262
// Receive message by callback `onmessage`.
6363
onmessage: Some(Box::new(move |message| {
64-
history.push(format!("ws2 [recv]: {}", message));
64+
history.push(format!("ws2 [recv]: {message}"));
6565
})),
6666
manual: Some(true),
6767
..Default::default()
@@ -74,7 +74,7 @@ pub fn UseWebSocket() -> Html {
7474
Callback::from(move |_| {
7575
let message = "Hello, yew_hooks!".to_string();
7676
ws2.send(message.clone());
77-
history.push(format!("ws2 [send]: {}", message));
77+
history.push(format!("ws2 [send]: {message}"));
7878
})
7979
};
8080
let onopen = {

0 commit comments

Comments
 (0)