Skip to content

dennis is big dum

dennis is big dum #58

GitHub Actions / clippy failed Sep 5, 2023 in 0s

clippy

10 errors, 23 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 10
Warning 23
Note 0
Help 0

Versions

  • rustc 1.72.0 (5680fa18f 2023-08-23)
  • cargo 1.72.0 (103a7ff2e 2023-08-15)
  • clippy 0.1.72 (5680fa1 2023-08-23)

Annotations

Check failure on line 38 in src/sources/hangar.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

needlessly taken reference of both operands

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)
   |                       ~~~~~~    ~~~~~~~

Check failure on line 25 in src/sources/hangar.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `.iter().next()` on an array

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()
   |

Check warning on line 24 in src/sources/modrinth.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty String is being created manually

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)]`

Check warning on line 119 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type

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

Check warning on line 114 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type

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

Check warning on line 111 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `FromIterator::from_iter`

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<_, _>>();
    |

Check warning on line 108 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `FromIterator::from_iter`

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<_, _>>();
    |

Check warning on line 101 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type

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

Check warning on line 96 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly cloning a `Downloadable` by calling `to_owned` on its dereferenced type

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

Check warning on line 93 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `FromIterator::from_iter`

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<_, _>>();
   |

Check warning on line 90 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `FromIterator::from_iter`

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<_, _>>();
   |

Check warning on line 68 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type

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

Check failure on line 54 in src/model/lockfile/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&PathBuf` instead of `&Path` involves a new object where a slice will do

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)]`

Check warning on line 304 in src/model/servertype/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

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

Check warning on line 137 in src/model/servertoml/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

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

Check failure on line 137 in src/model/servertoml/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you are using an explicit closure for cloning elements

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()
    |

Check warning on line 399 in src/model/downloadable/import_url.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

boolean to int conversion using if

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)]`

Check failure on line 80 in src/core/worlds.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

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

Check failure on line 68 in src/core/worlds.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

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)]`

Check failure on line 80 in src/core/bootstrap.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

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)]`

Check warning on line 75 in src/core/bootstrap.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `self` argument

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)]`

Check failure on line 22 in src/core/bootstrap.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `SystemTime` which implements the `Copy` trait

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)]`

Check warning on line 22 in src/core/bootstrap.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `FromIterator::from_iter`

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<_, _>>();
   |

Check warning on line 32 in src/core/addons.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

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)]`

Check warning on line 52 in src/commands/world/unpack.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead

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());
   |