Skip to content

lint: cargo fmt

lint: cargo fmt #91

Triggered via push January 30, 2024 22:18
Status Success
Total duration 41s
Artifacts

security.yml

on: push
security_audit
32s
security_audit
Fit to window
Zoom out
Zoom in

Annotations

52 warnings
security_audit
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-rs/audit-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
security_audit
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/audit-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
security_audit
2 warnings found!
security_audit
Unknown warning kind unsound found, please, file a bug
useless conversion to the same type: `std::collections::hash_map::Values<'_, std::string::String, core::peer::Peer>`: src/main.rs#L118
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() |
this let-binding has unit value: src/plugins/websocket/mod.rs#L542
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 + }); |
this let-binding has unit value: src/plugins/websocket/mod.rs#L532
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 + }); |
length comparison to zero: src/plugins/websocket/mod.rs#L517
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
length comparison to zero: src/plugins/websocket/mod.rs#L507
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
this expression creates a reference which is immediately dereferenced by the compiler: src/plugins/websocket/mod.rs#L502
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
unneeded `return` statement: src/plugins/websocket/mod.rs#L396
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(()) |
unneeded `return` statement: src/plugins/websocket/mod.rs#L338
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(()) |
unneeded `return` statement: src/plugins/websocket/mod.rs#L334
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(()) |
unneeded `return` statement: src/plugins/websocket/mod.rs#L330
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(()) |
useless use of `format!`: src/plugins/websocket/handlers/sites.rs#L549
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
useless use of `format!`: src/plugins/websocket/handlers/sites.rs#L542
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
useless use of `format!`: src/plugins/websocket/handlers/sites.rs#L518
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
this expression creates a reference which is immediately dereferenced by the compiler: src/plugins/websocket/handlers/sites.rs#L164
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
this expression creates a reference which is immediately dereferenced by the compiler: src/plugins/websocket/handlers/sites.rs#L157
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
redundant closure: src/plugins/websocket/handlers/sites.rs#L53
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
called `unwrap_err` on `res` after checking its variant with `is_err`: src/plugins/site_server/media.rs#L26
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
unnecessary map of the identity function: src/plugins/site_server/handlers/users.rs#L186
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
redundant pattern matching, consider using `is_some()`: src/plugins/site_server/handlers/sites.rs#L358
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
non-binding `let` on a future: src/plugins/site_server/handlers/sites.rs#L195
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
use of `default` to create a unit struct: src/plugins/site_server/common.rs#L90
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
useless conversion to the same type: `&str`: src/net/response.rs#L88
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
the borrowed expression implements the required traits: src/io/utils.rs#L58
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
sub-expression diverges: /rustc/5518eaa946291f00471af8b254b2a1715f234882/library/core/src/macros/mod.rs#L793
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)
this expression borrows a value the compiler would automatically borrow: src/io/site.rs#L403
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
this expression creates a reference which is immediately dereferenced by the compiler: src/io/site.rs#L301
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/io/site.rs:301:43 | 301 | let verified = content.verify(&self.address()); | ^^^^^^^^^^^^^^^ help: change this to: `self.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
you seem to want to iterate on a map's keys: src/io/site.rs#L215
warning: you seem to want to iterate on a map's keys --> src/io/site.rs:215:36 | 215 | for (inner_path, _file) in includes { | ^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#for_kv_map = note: `#[warn(clippy::for_kv_map)]` on by default help: use the corresponding method | 215 | for inner_path in includes.keys() { | ~~~~~~~~~~ ~~~~~~~~~~~~~~~
file opened with `create`, but `truncate` behavior not defined: src/io/content.rs#L92
warning: file opened with `create`, but `truncate` behavior not defined --> src/io/content.rs:92:14 | 92 | .create(true) | ^^^^^^^^^^^^- help: add: `.truncate(true)` | = help: if you intend to overwrite an existing file entirely, call `.truncate(true)` = help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)` = help: alternatively, use `.append(true)` to append to the file instead of overwriting it = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options = note: `#[warn(clippy::suspicious_open_options)]` on by default
useless conversion to the same type: `std::collections::btree_map::Keys<'_, std::string::String, std::string::String>`: src/io/content.rs#L60
warning: useless conversion to the same type: `std::collections::btree_map::Keys<'_, std::string::String, std::string::String>` --> src/io/content.rs:60:24 | 60 | let verified = content | ________________________^ 61 | | .signs 62 | | .keys() 63 | | .into_iter() | |________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default help: consider removing `.into_iter()` | 60 ~ let verified = content 61 + .signs 62 + .keys() |
the borrowed expression implements the required traits: src/io/content.rs#L22
warning: the borrowed expression implements the required traits --> src/io/content.rs:22:43 | 22 | let path = &self.site_path().join(&inner_path); | ^^^^^^^^^^^ 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 = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
unneeded `return` statement: src/core/user.rs#L459
warning: unneeded `return` statement --> src/core/user.rs:459:9 | 459 | / return Some(format!( 460 | | "{}@{}", 461 | | cert.auth_user_name, 462 | | site_data.get_cert_provider().unwrap() 463 | | )); | |__________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: `#[warn(clippy::needless_return)]` on by default help: remove `return` | 459 ~ Some(format!( 460 + "{}@{}", 461 + cert.auth_user_name, 462 + site_data.get_cert_provider().unwrap() 463 ~ )) |
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L327
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:327:48 | 327 | new_query = re.replace_all(&query, replacement.as_str()).into(); | ^^^^^^ help: change this to: `query` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L324
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:324:45 | 324 | let key = regex::escape(&key); | ^^^^ help: change this to: `key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L294
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:294:40 | 294 | new_query = re.replace(&query, &wheres).into(); | ^^^^^^ help: change this to: `query` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L94
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:94:44 | 94 | self.db_manager.connect_db(&site.address())?; | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L93
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:93:47 | 93 | self.db_manager.insert_schema(&site.address(), schema); | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L92
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:92:63 | 92 | if let Some(schema) = self.db_manager.load_schema(&site.address()) { | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/controllers/sites.rs#L70
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/controllers/sites.rs:70:49 | 70 | if let Some(addr) = self.sites_addr.get(&address) { | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L59
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:59:34 | 59 | let conn = db_manager.get_db(&site.address()).unwrap(); | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L58
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:58:27 | 58 | db_manager.connect_db(&site.address())?; | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L57
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:57:30 | 57 | db_manager.insert_schema(&site.address(), schema); | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L56
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:56:41 | 56 | let schema = db_manager.load_schema(&site.address()).unwrap(); | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L46
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:46:30 | 46 | db_manager.load_data(&address).await; | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L45
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:45:34 | 45 | db_manager.create_tables(&address); | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L44
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:44:31 | 44 | db_manager.connect_db(&address)?; | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L43
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:43:34 | 43 | db_manager.insert_schema(&address, schema); | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L42
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:42:45 | 42 | let schema = db_manager.load_schema(&address).unwrap(); | ^^^^^^^^ help: change this to: `address` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/common.rs#L39
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/common.rs:39:44 | 39 | let has_schema = db_manager.has_schema(&site.address()); | ^^^^^^^^^^^^^^^ help: change this to: `site.address()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default