opt: update deps + reduce data .clone() #89
clippy
48 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 48 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.77.0-nightly (5518eaa94 2024-01-29)
- cargo 1.77.0-nightly (7bb7b5395 2024-01-20)
- clippy 0.1.77 (5518eaa 2024-01-29)
Annotations
Check warning on line 121 in src/main.rs
github-actions / clippy
useless conversion to the same type: `std::collections::hash_map::Values<'_, std::string::String, core::peer::Peer>`
warning: useless conversion to the same type: `std::collections::hash_map::Values<'_, std::string::String, core::peer::Peer>`
--> src/main.rs:118:49
|
118 | let mut connectable_peers = site
| _________________________________________________^
119 | | .peers
120 | | .values()
121 | | .into_iter()
| |____________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
help: consider removing `.into_iter()`
|
118 ~ let mut connectable_peers = site
119 + .peers
120 + .values()
|
Check warning on line 546 in src/plugins/websocket/mod.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/plugins/websocket/mod.rs:542:9
|
542 | / let _ = self.ws_controller.do_send(ServerEvent::Notification {
543 | | cmd: "notification".to_string(),
544 | | id,
545 | | params,
546 | | });
| |___________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding
|
542 ~ self.ws_controller.do_send(ServerEvent::Notification {
543 + cmd: "notification".to_string(),
544 + id,
545 + params,
546 + });
|
Check warning on line 536 in src/plugins/websocket/mod.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/plugins/websocket/mod.rs:532:9
|
532 | / let _ = self.ws_controller.do_send(ServerEvent::Event {
533 | | id: self.next_message_id,
534 | | cmd: event_name.to_string(),
535 | | params: event,
536 | | });
| |___________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
= note: `#[warn(clippy::let_unit_value)]` on by default
help: omit the `let` binding
|
532 ~ self.ws_controller.do_send(ServerEvent::Event {
533 + id: self.next_message_id,
534 + cmd: event_name.to_string(),
535 + params: event,
536 + });
|
Check warning on line 517 in src/plugins/websocket/mod.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/plugins/websocket/mod.rs:517:20
|
517 | if params.len() > 0 {
| ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!params.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 507 in src/plugins/websocket/mod.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/plugins/websocket/mod.rs:507:20
|
507 | if params.len() > 0 {
| ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!params.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
Check warning on line 502 in src/plugins/websocket/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/plugins/websocket/mod.rs:502:55
|
502 | let site_info = append_user_site_data(&self, &mut site_info).unwrap();
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 396 in src/plugins/websocket/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/plugins/websocket/mod.rs:396:9
|
396 | return Ok(());
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
396 - return Ok(());
396 + Ok(())
|
Check warning on line 338 in src/plugins/websocket/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/plugins/websocket/mod.rs:338:17
|
338 | return Ok(());
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
338 - return Ok(());
338 + Ok(())
|
Check warning on line 334 in src/plugins/websocket/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/plugins/websocket/mod.rs:334:17
|
334 | return Ok(());
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
334 - return Ok(());
334 + Ok(())
|
Check warning on line 330 in src/plugins/websocket/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/plugins/websocket/mod.rs:330:17
|
330 | return Ok(());
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
330 - return Ok(());
330 + Ok(())
|
Check warning on line 549 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> src/plugins/websocket/handlers/sites.rs:549:24
|
549 | error: format!("Invalid params"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Invalid params".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
Check warning on line 542 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> src/plugins/websocket/handlers/sites.rs:542:28
|
542 | error: format!("Invalid params"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Invalid params".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
Check warning on line 518 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> src/plugins/websocket/handlers/sites.rs:518:20
|
518 | error: format!("Can't change this key"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Can't change this key".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `#[warn(clippy::useless_format)]` on by default
Check warning on line 164 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/plugins/websocket/handlers/sites.rs:164:40
|
164 | if accepted_providers.contains(&provider) || accept_any || accepted_pattern_match {
| ^^^^^^^^^ help: change this to: `provider`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 157 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/plugins/websocket/handlers/sites.rs:157:32
|
157 | regex.is_match(&provider)
| ^^^^^^^^^ help: change this to: `provider`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 53 in src/plugins/websocket/handlers/sites.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/plugins/websocket/handlers/sites.rs:53:31
|
53 | Some(Box::new(move |ws, cmd| cert_add_confirm(ws, cmd))),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `cert_add_confirm`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
Check warning on line 26 in src/plugins/site_server/media.rs
github-actions / clippy
called `unwrap_err` on `res` after checking its variant with `is_err`
warning: called `unwrap_err` on `res` after checking its variant with `is_err`
--> src/plugins/site_server/media.rs:26:15
|
25 | if res.is_err() {
| --------------- help: try: `if let Err(..) = res`
26 | match res.unwrap_err() {
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
= note: `#[warn(clippy::unnecessary_unwrap)]` on by default
Check warning on line 187 in src/plugins/site_server/handlers/users.rs
github-actions / clippy
unnecessary map of the identity function
warning: unnecessary map of the identity function
--> src/plugins/site_server/handlers/users.rs:186:37
|
186 | .into_iter()
| _____________________________________^
187 | | .map(|(addr, site_data)| (addr, site_data))
| |___________________________________________________________________^ help: remove the call to `map`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
= note: `#[warn(clippy::map_identity)]` on by default
Check warning on line 358 in src/plugins/site_server/handlers/sites.rs
github-actions / clippy
redundant pattern matching, consider using `is_some()`
warning: redundant pattern matching, consider using `is_some()`
--> src/plugins/site_server/handlers/sites.rs:358:16
|
358 | if let Some(_) = self.sites.remove(&msg.address) {
| -------^^^^^^^---------------------------------- help: try: `if self.sites.remove(&msg.address).is_some()`
|
= note: this will change drop order of the result, as well as all temporaries
= note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
Check warning on line 195 in src/plugins/site_server/handlers/sites.rs
github-actions / clippy
non-binding `let` on a future
warning: non-binding `let` on a future
--> src/plugins/site_server/handlers/sites.rs:195:13
|
195 | let _ = self.load_content();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider awaiting the future or dropping explicitly with `std::mem::drop`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_future
= note: `#[warn(clippy::let_underscore_future)]` on by default
Check warning on line 90 in src/plugins/site_server/common.rs
github-actions / clippy
use of `default` to create a unit struct
warning: use of `default` to create a unit struct
--> src/plugins/site_server/common.rs:90:25
|
90 | let mut rand = OsRng::default();
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
= note: `#[warn(clippy::default_constructed_unit_structs)]` on by default
Check warning on line 88 in src/net/response.rs
github-actions / clippy
useless conversion to the same type: `&str`
warning: useless conversion to the same type: `&str`
--> src/net/response.rs:88:35
|
88 | let builder = update_site(msg.into());
| ^^^^^^^^^^ help: consider removing `.into()`: `msg`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Check warning on line 58 in src/io/utils.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/io/utils.rs:58:46
|
58 | let hash = get_zfile_info(site_path.join(&inner_path)).await?;
| ^^^^^^^^^^^ help: change this to: `inner_path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
github-actions / clippy
sub-expression diverges
warning: sub-expression diverges
--> src/io/site.rs:485:9
|
485 | unimplemented!()
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
= note: `#[warn(clippy::diverging_sub_expression)]` on by default
= note: this warning originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 403 in src/io/site.rs
github-actions / clippy
this expression borrows a value the compiler would automatically borrow
warning: this expression borrows a value the compiler would automatically borrow
--> src/io/site.rs:403:24
|
403 | let modified = (&self.content(None).unwrap().modified).clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `self.content(None).unwrap().modified`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow