mrpack export, packwiz import/export #28
Annotations
25 errors and 16 warnings
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/util/packwiz.rs#L807
error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/util/packwiz.rs:807:10
|
807 | .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/util/packwiz.rs#L778
error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/util/packwiz.rs:778:10
|
778 | .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/util/packwiz.rs#L759
error: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/util/packwiz.rs:759:10
|
759 | .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[deny(clippy::into_iter_on_ref)]` implied by `#[deny(clippy::all)]`
|
the borrowed expression implements the required traits:
src/util/packwiz.rs#L482
error: the borrowed expression implements the required traits
--> src/util/packwiz.rs:482:35
|
482 | let diff = diff_paths(folder, &root)?;
| ^^^^^ help: change this to: `root`
|
= 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/util/packwiz.rs#L192
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:192:13
|
192 | &server,
| ^^^^^^^ help: change this to: `server`
|
= 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/util/packwiz.rs#L191
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:191:13
|
191 | &http_client,
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L158
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:158:17
|
158 | &http_client
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L157
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:157:17
|
157 | &server,
| ^^^^^^^ help: change this to: `server`
|
= 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/util/packwiz.rs#L96
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:96:37
|
96 | let m: Mod = fetch_toml(&http_client, file_url)
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L76
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:76:44
|
76 | let pack_index: PackIndex = fetch_toml(&http_client, index_url)
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L67
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:67:33
|
67 | let pack: Pack = fetch_toml(&http_client, base_url.clone())
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L44
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:44:20
|
44 | fetch_toml(&http_client, base_url.clone())
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L32
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:32:30
|
32 | packwiz_import_local(&http_client, base, server).await?
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/packwiz.rs#L28
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/packwiz.rs:28:29
|
28 | packwiz_import_http(&http_client, base_url, server).await?
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
the borrowed expression implements the required traits:
src/util/mrpack.rs#L231
error: the borrowed expression implements the required traits
--> src/util/mrpack.rs:231:19
|
231 | fs::write(&real_path, zip_content).context(format!("Writing {}", real_path.display()))?;
| ^^^^^^^^^^ help: change this to: `real_path`
|
= 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/util/mrpack.rs#L121
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/mrpack.rs:121:13
|
121 | &http_client,
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/util/mrpack.rs#L120
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/mrpack.rs:120:13
|
120 | &server,
| ^^^^^^^ help: change this to: `server`
|
= 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/util/mrpack.rs#L111
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/util/mrpack.rs:111:55
|
111 | let downloadable = resolve_mrpack_source(src, &http_client).await?;
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
useless use of `format!`:
src/downloadable/markdown.rs#L320
error: useless use of `format!`
--> src/downloadable/markdown.rs:320:17
|
320 | format!("URL")
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"URL".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `#[deny(clippy::useless_format)]` implied by `#[deny(clippy::all)]`
|
this let-binding has unit value:
src/commands/eject.rs#L28
error: this let-binding has unit value
--> src/commands/eject.rs:28:9
|
28 | _ = fs::remove_dir_all(server.path.join("server"))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `fs::remove_dir_all(server.path.join("server"))?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
|
this let-binding has unit value:
src/commands/eject.rs#L24
error: this let-binding has unit value
--> src/commands/eject.rs:24:9
|
24 | _ = fs::remove_file(server.path.join("server.toml"))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `fs::remove_file(server.path.join("server.toml"))?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
= note: `#[deny(clippy::let_unit_value)]` implied by `#[deny(clippy::all)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/commands/init.rs#L314
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/commands/init.rs:314:37
|
314 | markdown::initialize_readme(&server).context("Initializing readme")?;
| ^^^^^^^ help: change this to: `server`
|
= 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/commands/init.rs#L244
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/commands/init.rs:244:45
|
244 | let latest_ver = fetch_latest_mcver(&http_client)
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/commands/init.rs#L167
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/commands/init.rs:167:45
|
167 | let latest_ver = fetch_latest_mcver(&http_client)
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= 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/commands/init.rs#L98
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/commands/init.rs:98:45
|
98 | let latest_ver = fetch_latest_mcver(&http_client)
| ^^^^^^^^^^^^ help: change this to: `http_client`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::needless_borrow)]` implied by `#[deny(clippy::all)]`
|
called `.collect::<Vec<String>>().join("")` on an iterator:
src/util/packwiz.rs#L809
warning: called `.collect::<Vec<String>>().join("")` on an iterator
--> src/util/packwiz.rs:809:10
|
809 | .collect::<Vec<_>>()
| __________^
810 | | .join("");
| |_________________^ help: try using: `collect::<String>()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
|
called `.collect::<Vec<String>>().join("")` on an iterator:
src/util/packwiz.rs#L780
warning: called `.collect::<Vec<String>>().join("")` on an iterator
--> src/util/packwiz.rs:780:10
|
780 | .collect::<Vec<_>>()
| __________^
781 | | .join("");
| |_________________^ help: try using: `collect::<String>()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
|
called `.collect::<Vec<String>>().join("")` on an iterator:
src/util/packwiz.rs#L761
warning: called `.collect::<Vec<String>>().join("")` on an iterator
--> src/util/packwiz.rs:761:10
|
761 | .collect::<Vec<_>>()
| __________^
762 | | .join("");
| |_________________^ help: try using: `collect::<String>()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
= note: `#[warn(clippy::unnecessary_join)]` implied by `#[warn(clippy::pedantic)]`
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/util/packwiz.rs#L724
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/util/packwiz.rs:724:31
|
724 | url: Some(url.to_owned()),
| ^^^^^^^^^^^^^^ help: consider using: `url.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/util/packwiz.rs#L626
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/util/packwiz.rs:626:38
|
626 | ... version: version.to_owned(),
| ^^^^^^^^^^^^^^^^^^ help: consider using: `version.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
= note: `#[warn(clippy::implicit_clone)]` implied by `#[warn(clippy::pedantic)]`
|
this function has too many lines (156/100):
src/util/packwiz.rs#L564
warning: this function has too many lines (156/100)
--> src/util/packwiz.rs:564:1
|
564 | / pub async fn dl_to_pw_mod(
565 | | dl: &Downloadable,
566 | | http_client: &reqwest::Client,
567 | | server: &Server,
... |
747 | | })
748 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
|
redundant closure:
src/util/packwiz.rs#L499
warning: redundant closure
--> src/util/packwiz.rs:499:18
|
499 | .map(|o| o.to_owned())
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::borrow::ToOwned::to_owned`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
= note: `#[warn(clippy::redundant_closure_for_method_calls)]` implied by `#[warn(clippy::pedantic)]`
|
called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead:
src/util/packwiz.rs#L498
warning: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
--> src/util/packwiz.rs:498:10
|
498 | Some(path.strip_suffix(".git")
| __________^
499 | | .map(|o| o.to_owned())
500 | | .unwrap_or(path))
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
= note: `#[warn(clippy::map_unwrap_or)]` implied by `#[warn(clippy::pedantic)]`
help: use `map_or(<a>, <f>)` instead
|
499 - .map(|o| o.to_owned())
499 + .map_or(path, |o| o.to_owned()))
|
|
this function has too many lines (119/100):
src/util/packwiz.rs#L321
warning: this function has too many lines (119/100)
--> src/util/packwiz.rs:321:1
|
321 | / pub async fn export_packwiz(
322 | | folder: &PathBuf,
323 | | http_client: &reqwest::Client,
324 | | server: &Server,
... |
472 | | Ok(())
473 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
|
this could be rewritten as `let...else`:
src/util/packwiz.rs#L239
warning: this could be rewritten as `let...else`
--> src/util/packwiz.rs:239:13
|
239 | / let dl = if let Some(dl) = pw_mod_to_dl(&m, http_client, server).await? {
240 | | dl
241 | | } else {
242 | | continue;
243 | | };
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
help: consider writing
|
239 ~ let Some(dl) = pw_mod_to_dl(&m, http_client, server).await? else {
240 + continue;
241 + };
|
|
this could be rewritten as `let...else`:
src/util/packwiz.rs#L99
warning: this could be rewritten as `let...else`
--> src/util/packwiz.rs:99:13
|
99 | / let dl = if let Some(dl) = pw_mod_to_dl(&m, http_client, server).await? {
100 | | dl
101 | | } else {
102 | | continue;
103 | | };
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
= note: `#[warn(clippy::manual_let_else)]` implied by `#[warn(clippy::pedantic)]`
help: consider writing
|
99 ~ let Some(dl) = pw_mod_to_dl(&m, http_client, server).await? else {
100 + continue;
101 + };
|
|
variables can be used directly in the `format!` string:
src/util/mrpack.rs#L531
warning: variables can be used directly in the `format!` string
--> src/util/mrpack.rs:531:31
|
531 | path: format!("mods/{}", filename),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
|
531 - path: format!("mods/{}", filename),
531 + path: format!("mods/{filename}"),
|
|
variables can be used directly in the `format!` string:
src/util/mrpack.rs#L423
warning: variables can be used directly in the `format!` string
--> src/util/mrpack.rs:423:31
|
423 | path: format!("mods/{}", filename),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `#[warn(clippy::uninlined_format_args)]` implied by `#[warn(clippy::pedantic)]`
help: change this to
|
423 - path: format!("mods/{}", filename),
423 + path: format!("mods/{filename}"),
|
|
this function has too many lines (276/100):
src/util/mrpack.rs#L316
warning: this function has too many lines (276/100)
--> src/util/mrpack.rs:316:1
|
316 | / pub async fn export_mrpack<W: std::io::Write + std::io::Seek>(
317 | | http_client: &reqwest::Client,
318 | | server: &Server,
319 | | summary: Option<String>,
... |
654 | | Ok(())
655 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
= note: `#[warn(clippy::too_many_lines)]` implied by `#[warn(clippy::pedantic)]`
|
unused `async` for function with no await statements:
src/commands/eject.rs#L16
warning: unused `async` for function with no await statements
--> src/commands/eject.rs:16:1
|
16 | / pub async fn run() -> Result<()> {
17 | | let server = Server::load().context("Failed to load server.toml")?;
18 | |
19 | | if Input::with_theme(&ColorfulTheme::default())
... |
34 | | Ok(())
35 | | }
| |_^
|
= help: consider removing the `async` from this function
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
note: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::unused_async)]` implied by `#[warn(clippy::pedantic)]`
|
unknown lint: `clippy::needless_pass_by_ref_mut`:
src/util/mrpack.rs#L133
warning: unknown lint: `clippy::needless_pass_by_ref_mut`
--> src/util/mrpack.rs:133:9
|
133 | #[allow(clippy::needless_pass_by_ref_mut)] // Yes it is used mutably, clippy.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::needless_pass_by_value`
|
= note: `#[warn(unknown_lints)]` on by default
|