improve add mr #66
Annotations
3 errors and 5 warnings
you are using an explicit closure for cloning elements:
src/model/server.rs#L120
error: you are using an explicit closure for cloning elements
--> src/model/server.rs:120:9
|
120 | / list.iter()
121 | | .filter(|v| {
122 | | is_proxy || v.game_versions.contains(mcver)
123 | | })
... |
134 | | })
135 | | .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
|
120 ~ list.iter()
121 + .filter(|v| {
122 + is_proxy || v.game_versions.contains(mcver)
123 + })
124 + .filter(|v| {
125 + if let Some(n) = &loader {
126 + v.loaders.iter().any(|l| l == "datapack" || l == n)
127 + } else {
128 + if is_vanilla {
129 + v.loaders.contains(&"datapack".to_owned())
130 + } else {
131 + true
132 + }
133 + }
134 + }).cloned()
|
|
this `else { if .. }` block can be collapsed:
src/model/server.rs#L127
error: this `else { if .. }` block can be collapsed
--> src/model/server.rs:127:20
|
127 | } else {
| ____________________^
128 | | if is_vanilla {
129 | | v.loaders.contains(&"datapack".to_owned())
130 | | } else {
131 | | true
132 | | }
133 | | }
| |_____________^
|
= 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
|
127 ~ } else if is_vanilla {
128 + v.loaders.contains(&"datapack".to_owned())
129 + } else {
130 + true
131 + }
|
|
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/server.rs#L135
warning: redundant closure
--> src/model/server.rs:135:14
|
135 | .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)]`
|
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: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::implicit_clone)]` 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.11 MB |
|
mcman-windows-latest
Expired
|
8.45 MB |
|