Skip to content

Merge pull request #29 from trash-pandy/feature/clap-derive #78

Merge pull request #29 from trash-pandy/feature/clap-derive

Merge pull request #29 from trash-pandy/feature/clap-derive #78

Triggered via push September 12, 2023 03:26
Status Failure
Total duration 5m 52s
Artifacts 2

build.yml

on: push
Matrix: build
Fit to window
Zoom out
Zoom in

Annotations

12 errors and 26 warnings
name `CLI` contains a capitalized acronym: src/main.rs#L26
error: name `CLI` contains a capitalized acronym --> src/main.rs:26:8 | 26 | struct CLI { | ^^^ help: consider making the acronym lowercase, except the initial letter: `Cli` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms = note: `#[deny(clippy::upper_case_acronyms)]` implied by `#[deny(clippy::all)]`
needlessly taken reference of both operands: src/sources/hangar.rs#L38
error: needlessly taken reference of both operands --> src/sources/hangar.rs:38:23 | 38 | .find(|v| &v.name == &version) | ^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref = note: `#[deny(clippy::op_ref)]` implied by `#[deny(clippy::all)]` help: use the values directly | 38 | .find(|v| v.name == version) | ~~~~~~ ~~~~~~~
using `.iter().next()` on an array: src/sources/hangar.rs#L22
error: using `.iter().next()` on an array --> src/sources/hangar.rs:22:9 | 22 | / versions 23 | | .result 24 | | .iter() 25 | | .next() | |___________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_next_slice = note: `#[deny(clippy::iter_next_slice)]` implied by `#[deny(clippy::all)]` help: try calling | 22 ~ versions 23 + .result.first() |
writing `&PathBuf` instead of `&Path` involves a new object where a slice will do: src/model/lockfile/mod.rs#L54
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do --> src/model/lockfile/mod.rs:54:37 | 54 | pub fn get_lockfile(output_dir: &PathBuf) -> Result<Self> { | ^^^^^^^^ help: change this to: `&Path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `#[deny(clippy::ptr_arg)]` implied by `#[deny(clippy::all)]`
you are using an explicit closure for cloning elements: src/model/servertoml/mod.rs#L122
error: you are using an explicit closure for cloning elements --> src/model/servertoml/mod.rs:122:9 | 122 | / list.iter() 123 | | .filter(|v| { 124 | | is_proxy || v.game_versions.contains(mcver) 125 | | }) ... | 136 | | }) 137 | | .map(|v| v.clone()) | |___________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone = note: `#[deny(clippy::map_clone)]` implied by `#[deny(clippy::all)]` help: consider calling the dedicated `cloned` method | 122 ~ list.iter() 123 + .filter(|v| { 124 + is_proxy || v.game_versions.contains(mcver) 125 + }) 126 + .filter(|v| { 127 + if let Some(n) = &loader { 128 + v.loaders.iter().any(|l| l == "datapack" || l == n) 129 + } else { 130 + if is_vanilla { 131 + v.loaders.contains(&"datapack".to_owned()) 132 + } else { 133 + true 134 + } 135 + } 136 + }).cloned() |
useless use of `format!`: src/core/worlds.rs#L80
error: useless use of `format!` --> src/core/worlds.rs:80:29 | 80 | ).await.context(format!("Processing datapacks"))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Processing datapacks".to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
useless use of `format!`: src/core/worlds.rs#L68
error: useless use of `format!` --> src/core/worlds.rs:68:45 | 68 | spinner.finish_with_message(format!("Unzipped world successfully")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Unzipped world successfully".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)]`
useless use of `vec!`: src/core/bootstrap.rs#L78
error: useless use of `vec!` --> src/core/bootstrap.rs:78:30 | 78 | let bootstrap_exts = vec![ | ______________________________^ 79 | | "properties", "txt", "yaml", "yml", "conf", "config", "toml", "json", "json5", "secret" 80 | | ]; | |_________^ help: you can use an array directly: `["properties", "txt", "yaml", "yml", "conf", "config", "toml", "json", "json5", "secret"]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec = note: `#[deny(clippy::useless_vec)]` implied by `#[deny(clippy::all)]`
using `clone` on type `SystemTime` which implements the `Copy` trait: src/core/bootstrap.rs#L22
error: using `clone` on type `SystemTime` which implements the `Copy` trait --> src/core/bootstrap.rs:22:39 | 22 | .map(|e| (e.path.clone(), e.date.clone()))); | ^^^^^^^^^^^^^^ help: try removing the `clone` call: `e.date` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[deny(clippy::clone_on_copy)]` implied by `#[deny(clippy::all)]`
casting integer literal to `u16` is unnecessary: src/commands/init.rs#L158
error: casting integer literal to `u16` is unnecessary --> src/commands/init.rs:158:18 | 158 | .default(25565 as u16) | ^^^^^^^^^^^^ help: try: `25565_u16` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `#[deny(clippy::unnecessary_cast)]` implied by `#[deny(clippy::all)]`
this `else { if .. }` block can be collapsed: src/model/servertoml/mod.rs#L129
error: this `else { if .. }` block can be collapsed --> src/model/servertoml/mod.rs:129:20 | 129 | } else { | ____________________^ 130 | | if is_vanilla { 131 | | v.loaders.contains(&"datapack".to_owned()) 132 | | } else { 133 | | true 134 | | } 135 | | } | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if note: the lint level is defined here --> src/main.rs:1:9 | 1 | #![deny(clippy::all)] | ^^^^^^^^^^^ = note: `#[deny(clippy::collapsible_else_if)]` implied by `#[deny(clippy::all)]` help: collapse nested if block | 129 ~ } else if is_vanilla { 130 + v.loaders.contains(&"datapack".to_owned()) 131 + } else { 132 + true 133 + } |
clippy
Clippy had exited with the 101 exit code
empty String is being created manually: src/sources/modrinth.rs#L24
warning: empty String is being created manually --> src/sources/modrinth.rs:24:5 | 24 | String::from("") | ^^^^^^^^^^^^^^^^ help: consider using: `String::new()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new
implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type: src/model/lockfile/mod.rs#L119
warning: implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type --> src/model/lockfile/mod.rs:119:58 | 119 | changes.mods.push(Change::Removed((filename, removed_mod.to_owned().clone()))); | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `removed_mod.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type: src/model/lockfile/mod.rs#L114
warning: implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type --> src/model/lockfile/mod.rs:114:61 | 114 | changes.mods.push(Change::Added((String::new(), added_mod.to_owned().clone()))); | ^^^^^^^^^^^^^^^^^^^^ help: consider using: `added_mod.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
usage of `FromIterator::from_iter`: src/model/lockfile/mod.rs#L110
warning: usage of `FromIterator::from_iter` --> src/model/lockfile/mod.rs:110:60 | 110 | let lockfile_mods: HashMap<Downloadable, String> = HashMap::from_iter(self.mods | ____________________________________________________________^ 111 | | .iter().map(|(s, p)| (p.clone(), s.clone()))); | |_________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect help: use `.collect()` instead of `::from_iter()` | 110 ~ let lockfile_mods: HashMap<Downloadable, String> = self.mods 111 ~ .iter().map(|(s, p)| (p.clone(), s.clone())).collect::<HashMap<_, _>>(); |
usage of `FromIterator::from_iter`: src/model/lockfile/mod.rs#L106
warning: usage of `FromIterator::from_iter` --> src/model/lockfile/mod.rs:106:58 | 106 | let server_mods: HashMap<Downloadable, String> = HashMap::from_iter(server.mods | __________________________________________________________^ 107 | | .iter() 108 | | .map(|p| (p.clone(), String::new()))); | |_________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect help: use `.collect()` instead of `::from_iter()` | 106 ~ let server_mods: HashMap<Downloadable, String> = server.mods 107 + .iter() 108 + .map(|p| (p.clone(), String::new())).collect::<HashMap::from_iter(server.mods 109 + .iter() 110 ~ .map(|p| (p.clone(), String<_, _>>(); |
implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type: src/model/lockfile/mod.rs#L101
warning: implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type --> src/model/lockfile/mod.rs:101:61 | 101 | changes.plugins.push(Change::Removed((filename, removed_plugin.to_owned().clone()))); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `removed_plugin.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type: src/model/lockfile/mod.rs#L96
warning: implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type --> src/model/lockfile/mod.rs:96:64 | 96 | changes.plugins.push(Change::Added((String::new(), added_plugin.to_owned().clone()))); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `added_plugin.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
usage of `FromIterator::from_iter`: src/model/lockfile/mod.rs#L92
warning: usage of `FromIterator::from_iter` --> src/model/lockfile/mod.rs:92:63 | 92 | let lockfile_plugins: HashMap<Downloadable, String> = HashMap::from_iter(self.plugins | _______________________________________________________________^ 93 | | .iter().map(|(s, p)| (p.clone(), s.clone()))); | |_________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect help: use `.collect()` instead of `::from_iter()` | 92 ~ let lockfile_plugins: HashMap<Downloadable, String> = self.plugins 93 ~ .iter().map(|(s, p)| (p.clone(), s.clone())).collect::<HashMap<_, _>>(); |
usage of `FromIterator::from_iter`: src/model/lockfile/mod.rs#L88
warning: usage of `FromIterator::from_iter` --> src/model/lockfile/mod.rs:88:61 | 88 | let server_plugins: HashMap<Downloadable, String> = HashMap::from_iter(server.plugins | _____________________________________________________________^ 89 | | .iter() 90 | | .map(|p| (p.clone(), String::new()))); | |_________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect help: use `.collect()` instead of `::from_iter()` | 88 ~ let server_plugins: HashMap<Downloadable, String> = server.plugins 89 + .iter() 90 + .map(|p| (p.clone(), String::new())).collect::<HashMap::from_iter(server.plugins 91 + .iter() 92 ~ .map(|p| (p.clone(), String<_, _>>(); |
implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type: src/model/lockfile/mod.rs#L68
warning: implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type --> src/model/lockfile/mod.rs:68:19 | 68 | nw.path = path.to_owned(); | ^^^^^^^^^^^^^^^ help: consider using: `path.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
redundant closure: src/model/servertype/mod.rs#L304
warning: redundant closure --> src/model/servertype/mod.rs:304:15 | 304 | }.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
redundant closure: src/model/servertoml/mod.rs#L137
warning: redundant closure --> src/model/servertoml/mod.rs:137:14 | 137 | .map(|v| v.clone()) | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::clone::Clone::clone` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
boolean to int conversion using if: src/model/downloadable/import_url.rs#L395
warning: boolean to int conversion using if --> src/model/downloadable/import_url.rs:395:30 | 395 | .default(if url.path().starts_with("/job") { | ______________________________^ 396 | | 1 397 | | } else { 398 | | 0 399 | | }) | |_____________________^ help: replace with from: `usize::from(url.path().starts_with("/job"))` | = note: `url.path().starts_with("/job") as usize` or `url.path().starts_with("/job").into()` can also be valid options = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if = note: `#[warn(clippy::bool_to_int_with_if)]` implied by `#[warn(clippy::pedantic)]`
unused `self` argument: src/core/bootstrap.rs#L75
warning: unused `self` argument --> src/core/bootstrap.rs:75:34 | 75 | pub fn should_bootstrap_file(&self, path: &Path) -> bool { | ^^^^^ | = help: consider refactoring to an associated function = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self = note: `#[warn(clippy::unused_self)]` implied by `#[warn(clippy::pedantic)]`
usage of `FromIterator::from_iter`: src/core/bootstrap.rs#L21
warning: usage of `FromIterator::from_iter` --> src/core/bootstrap.rs:21:62 | 21 | let lockfile_entries: HashMap<PathBuf, SystemTime> = HashMap::from_iter(self.lockfile.files.iter() | ______________________________________________________________^ 22 | | .map(|e| (e.path.clone(), e.date.clone()))); | |_______________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect = note: `#[warn(clippy::from_iter_instead_of_collect)]` implied by `#[warn(clippy::pedantic)]` help: use `.collect()` instead of `::from_iter()` | 21 ~ let lockfile_entries: HashMap<PathBuf, SystemTime> = self.lockfile.files.iter() 22 ~ .map(|e| (e.path.clone(), e.date.clone())).collect::<HashMap<_, _>>(); |
redundant closure: src/core/addons.rs#L32
warning: redundant closure --> src/core/addons.rs:32:18 | 32 | .map(|c| c.inner()) | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `model::lockfile::Change::inner` | = 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/commands/world/unpack.rs#L56
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/commands/world/unpack.rs:56:22 | 56 | let world_name = zipfile | ______________________^ 57 | | .file_name() 58 | | .map(|o| o.to_string_lossy().into_owned()) 59 | | .unwrap_or("world".to_owned()); | |______________________________________^ | = 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 | 58 - .map(|o| o.to_string_lossy().into_owned()) 58 + .map_or("world".to_owned(), |o| o.to_string_lossy().into_owned()); |
case-sensitive file extension comparison: src/commands/world/unpack.rs#L19
warning: case-sensitive file extension comparison --> src/commands/world/unpack.rs:19:44 | 19 | server.path.join("worlds").join(if s.ends_with(".zip") { | ^^^^^^^^^^^^^^^^^^^ | = help: consider using a case-insensitive comparison instead = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#case_sensitive_file_extension_comparisons = note: `#[warn(clippy::case_sensitive_file_extension_comparisons)]` implied by `#[warn(clippy::pedantic)]` help: use std::path::Path | 19 ~ server.path.join("worlds").join(if std::path::Path::new(&s) 20 + .extension() 21 ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("zip")) { |
unused `async` for function with no await statements: src/commands/world/unpack.rs#L15
warning: unused `async` for function with no await statements --> src/commands/world/unpack.rs:15:1 | 15 | / pub async fn run(args: Args) -> Result<()> { 16 | | let server = Server::load().context("Failed to load server.toml")?; 17 | | 18 | | let zipfile = if let Some(s) = args.world { ... | 72 | | Ok(()) 73 | | } | |_^ | = 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
implicitly cloning a `String` by calling `to_owned` on its dereferenced type: src/commands/add/modrinth.rs#L22
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type --> src/commands/add/modrinth.rs:22:9 | 22 | s.to_owned() | ^^^^^^^^^^^^ help: consider using: `s.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 (131/100): src/commands/add/modrinth.rs#L17
warning: this function has too many lines (131/100) --> src/commands/add/modrinth.rs:17:1 | 17 | / pub async fn run(args: Args) -> Result<()> { 18 | | let mut server = Server::load().context("Failed to load server.toml")?; 19 | | let http_client = create_http_client()?; 20 | | ... | 168 | | Ok(()) 169 | | } | |_^ | = 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/init.rs#L155
warning: unused `async` for function with no await statements --> src/commands/init.rs:155:1 | 155 | / pub async fn init_network(_http_client: &reqwest::Client, name: &str) -> Result<()> { 156 | | let port = Input::with_theme(&ColorfulTheme::default()) 157 | | .with_prompt("Which port should the network be on?") 158 | | .default(25565 as u16) ... | 183 | | Ok(()) 184 | | } | |_^ | = 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: `#[warn(clippy::unused_async)]` implied by `#[warn(clippy::pedantic)]`
empty String is being created manually: src/commands/export/mrpack.rs#L45
warning: empty String is being created manually --> src/commands/export/mrpack.rs:45:31 | 45 | &version_id.unwrap_or("".to_string()), | ^^^^^^^^^^^^^^ help: consider using: `String::new()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new = note: `#[warn(clippy::manual_string_new)]` implied by `#[warn(clippy::pedantic)]`
this argument is passed by value, but not consumed in the function body: src/commands/env/mod.rs#L14
warning: this argument is passed by value, but not consumed in the function body --> src/commands/env/mod.rs:14:22 | 14 | pub fn run(commands: Commands) -> Result<()> { | ^^^^^^^^ help: consider taking a reference instead: `&Commands` | help: consider marking this type as `Copy` --> src/commands/env/mod.rs:7:1 | 7 | pub enum Commands { | ^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value = note: `#[warn(clippy::needless_pass_by_value)]` implied by `#[warn(clippy::pedantic)]`
struct constructor field order is inconsistent with struct definition field order: src/commands/build.rs#L40
warning: struct constructor field order is inconsistent with struct definition field order --> src/commands/build.rs:40:19 | 40 | let mut ctx = BuildContext { | ___________________^ 41 | | server, 42 | | network, 43 | | http_client, ... | 48 | | ..Default::default() 49 | | }; | |_____^ help: try: `BuildContext { server, network, http_client, output_dir, lockfile, force, skip_stages, ..Default::default() }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor note: the lint level is defined here --> src/main.rs:2:9 | 2 | #![warn(clippy::pedantic)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(clippy::inconsistent_struct_constructor)]` implied by `#[warn(clippy::pedantic)]`
clippy
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-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/

Artifacts

Produced during runtime
Name Size
mcman-ubuntu-latest Expired
7.83 MB
mcman-windows-latest Expired
9.07 MB