basic worlds support #69
Annotations
6 errors and 12 warnings
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#L68
error: useless use of `vec!`
--> src/core/bootstrap.rs:68:30
|
68 | let bootstrap_exts = vec![
| ______________________________^
69 | | "properties", "txt", "yaml", "yml", "conf", "config", "toml", "json", "json5", "secret"
70 | | ];
| |_________^ 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)]`
|
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
= note: `#[warn(clippy::manual_string_new)]` implied by `#[warn(clippy::pedantic)]`
|
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
= note: `#[warn(clippy::redundant_closure_for_method_calls)]` implied by `#[warn(clippy::pedantic)]`
|
unused `self` argument:
src/core/bootstrap.rs#L65
warning: unused `self` argument
--> src/core/bootstrap.rs:65:34
|
65 | pub fn should_bootstrap_file(&self, source: &Path, _dest: &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)]`
|
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
= note: `#[warn(clippy::unused_async)]` implied by `#[warn(clippy::pedantic)]`
|
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: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::too_many_lines)]` implied by `#[warn(clippy::pedantic)]`
|
associated items `load_from` and `save` are never used:
src/model/lockfile/mod.rs#L29
warning: associated items `load_from` and `save` are never used
--> src/model/lockfile/mod.rs:29:12
|
28 | impl Lockfile {
| ------------- associated items in this implementation
29 | pub fn load_from(path: &PathBuf) -> Result<Self> {
| ^^^^^^^^^
...
39 | pub fn save(&self) -> Result<()> {
| ^^^^
|
associated items `load`, `load_from`, and `save` are never used:
src/model/network/mod.rs#L34
warning: associated items `load`, `load_from`, and `save` are never used
--> src/model/network/mod.rs:34:12
|
33 | impl Network {
| ------------ associated items in this implementation
34 | pub fn load() -> Result<Option<Self>> {
| ^^^^
...
53 | pub fn load_from(path: &PathBuf) -> Result<Self> {
| ^^^^^^^^^
...
63 | pub fn save(&self) -> Result<()> {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
|
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.45 MB |
|
mcman-windows-latest
Expired
|
8.53 MB |
|