dennis is big dum #58
Annotations
10 errors and 23 warnings
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#L153
error: casting integer literal to `u16` is unnecessary
--> src/commands/init.rs:153:18
|
153 | .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 + }
|
|
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
= note: `#[warn(clippy::manual_string_new)]` implied by `#[warn(clippy::pedantic)]`
|
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#L49
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:49:22
|
49 | let world_name = zipfile
| ______________________^
50 | | .file_name()
51 | | .map(|o| o.to_string_lossy().into_owned())
52 | | .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
|
51 - .map(|o| o.to_string_lossy().into_owned())
51 + .map_or("world".to_owned(), |o| o.to_string_lossy().into_owned());
|
|
case-sensitive file extension comparison:
src/commands/world/unpack.rs#L23
warning: case-sensitive file extension comparison
--> src/commands/world/unpack.rs:23:44
|
23 | server.path.join("worlds").join(if s.ends_with(".zip") { s.clone() } else { format!("{s}.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
|
23 ~ server.path.join("worlds").join(if std::path::Path::new(s)
24 + .extension()
25 ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("zip")) { s.clone() } else { format!("{s}.zip") })
|
|
unused `async` for function with no await statements:
src/commands/world/unpack.rs#L19
warning: unused `async` for function with no await statements
--> src/commands/world/unpack.rs:19:1
|
19 | / pub async fn run(matches: &ArgMatches) -> Result<()> {
20 | | let server = Server::load().context("Failed to load server.toml")?;
21 | |
22 | | let zipfile = if let Some(s) = matches.get_one::<String>("world") {
... |
65 | | Ok(())
66 | | }
| |_^
|
= 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#L23
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/commands/add/modrinth.rs:23:9
|
23 | 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 (110/100):
src/commands/add/modrinth.rs#L18
warning: this function has too many lines (110/100)
--> src/commands/add/modrinth.rs:18:1
|
18 | / pub async fn run(matches: &ArgMatches) -> Result<()> {
19 | | let mut server = Server::load().context("Failed to load server.toml")?;
20 | | let http_client = create_http_client()?;
21 | |
... |
148 | | Ok(())
149 | | }
| |_^
|
= 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#L150
warning: unused `async` for function with no await statements
--> src/commands/init.rs:150:1
|
150 | / pub async fn init_network(_http_client: &reqwest::Client, name: &str) -> Result<()> {
151 | | let port = Input::with_theme(&ColorfulTheme::default())
152 | | .with_prompt("Which port should the network be on?")
153 | | .default(25565 as u16)
... |
178 | | Ok(())
179 | | }
| |_^
|
= 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)]`
|
struct constructor field order is inconsistent with struct definition field order:
src/commands/build.rs#L41
warning: struct constructor field order is inconsistent with struct definition field order
--> src/commands/build.rs:41:19
|
41 | let mut ctx = BuildContext {
| ___________________^
42 | | server,
43 | | network,
44 | | http_client,
... |
49 | | ..Default::default()
50 | | };
| |_____^ 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)]`
|