network stuff and fix util semver fn #93
Annotations
61 errors and 112 warnings
build (ubuntu-latest)
Process completed with exit code 101.
|
build (windows-latest)
The job was canceled because "ubuntu-latest" failed.
|
build (windows-latest)
The operation was canceled.
|
name `CLI` contains a capitalized acronym:
src/main.rs#L30
error: name `CLI` contains a capitalized acronym
--> src/main.rs:30:8
|
30 | 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)]`
|
using `clone` on type `SystemTime` which implements the `Copy` trait:
src/hot_reload/mod.rs#L327
error: using `clone` on type `SystemTime` which implements the `Copy` trait
--> src/hot_reload/mod.rs:327:50
|
327 | ... .max_by_key(|(_, t)| t.clone())
| ^^^^^^^^^ help: try dereferencing it: `*t`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
useless conversion to the same type: `std::fs::ReadDir`:
src/hot_reload/mod.rs#L323
error: useless conversion to the same type: `std::fs::ReadDir`
--> src/hot_reload/mod.rs:323:48
|
323 | let (report_path, _) = folder.read_dir()?
| ________________________________________________^
324 | | .into_iter()
| |________________________________________^ help: consider removing `.into_iter()`: `folder.read_dir()?`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[deny(clippy::useless_conversion)]` implied by `#[deny(clippy::all)]`
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/hot_reload/mod.rs#L299
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/hot_reload/mod.rs:299:17
|
299 | / match test_result {
300 | | TestResult::Crashed => {
301 | | println!(
302 | | " - Server crashed"
... |
305 | | _ => {}
306 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[deny(clippy::single_match)]` implied by `#[deny(clippy::all)]`
help: try
|
299 ~ if let TestResult::Crashed = test_result {
300 + println!(
301 + " - Server crashed"
302 + );
303 + }
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/hot_reload/mod.rs#L80
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/hot_reload/mod.rs:80:25
|
80 | &self.builder.app,
| ^^^^^^^^^^^^^^^^^ help: change this to: `self.builder.app`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
question mark operator is useless here:
src/hot_reload/pattern_serde.rs#L9
error: question mark operator is useless here
--> src/hot_reload/pattern_serde.rs:9:5
|
9 | / Ok(Pattern::new(&String::deserialize(de)?)
10 | | .map_err(serde::de::Error::custom)?)
| |________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
help: try removing question mark and `Ok()`
|
9 ~ Pattern::new(&String::deserialize(de)?)
10 + .map_err(serde::de::Error::custom)
|
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/hot_reload/config.rs#L33
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/hot_reload/config.rs:33:1
|
33 | impl Into<String> for HotReloadAction {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<hot_reload::config::HotReloadAction>`
|
33 ~ impl From<HotReloadAction> for String {
34 ~ fn from(val: HotReloadAction) -> Self {
35 ~ match val {
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/interop/packwiz.rs#L179
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/interop/packwiz.rs:179:42
|
179 | let resolved = dl.resolve_source(&self.0).await?;
| ^^^^^^^ help: change this to: `self.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
useless use of `format!`:
src/interop/packwiz.rs#L170
error: useless use of `format!`
--> src/interop/packwiz.rs:170:29
|
170 | self.0.warn(format!("unknown mod update"))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"unknown mod update".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
methods called `from_*` usually take no `self`:
src/interop/packwiz.rs#L156
error: methods called `from_*` usually take no `self`
--> src/interop/packwiz.rs:156:28
|
156 | pub fn from_mod_update(&self, mod_update: &Option<ModUpdate>) -> Result<Option<Downloadable>> {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
|
methods called `from_*` usually take no `self`:
src/interop/packwiz.rs#L139
error: methods called `from_*` usually take no `self`
--> src/interop/packwiz.rs:139:28
|
139 | pub async fn from_hash(&self, down: &ModDownload) -> Result<Option<Downloadable>> {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
|
methods called `from_*` usually take no `self`:
src/interop/packwiz.rs#L125
error: methods called `from_*` usually take no `self`
--> src/interop/packwiz.rs:125:27
|
125 | pub async fn from_mod(&self, m: &Mod) -> Result<Downloadable> {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[deny(clippy::wrong_self_convention)]` implied by `#[deny(clippy::all)]`
|
single-character string constant used as pattern:
src/util/mod.rs#L70
error: single-character string constant used as pattern
--> src/util/mod.rs:70:33
|
70 | let folder = folder.replace(" ", "-");
| ^^^ help: try using a `char` instead: `' '`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/util/mod.rs#L68
error: single-character string constant used as pattern
--> src/util/mod.rs:68:33
|
68 | let folder = folder.replace("/", " ");
| ^^^ help: try using a `char` instead: `'/'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
returning the result of a `let` binding from a block:
src/util/mod.rs#L71
error: returning the result of a `let` binding from a block
--> src/util/mod.rs:71:5
|
70 | let folder = folder.replace(" ", "-");
| -------------------------------------- unnecessary `let` binding
71 | folder
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[deny(clippy::let_and_return)]` implied by `#[deny(clippy::all)]`
help: return the expression directly
|
70 ~
71 ~ folder.replace(" ", "-")
|
|
use of `unwrap_or` to construct default value:
src/util/env.rs#L49
error: use of `unwrap_or` to construct default value
--> src/util/env.rs:49:56
|
49 | let contents = fs::read_to_string(&gitignore_path).unwrap_or(String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[deny(clippy::unwrap_or_default)]` implied by `#[deny(clippy::all)]`
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/sources/mclogs.rs#L53
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/sources/mclogs.rs:53:1
|
53 | impl<T> Into<Result<T>> for MaybeSuccess<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
= note: `#[deny(clippy::from_over_into)]` implied by `#[deny(clippy::all)]`
help: replace the `Into` implementation with `From<sources::mclogs::MaybeSuccess<T>>`
|
53 ~ impl<T> From<MaybeSuccess<T>> for Result<T> {
54 ~ fn from(val: MaybeSuccess<T>) -> Self {
55 ~ match val {
|
|
needlessly taken reference of both operands:
src/sources/hangar.rs#L41
error: needlessly taken reference of both operands
--> src/sources/hangar.rs:41:27
|
41 | .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
|
41 | .find(|v| v.name == version)
| ~~~~~~ ~~~~~~~
|
using `.iter().next()` on an array:
src/sources/hangar.rs#L23
error: using `.iter().next()` on an array
--> src/sources/hangar.rs:23:13
|
23 | / versions
24 | | .result
25 | | .iter()
26 | | .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
|
23 ~ versions
24 + .result.first()
|
|
comparison to empty slice:
src/sources/modrinth.rs#L173
error: comparison to empty slice
--> src/sources/modrinth.rs:173:71
|
173 | self.fetch_api(&format!("{API_URL}/version_file/{hash}{}", if algo == "" || algo == "sha1" {
| ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `algo.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
= note: `#[deny(clippy::comparison_to_empty)]` implied by `#[deny(clippy::all)]`
|
single-character string constant used as pattern:
src/sources/maven.rs#L120
error: single-character string constant used as pattern
--> src/sources/maven.rs:120:30
|
120 | group_id.replace(".", "/"),
| ^^^ help: try using a `char` instead: `'.'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/sources/jenkins.rs#L30
error: single-character string constant used as pattern
--> src/sources/jenkins.rs:30:33
|
30 | let folder = folder.replace(" ", "-");
| ^^^ help: try using a `char` instead: `' '`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/sources/jenkins.rs#L28
error: single-character string constant used as pattern
--> src/sources/jenkins.rs:28:33
|
28 | let folder = folder.replace("/", " ");
| ^^^ help: try using a `char` instead: `'/'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
= note: `#[deny(clippy::single_char_pattern)]` implied by `#[deny(clippy::all)]`
|
question mark operator is useless here:
src/sources/github.rs#L148
error: question mark operator is useless here
--> src/sources/github.rs:148:9
|
148 | / Ok(
149 | | self.fetch_api::<Vec<GithubRelease>>(
150 | | format!("{API_URL}/repos/{repo}/releases"),
151 | | format!("{repo}/releases.json")
152 | | ).await?
153 | | )
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
= note: `#[deny(clippy::needless_question_mark)]` implied by `#[deny(clippy::all)]`
help: try removing question mark and `Ok()`
|
148 ~ self.fetch_api::<Vec<GithubRelease>>(
149 + format!("{API_URL}/repos/{repo}/releases"),
150 + format!("{repo}/releases.json")
151 + ).await
|
|
this if-let expression is unnecessary:
src/sources/github.rs#L89
error: this if-let expression is unnecessary
--> src/sources/github.rs:89:13
|
89 | / if let Some(json) = cache.try_get_json::<CachedData<T>>(&cache_path)? {
90 | | Some(json)
91 | | } else {
92 | | None
93 | | }
| |_____________^ help: replace it with: `cache.try_get_json::<CachedData<T>>(&cache_path)?`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_match
= note: `#[deny(clippy::needless_match)]` implied by `#[deny(clippy::all)]`
|
manual implementation of `Option::map`:
src/sources/github.rs#L89
error: manual implementation of `Option::map`
--> src/sources/github.rs:89:13
|
89 | / if let Some(json) = cache.try_get_json::<CachedData<T>>(&cache_path)? {
90 | | Some(json)
91 | | } else {
92 | | None
93 | | }
| |_____________^ help: try: `cache.try_get_json::<CachedData<T>>(&cache_path)?.map(|json| json)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
|
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)]`
|
useless use of `format!`:
src/model/servertype/mod.rs#L319
error: useless use of `format!`
--> src/model/servertype/mod.rs:319:44
|
319 | ServerType::BungeeCord { } => format!("BungeeCord"),
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"BungeeCord".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
src/model/servertype/mod.rs#L318
error: useless use of `format!`
--> src/model/servertype/mod.rs:318:43
|
318 | ServerType::Waterfall { } => format!("Waterfall"),
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Waterfall".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
src/model/servertype/mod.rs#L317
error: useless use of `format!`
--> src/model/servertype/mod.rs:317:42
|
317 | ServerType::Velocity { } => format!("Velocity"),
| ^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Velocity".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
src/model/servertype/mod.rs#L316
error: useless use of `format!`
--> src/model/servertype/mod.rs:316:39
|
316 | ServerType::Paper { } => format!("Paper"),
| ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Paper".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
you are using an explicit closure for cloning elements:
src/model/servertoml/mod.rs#L119
error: you are using an explicit closure for cloning elements
--> src/model/servertoml/mod.rs:119:9
|
119 | / list.iter()
120 | | .filter(|v| {
121 | | is_proxy || v.game_versions.contains(mcver)
122 | | })
... |
133 | | })
134 | | .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
|
119 ~ list.iter()
120 + .filter(|v| {
121 + is_proxy || v.game_versions.contains(mcver)
122 + })
123 + .filter(|v| {
124 + if let Some(n) = &loader {
125 + v.loaders.iter().any(|l| l == "datapack" || l == n || (l == "fabric" && n == "quilt"))
126 + } else {
127 + if is_vanilla {
128 + v.loaders.contains(&"datapack".to_owned())
129 + } else {
130 + true
131 + }
132 + }
133 + }).cloned()
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/app/mod.rs#L220
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/app/mod.rs:220:47
|
220 | crate::interop::markdown::MarkdownAPI(&self)
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
matching on `Some` with `ok()` is redundant:
src/app/mod.rs#L146
error: matching on `Some` with `ok()` is redundant
--> src/app/mod.rs:146:18
|
146 | k => if let Some(v) = std::env::var(k).ok() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_result_ok
= note: `#[deny(clippy::match_result_ok)]` implied by `#[deny(clippy::all)]`
help: consider matching on `Ok(v)` and removing the call to `ok` instead
|
146 | k => if let Ok(v) = std::env::var(k) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
manual implementation of `Option::map`:
src/app/mod.rs#L127
error: manual implementation of `Option::map`
--> src/app/mod.rs:127:17
|
127 | / if let Some(nw) = &self.network {
128 | | Some("# generated by mcman\nservers:".to_owned() + &nw.servers.iter().map(|(name, serv)|
129 | | format!(
130 | | " {name}:\n motd: {}\n address: {}:{}\n restricted: false",
... |
140 | | None
141 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
help: try
|
127 ~ self.network.as_ref().map(|nw| "# generated by mcman\nservers:".to_owned() + &nw.servers.iter().map(|(name, serv)|
128 + format!(
129 + " {name}:\n motd: {}\n address: {}:{}\n restricted: false",
130 + self.var("MOTD").unwrap_or("a mcman-powered server".to_owned()),
131 + std::env::var(format!("IP_{name}")).ok()
132 + .or(serv.ip_address.clone())
133 + .unwrap_or("127.0.0.1".to_owned()),
134 + std::env::var(format!("PORT_{name}")).ok()
135 + .unwrap_or(serv.port.to_string()),
136 + )
137 + ).collect::<Vec<_>>().join("\n"))
|
|
manual implementation of `Option::map`:
src/app/mod.rs#L110
error: manual implementation of `Option::map`
--> src/app/mod.rs:110:17
|
110 | / if let Some(nw) = &self.network {
111 | | Some("# generated by mcman\n".to_owned() + &nw.servers.iter().map(|(name, serv)|
112 | | format!(
113 | | "{name} = \"{}:{}\"",
... |
122 | | None
123 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
help: try
|
110 ~ self.network.as_ref().map(|nw| "# generated by mcman\n".to_owned() + &nw.servers.iter().map(|(name, serv)|
111 + format!(
112 + "{name} = \"{}:{}\"",
113 + std::env::var(format!("IP_{name}")).ok()
114 + .or(serv.ip_address.clone())
115 + .unwrap_or("127.0.0.1".to_owned()),
116 + std::env::var(format!("PORT_{name}")).ok()
117 + .unwrap_or(serv.port.to_string()),
118 + )
119 + ).collect::<Vec<_>>().join("\n"))
|
|
useless use of `vec!`:
src/app/from_string.rs#L242
error: useless use of `vec!`
--> src/app/from_string.rs:242:54
|
242 | let selection = self.select(&urlstr, &vec![
| ______________________________________________________^
243 | | SelectItem(0, "Add as Custom URL".to_owned()),
244 | | SelectItem(1, "Add as Jenkins".to_owned()),
245 | | ])?;
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
help: you can use a slice directly
|
242 ~ let selection = self.select(&urlstr, &[SelectItem(0, "Add as Custom URL".to_owned()),
243 ~ SelectItem(1, "Add as Jenkins".to_owned())])?;
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/app/from_string.rs#L242
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/app/from_string.rs:242:45
|
242 | let selection = self.select(&urlstr, &vec![
| ^^^^^^^ help: change this to: `urlstr`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
manual implementation of `Option::map`:
src/app/downloading.rs#L65
error: manual implementation of `Option::map`
--> src/app/downloading.rs:65:17
|
65 | / if let Some(cache) = self.get_cache(namespace) {
66 | | Some((cache.path(path), cache.exists(path)))
67 | | } else {
68 | | None
69 | | }
| |_________________^ help: try: `self.get_cache(namespace).map(|cache| (cache.path(path), cache.exists(path)))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[deny(clippy::manual_map)]` implied by `#[deny(clippy::all)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/app/downloading.rs#L46
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/app/downloading.rs:46:50
|
46 | let resolved = resolvable.resolve_source(&self).await
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
the borrowed expression implements the required traits:
src/core/mod.rs#L132
error: the borrowed expression implements the required traits
--> src/core/mod.rs:132:34
|
132 | self.output_dir.join(&folder_path),
| ^^^^^^^^^^^^ help: change this to: `folder_path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/core/mod.rs#L69
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/core/mod.rs:69:66
|
69 | let startup = self.app.server.jar.get_startup_method(&self.app, &server_jar).await?;
| ^^^^^^^^^ help: change this to: `self.app`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
useless use of `format!`:
src/core/worlds.rs#L70
error: useless use of `format!`
--> src/core/worlds.rs:70:29
|
70 | ).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#L58
error: useless use of `format!`
--> src/core/worlds.rs:58:45
|
58 | 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)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/core/serverjar.rs#L25
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/core/serverjar.rs:25:33
|
25 | .get_install_method(&self.app)
| ^^^^^^^^^ help: change this to: `self.app`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
useless use of `vec!`:
src/core/bootstrap.rs#L84
error: useless use of `vec!`
--> src/core/bootstrap.rs:84:30
|
84 | let bootstrap_exts = vec![
| ______________________________^
85 | | "properties", "txt", "yaml", "yml", "conf", "config", "toml", "json", "json5", "secret"
86 | | ];
| |_________^ 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#L27
error: using `clone` on type `SystemTime` which implements the `Copy` trait
--> src/core/bootstrap.rs:27:39
|
27 | .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)]`
|
the borrowed expression implements the required traits:
src/commands/init/mod.rs#L118
error: the borrowed expression implements the required traits
--> src/commands/init/mod.rs:118:48
|
118 | let path = tmp_dir.path().join(&resolved.filename);
| ^^^^^^^^^^^^^^^^^^ help: change this to: `resolved.filename`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
casting integer literal to `u16` is unnecessary:
src/commands/init/network.rs#L12
error: casting integer literal to `u16` is unnecessary
--> src/commands/init/network.rs:12:18
|
12 | .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)]`
|
module has the same name as its containing module:
src/commands/init/mod.rs#L20
error: module has the same name as its containing module
--> src/commands/init/mod.rs:20:1
|
20 | pub mod init;
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
= note: `#[deny(clippy::module_inception)]` implied by `#[deny(clippy::all)]`
|
the borrowed expression implements the required traits:
src/commands/import/mrpack.rs#L24
error: the borrowed expression implements the required traits
--> src/commands/import/mrpack.rs:24:40
|
24 | let path = tmp_dir.path().join(&resolved.filename);
| ^^^^^^^^^^^^^^^^^^ help: change this to: `resolved.filename`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/commands/build.rs#L34
error: this expression creates a reference which is immediately dereferenced by the compiler
--> src/commands/build.rs:34:18
|
34 | app: &app,
| ^^^^ help: change this to: `app`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[deny(clippy::needless_borrow)]` implied by `#[deny(clippy::all)]`
|
private type `sources::purpur::PurpurMCBuild` in public interface:
src/sources/purpur.rs#L34
error[E0446]: private type `sources::purpur::PurpurMCBuild` in public interface
--> src/sources/purpur.rs:34:5
|
34 | pub async fn fetch_build(&self, version: &str, build: &str) -> Result<PurpurMCBuild> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
...
83 | struct PurpurMCBuild {
| -------------------- `sources::purpur::PurpurMCBuild` declared as private
|
private type `sources::purpur::PurpurMCBuilds` in public interface:
src/sources/purpur.rs#L30
error[E0446]: private type `sources::purpur::PurpurMCBuilds` in public interface
--> src/sources/purpur.rs:30:5
|
30 | pub async fn fetch_builds(&self, version: &str) -> Result<PurpurMCBuilds> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
...
77 | struct PurpurMCBuilds {
| --------------------- `sources::purpur::PurpurMCBuilds` declared as private
|
this `else { if .. }` block can be collapsed:
src/hot_reload/mod.rs#L290
error: this `else { if .. }` block can be collapsed
--> src/hot_reload/mod.rs:290:28
|
290 | } else {
| ____________________________^
291 | | if !status.success() {
292 | | println!(
293 | | " - Process didn't exit successfully"
294 | | );
295 | | }
296 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
|
290 ~ } else if !status.success() {
291 + println!(
292 + " - Process didn't exit successfully"
293 + );
294 + }
|
|
this `else { if .. }` block can be collapsed:
src/model/servertoml/mod.rs#L126
error: this `else { if .. }` block can be collapsed
--> src/model/servertoml/mod.rs:126:20
|
126 | } else {
| ____________________^
127 | | if is_vanilla {
128 | | v.loaders.contains(&"datapack".to_owned())
129 | | } else {
130 | | true
131 | | }
132 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
|
126 ~ } else if is_vanilla {
127 + v.loaders.contains(&"datapack".to_owned())
128 + } else {
129 + true
130 + }
|
|
this `else { if .. }` block can be collapsed:
src/app/mod.rs#L148
error: this `else { if .. }` block can be collapsed
--> src/app/mod.rs:148:20
|
148 | } else {
| ____________________^
149 | | if k.starts_with("NW_") {
150 | | if let Some(nw) = &self.network {
151 | | if k.starts_with("NW_SERVER_") {
... |
179 | | }
180 | | }
| |_____________^
|
= 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
|
148 ~ } else if k.starts_with("NW_") {
149 + if let Some(nw) = &self.network {
150 + if k.starts_with("NW_SERVER_") {
151 + let (name, ty) = k.strip_prefix("NW_SERVER_")
152 + .unwrap()
153 + .split_once('_')?;
154 +
155 + let serv = nw.servers.get(&name.to_lowercase())?;
156 +
157 + let ip = std::env::var(format!("IP_{name}")).ok()
158 + .or(serv.ip_address.clone())
159 + .unwrap_or("127.0.0.1".to_owned());
160 +
161 + let port = std::env::var(format!("PORT_{name}")).ok()
162 + .unwrap_or(serv.port.to_string());
163 +
164 + match ty.to_lowercase().as_str() {
165 + "ip" => Some(ip),
166 + "port" => Some(port),
167 + "address" => Some(format!("{ip}:{port}")),
168 + _ => None,
169 + }
170 + } else {
171 + nw.variables.get(k.strip_prefix("NW_").unwrap()).cloned()
172 + }
173 + } else {
174 + None
175 + }
176 + } else {
177 + self.server.variables.get(k).cloned()
178 + }
|
|
clippy
Clippy had exited with the 101 exit code
|
unused `async` for function with no await statements:
src/interop/packwiz.rs#L186
warning: unused `async` for function with no await statements
--> src/interop/packwiz.rs:186:5
|
186 | / pub async fn resolved_to_mod(&self, resolved_file: &ResolvedFile) -> Result<Mod> {
187 | | let hash = App::get_best_hash(&resolved_file.hashes);
188 | |
189 | | let (hash_format, hash) = match hash {
... |
214 | | })
215 | | }
| |_____^
|
= 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
|
unused `async` for function with no await statements:
src/commands/cache.rs#L25
warning: unused `async` for function with no await statements
--> src/commands/cache.rs:25:1
|
25 | / pub async fn run(commands: Commands) -> Result<()> {
26 | | let Some(cache_folder) = Cache::cache_root() else {
27 | | bail!("Cache directory was missing, maybe it's disabled?");
28 | | };
... |
98 | | Ok(())
99 | | }
| |_^
|
= 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
|
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(app: App, args: Args) -> Result<()> {
16 | | let zipfile = if let Some(s) = args.world {
17 | | app.server.path.join("worlds").join(if s.ends_with(".zip") {
18 | | s.clone()
... |
71 | | Ok(())
72 | | }
| |_^
|
= 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
|
unused `async` for function with no await statements:
src/commands/add/modrinth.rs#L16
warning: unused `async` for function with no await statements
--> src/commands/add/modrinth.rs:16:1
|
16 | / pub async fn run(mut app: App, args: Args) -> Result<()> {
17 | | let query = if let Some(s) = args.search {
18 | | s.to_owned()
19 | | } else {
... |
165 | | Ok(())
166 | | }
| |_^
|
= 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
|
unused `async` for function with no await statements:
src/commands/export/packwiz.rs#L17
warning: unused `async` for function with no await statements
--> src/commands/export/packwiz.rs:17:1
|
17 | / pub async fn run(app: App, args: Args) -> Result<()> {
18 | | let default_output = app.server.path.join("pack");
19 | | let output_dir = args.output.unwrap_or(default_output);
20 | |
... |
25 | | Ok(())
26 | | }
| |_^
|
= 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)]`
|
this argument is passed by value, but not consumed in the function body:
src/hot_reload/mod.rs#L368
warning: this argument is passed by value, but not consumed in the function body
--> src/hot_reload/mod.rs:368:14
|
368 | _tx: mpsc::Sender<Command>,
| ^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&mpsc::Sender<Command>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
redundant closure:
src/hot_reload/mod.rs#L325
warning: redundant closure
--> src/hot_reload/mod.rs:325:41
|
325 | ... .filter_map(|f| f.ok())
| ^^^^^^^^^^ help: replace the closure with the method itself: `std::result::Result::ok`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
|
consider adding a `;` to the last statement for consistent formatting:
src/hot_reload/mod.rs#L228
warning: consider adding a `;` to the last statement for consistent formatting
--> src/hot_reload/mod.rs:228:25
|
228 | / println!(
229 | | "{}{s}",
230 | | style("| ").bold()
231 | | )
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
help: add a `;` here
|
228 ~ println!(
229 + "{}{s}",
230 + style("| ").bold()
231 + );
|
|
matching over `()` is more explicit:
src/hot_reload/mod.rs#L190
warning: matching over `()` is more explicit
--> src/hot_reload/mod.rs:190:36
|
190 | ... Ok(_) => {},
| ^ help: use `()` instead of `_`: `()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
|
matching over `()` is more explicit:
src/hot_reload/mod.rs#L161
warning: matching over `()` is more explicit
--> src/hot_reload/mod.rs:161:37
|
161 | ... _ = tokio::time::sleep(Duration::from_secs(30)) => {
| ^ help: use `()` instead of `_`: `()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
|
matching over `()` is more explicit:
src/hot_reload/mod.rs#L141
warning: matching over `()` is more explicit
--> src/hot_reload/mod.rs:141:37
|
141 | ... _ = async {
| ^ help: use `()` instead of `_`: `()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
= note: `#[warn(clippy::ignored_unit_patterns)]` implied by `#[warn(clippy::pedantic)]`
|
consider adding a `;` to the last statement for consistent formatting:
src/hot_reload/mod.rs#L146
warning: consider adding a `;` to the last statement for consistent formatting
--> src/hot_reload/mod.rs:146:53
|
146 | / ... println!(
147 | | ... "{}{}",
148 | | ... style("| ").bold(),
149 | | ... line.trim()
150 | | ... )
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
help: add a `;` here
|
146 ~ println!(
147 + "{}{}",
148 + style("| ").bold(),
149 + line.trim()
150 + );
|
|
this function has too many lines (235/100):
src/hot_reload/mod.rs#L93
warning: this function has too many lines (235/100)
--> src/hot_reload/mod.rs:93:5
|
93 | / async fn handle_commands(mut self, mut rx: mpsc::Receiver<Command>, mut tx: mpsc::Sender<Command>) -> Result<()> {
94 | | let mp = self.builder.app.multi_progress.clone();
95 | |
96 | | let mut child: Option<Child> = None;
... |
362 | | Ok(())
363 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
|
implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type:
src/hot_reload/config.rs#L73
warning: implicitly cloning a `PathBuf` by calling `to_owned` on its dereferenced type
--> src/hot_reload/config.rs:73:18
|
73 | h.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
|
consider adding a `;` to the last statement for consistent formatting:
src/interop/markdown.rs#L41
warning: consider adding a `;` to the last statement for consistent formatting
--> src/interop/markdown.rs:41:17
|
41 | / content = re.replace_all(&content, |_caps: ®ex::Captures| {
42 | | format!("<!--start:mcman-{id}-->\n{}\n<!--end:mcman-{id}-->", table.render())
43 | | }).to_string()
| |______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
help: add a `;` here
|
41 ~ content = re.replace_all(&content, |_caps: ®ex::Captures| {
42 + format!("<!--start:mcman-{id}-->\n{}\n<!--end:mcman-{id}-->", table.render())
43 + }).to_string();
|
|
this match arm has an identical body to the `_` wildcard arm:
src/interop/packwiz.rs#L207
warning: this match arm has an identical body to the `_` wildcard arm
--> src/interop/packwiz.rs:207:21
|
207 | "md5" => HashFormat::Md5,
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the arm
|
= help: or try changing either arm body
note: `_` wildcard arm here
--> src/interop/packwiz.rs:209:21
|
209 | _ => HashFormat::Md5,
| ^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
|
this could be rewritten as `let...else`:
src/interop/packwiz.rs#L189
warning: this could be rewritten as `let...else`
--> src/interop/packwiz.rs:189:9
|
189 | / let (hash_format, hash) = match hash {
190 | | Some(t) => t,
191 | | None => {
192 | | // TODO calculate hash manually (by cached file or download it and compute)
193 | | todo!()
194 | | }
195 | | };
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
= note: `#[warn(clippy::manual_let_else)]` implied by `#[warn(clippy::pedantic)]`
help: consider writing
|
189 ~ let Some((hash_format, hash)) = hash else {
190 + // TODO calculate hash manually (by cached file or download it and compute)
191 + todo!()
192 + };
|
|
unnecessary boolean `not` operation:
src/interop/packwiz.rs#L140
warning: unnecessary boolean `not` operation
--> src/interop/packwiz.rs:140:9
|
140 | / if !down.hash.is_empty() {
141 | | let fmt = match down.hash_format {
142 | | HashFormat::Sha512 => "sha512",
143 | | HashFormat::Sha1 => "sha1",
... |
152 | | Ok(None)
153 | | }
| |_________^
|
= help: remove the `!` and swap the blocks of the `if`/`else`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
= note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`
|
this function's return value is unnecessarily wrapped by `Result`:
src/interop/mrpack.rs#L222
warning: this function's return value is unnecessarily wrapped by `Result`
--> src/interop/mrpack.rs:222:5
|
222 | / pub fn get_files(&self) -> Result<HashMap<String, String>> {
223 | | let mut map = HashMap::new();
224 | |
225 | | for filename in self.0.file_names() {
... |
245 | | Ok(map)
246 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
222 | pub fn get_files(&self) -> std::collections::HashMap<std::string::String, std::string::String> {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
245 | map
|
|
casting `i64` to `u64` may lose the sign of the value:
src/sources/hangar.rs#L88
warning: casting `i64` to `u64` may lose the sign of the value
--> src/sources/hangar.rs:88:24
|
88 | size: Some(download.get_file_info().size_bytes as u64),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
= note: `#[warn(clippy::cast_sign_loss)]` implied by `#[warn(clippy::pedantic)]`
|
empty String is being created manually:
src/sources/modrinth.rs#L174
warning: empty String is being created manually
--> src/sources/modrinth.rs:174:13
|
174 | "".to_owned()
| ^^^^^^^^^^^^^ help: consider using: `String::new()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/sources/modrinth.rs#L133
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/sources/modrinth.rs:133:28
|
133 | let version_data = match match ver.as_str() {
| ____________________________^
134 | | "latest" => versions.first(),
135 | | ver => versions.iter().find(|v| v.id == ver || v.name == ver || v.version_number == ver)
136 | | } {
... |
145 | | }
146 | | };
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
133 ~ let version_data = if let Some(v) = match ver.as_str() {
134 + "latest" => versions.first(),
135 + ver => versions.iter().find(|v| v.id == ver || v.name == ver || v.version_number == ver)
136 + } { v.clone() } else {
137 + let v = match ver.as_str() {
138 + "latest" => all_versions.first(),
139 + ver => all_versions.iter().find(|v| v.id == ver || v.name == ver || v.version_number == ver)
140 + }.ok_or(anyhow!("Couln't find version '{ver}' ('{version}') for Modrinth project '{id}'"))?.clone();
141 + self.0.warn(format!("Filtering failed for modrinth.com/mod/{id}/version/{ver}"))?;
142 + v
143 ~ };
|
|
empty String is being created manually:
src/sources/modrinth.rs#L26
warning: empty String is being created manually
--> src/sources/modrinth.rs:26:5
|
26 | 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 `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#L266
warning: redundant closure
--> src/model/servertype/mod.rs:266:15
|
266 | }.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#L134
warning: redundant closure
--> src/model/servertoml/mod.rs:134:14
|
134 | .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
|
this match arm has an identical body to another arm:
src/model/downloadable/markdown.rs#L79
warning: this match arm has an identical body to another arm
--> src/model/downloadable/markdown.rs:79:13
|
79 | Self::Modrinth { id, version } | Self::CurseRinth { id, version } | Self::Hangar { id, version } => {
| ^-----------------------------------------------------------------------------------------------
| |
| _____________help: try merging the arm patterns: `Self::Modrinth { id, version } | Self::CurseRinth { id, version } | Self::Hangar { id, version } | Self::Spigot { id, version }`
| |
80 | | map.insert("Project/URL".to_owned(), id.clone());
81 | | map.insert("Version/Release".to_owned(), version.clone());
82 | | }
| |_____________^
|
= help: or try changing either arm body
note: other arm here
--> src/model/downloadable/markdown.rs:84:13
|
84 | / Self::Spigot { id, version } => {
85 | | map.insert("Project/URL".to_owned(), id.clone());
86 | | map.insert("Version/Release".to_owned(), version.clone());
87 | | }
| |_____________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
= note: `#[warn(clippy::match_same_arms)]` implied by `#[warn(clippy::pedantic)]`
|
unused `self` argument:
src/app/mod.rs#L184
warning: unused `self` argument
--> src/app/mod.rs:184:22
|
184 | pub fn get_cache(&self, ns: &str) -> Option<Cache> {
| ^^^^^
|
= help: consider refactoring to an associated function
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
|
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
src/app/mod.rs#L33
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/app/mod.rs:33:19
|
33 | pub fn folder(&self) -> String {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
= note: `#[warn(clippy::trivially_copy_pass_by_ref)]` implied by `#[warn(clippy::pedantic)]`
|
this function's return value is unnecessary:
src/app/feedback.rs#L48
warning: this function's return value is unnecessary
--> src/app/feedback.rs:48:5
|
48 | / pub fn print_job(&self, job: &str) -> Result<()> {
49 | | Ok(self.multi_progress.suspend(|| println!(
50 | | "{} {}",
51 | | ColorfulTheme::default().active_item_prefix,
52 | | style(job).cyan().bold()
53 | | )))
54 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove the return type...
|
48 | pub fn print_job(&self, job: &str) -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
49 - Ok(self.multi_progress.suspend(|| println!(
50 - "{} {}",
51 - ColorfulTheme::default().active_item_prefix,
52 - style(job).cyan().bold()
53 - )))
49 +
|
|
this function's return value is unnecessary:
src/app/feedback.rs#L40
warning: this function's return value is unnecessary
--> src/app/feedback.rs:40:5
|
40 | / pub fn dbg<S: std::fmt::Display>(&self, message: S) -> Result<()> {
41 | | Ok(self.multi_progress.suspend(|| println!(
42 | | " {} {}",
43 | | style("[dbg]").dim(),
44 | | style(message).dim()
45 | | )))
46 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove the return type...
|
40 | pub fn dbg<S: std::fmt::Display>(&self, message: S) -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
41 - Ok(self.multi_progress.suspend(|| println!(
42 - " {} {}",
43 - style("[dbg]").dim(),
44 - style(message).dim()
45 - )))
41 +
|
|
this function's return value is unnecessary:
src/app/feedback.rs#L33
warning: this function's return value is unnecessary
--> src/app/feedback.rs:33:5
|
33 | / pub fn log<S: std::fmt::Display>(&self, message: S) -> Result<()> {
34 | | Ok(self.multi_progress.suspend(|| println!(
35 | | " {}",
36 | | style(message).dim()
37 | | )))
38 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove the return type...
|
33 | pub fn log<S: std::fmt::Display>(&self, message: S) -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
34 - Ok(self.multi_progress.suspend(|| println!(
35 - " {}",
36 - style(message).dim()
37 - )))
34 +
|
|
this function's return value is unnecessary:
src/app/feedback.rs#L24
warning: this function's return value is unnecessary
--> src/app/feedback.rs:24:5
|
24 | / pub fn info<S: std::fmt::Display>(&self, message: S) -> Result<()> {
25 | | Ok(self.multi_progress.suspend(||
26 | | println!(
27 | | " {} {message}",
... |
30 | | ))
31 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove the return type...
|
24 | pub fn info<S: std::fmt::Display>(&self, message: S) -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
25 - Ok(self.multi_progress.suspend(||
26 - println!(
27 - " {} {message}",
28 - style("🛈 Info").bold()
29 - )
30 - ))
25 +
|
|
this function's return value is unnecessary:
src/app/feedback.rs#L17
warning: this function's return value is unnecessary
--> src/app/feedback.rs:17:5
|
17 | / pub fn success<S: std::fmt::Display>(&self, message: S) -> Result<()> {
18 | | Ok(self.multi_progress.suspend(|| println!(
19 | | " {} {message}",
20 | | ColorfulTheme::default().success_prefix
21 | | )))
22 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
= note: `#[warn(clippy::unnecessary_wraps)]` implied by `#[warn(clippy::pedantic)]`
help: remove the return type...
|
17 | pub fn success<S: std::fmt::Display>(&self, message: S) -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
18 - Ok(self.multi_progress.suspend(|| println!(
19 - " {} {message}",
20 - ColorfulTheme::default().success_prefix
21 - )))
18 +
|
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L227
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:227:66
|
227 | ... SelectItem(Some(a.name.clone()), a.name.to_owned())
| ^^^^^^^^^^^^^^^^^ help: consider using: `a.name.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/from_string.rs#L213
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/from_string.rs:213:29
|
213 | let asset = match asset {
| _____________________________^
214 | | Some(a) => a,
215 | | None => {
216 | | let rel = self.github().fetch_release(&repo, &tag).await?;
... |
235 | | }
236 | | };
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
213 ~ let asset = if let Some(a) = asset { a } else {
214 + let rel = self.github().fetch_release(&repo, &tag).await?;
215 +
216 + if rel.assets.len() <= 1 {
217 + "first".to_owned()
218 + } else {
219 + match self.select("Which asset to use?", &vec![
220 + SelectItem(Some("first".to_owned()), format!(
221 + "Use the first asset ('{}' for '{}')",
222 + rel.assets[0].name, rel.tag_name
223 + ))
224 + ].into_iter().chain(rel.assets.iter().map(|a| {
225 + SelectItem(Some(a.name.clone()), a.name.to_owned())
226 + })).chain(vec![
227 + SelectItem(None, "Set manually".to_string())
228 + ]).collect::<Vec<_>>())? {
229 + Some(a) => a,
230 + None => self.prompt_string("Enter asset name")?,
231 + }
232 + }
233 ~ };
|
|
calling `to_string` on `&&str`:
src/app/from_string.rs#L186
warning: calling `to_string` on `&&str`
--> src/app/from_string.rs:186:26
|
186 | (tag.to_string(), match filename {
| ^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*tag).to_string()`
|
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/from_string.rs#L183
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/from_string.rs:183:36
|
183 | let (tag, asset) = match rest {
| ____________________________________^
184 | | ["releases", "tag" | "download", tag, filename @ ..] => {
185 | |
186 | | (tag.to_string(), match filename {
... |
210 | | }
211 | | };
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
183 ~ let (tag, asset) = if let ["releases", "tag" | "download", tag, filename @ ..] = rest {
184 +
185 + (tag.to_string(), match filename {
186 + [f] => Some(f.replace(tag, "${tag}")),
187 + _ => None,
188 + })
189 + } else {
190 + let releases = self.github().fetch_releases(&repo).await?;
191 +
192 + let version = self.select("Select a release", &vec![
193 + SelectItem("latest".to_owned(), "Always use latest release".to_owned())
194 + ].into_iter().chain(releases.iter().map(|r| {
195 + SelectItem(r.tag_name.clone(), if r.tag_name == r.name {
196 + r.name.clone()
197 + } else {
198 + format!(
199 + "[{}] {}",
200 + r.tag_name,
201 + r.name
202 + )
203 + })
204 + })).collect::<Vec<_>>())?;
205 +
206 + (version, None)
207 ~ };
|
|
calling `to_string` on `&&str`:
src/app/from_string.rs#L176
warning: calling `to_string` on `&&str`
--> src/app/from_string.rs:176:47
|
176 | Ok(Downloadable::Spigot { id: id.to_string(), version: "latest".to_owned() })
| ^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*id).to_string()`
|
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L170
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:170:30
|
170 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^ help: consider using: `version.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L170
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:170:30
|
170 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `version.to_owned().clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L169
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:169:25
|
169 | id: id.to_owned().to_owned(),
| ^^^^^^^^^^^^^ help: consider using: `id.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L169
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:169:25
|
169 | id: id.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `id.to_owned().clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
calling `to_string` on `&&str`:
src/app/from_string.rs#L144
warning: calling `to_string` on `&&str`
--> src/app/from_string.rs:144:33
|
144 | [_, ver] => ver.to_string(),
| ^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*ver).to_string()`
|
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/from_string.rs#L143
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/from_string.rs:143:31
|
143 | let version = match rest {
| _______________________________^
144 | | [_, ver] => ver.to_string(),
145 | | _ => {
146 | | let (versions, _) = self.curserinth().fetch_versions(&id).await?;
... |
165 | | }
166 | | };
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
143 ~ let version = if let [_, ver] = rest { ver.to_string() } else {
144 + let (versions, _) = self.curserinth().fetch_versions(&id).await?;
145 +
146 + if versions.is_empty() {
147 + bail!("No compatible versions found");
148 + }
149 +
150 + let version = self.select("Select a version", &versions.iter().map(|v| {
151 + SelectItem(v.clone(), if v.version_number == v.name {
152 + v.version_number.clone()
153 + } else {
154 + format!(
155 + "[{}] {}",
156 + v.version_number,
157 + v.name,
158 + )
159 + })
160 + }).collect::<Vec<_>>())?;
161 +
162 + version.id.clone()
163 ~ };
|
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L135
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:135:30
|
135 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^ help: consider using: `version.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L135
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:135:30
|
135 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `version.to_owned().clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
calling `to_string` on `&&str`:
src/app/from_string.rs#L109
warning: calling `to_string` on `&&str`
--> src/app/from_string.rs:109:39
|
109 | ["version", v] => v.to_string(),
| ^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*v).to_string()`
|
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/from_string.rs#L108
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/from_string.rs:108:31
|
108 | let version = match rest {
| _______________________________^
109 | | ["version", v] => v.to_string(),
110 | | _ => {
111 | | let (versions, _) = self.curserinth().fetch_versions(id).await?;
... |
130 | | }
131 | | };
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
108 ~ let version = if let ["version", v] = rest { v.to_string() } else {
109 + let (versions, _) = self.curserinth().fetch_versions(id).await?;
110 +
111 + if versions.is_empty() {
112 + bail!("No compatible versions found");
113 + }
114 +
115 + let version = self.select("Select a version", &versions.iter().map(|v| {
116 + SelectItem(v.clone(), if v.version_number == v.name {
117 + v.version_number.clone()
118 + } else {
119 + format!(
120 + "[{}] {}",
121 + v.version_number,
122 + v.name,
123 + )
124 + })
125 + }).collect::<Vec<_>>())?;
126 +
127 + version.id.clone()
128 ~ };
|
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L103
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:103:30
|
103 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^ help: consider using: `version.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/app/from_string.rs#L103
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/app/from_string.rs:103:30
|
103 | version: version.to_owned().to_owned(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `version.to_owned().clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
|
calling `to_string` on `&&str`:
src/app/from_string.rs#L77
warning: calling `to_string` on `&&str`
--> src/app/from_string.rs:77:39
|
77 | ["version", v] => v.to_string(),
| ^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*v).to_string()`
|
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
= note: `#[warn(clippy::inefficient_to_string)]` implied by `#[warn(clippy::pedantic)]`
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/app/from_string.rs#L76
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/app/from_string.rs:76:31
|
76 | let version = match rest {
| _______________________________^
77 | | ["version", v] => v.to_string(),
78 | | _ => {
79 | | let versions = self.modrinth().fetch_versions(id).await?;
... |
98 | | }
99 | | };
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
help: try
|
76 ~ let version = if let ["version", v] = rest { v.to_string() } else {
77 + let versions = self.modrinth().fetch_versions(id).await?;
78 +
79 + if versions.is_empty() {
80 + bail!("No compatible versions found");
81 + }
82 +
83 + let version = self.select("Select a version", &versions.iter().map(|v| {
84 + SelectItem(v.clone(), if v.version_number == v.name {
85 + v.version_number.clone()
86 + } else {
87 + format!(
88 + "[{}] {}",
89 + v.version_number,
90 + v.name,
91 + )
92 + })
93 + }).collect::<Vec<_>>())?;
94 +
95 + version.id.clone()
96 ~ };
|
|
redundant closure:
src/app/from_string.rs#L66
warning: redundant closure
--> src/app/from_string.rs:66:54
|
66 | match (url.domain(), url.path_segments().map(|x| x.collect::<Vec<_>>()).unwrap_or_default().as_slice()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::iter::Iterator::collect`
|
= 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)]`
|
this function has too many lines (210/100):
src/app/from_string.rs#L60
warning: this function has too many lines (210/100)
--> src/app/from_string.rs:60:5
|
60 | / pub async fn dl_from_url(
61 | | &self,
62 | | urlstr: &str
63 | | ) -> Result<Downloadable> {
... |
313 | | }
314 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
|
this function has too many lines (196/100):
src/app/downloading.rs#L52
warning: this function has too many lines (196/100)
--> src/app/downloading.rs:52:5
|
52 | / pub async fn download_resolved(
53 | | &self,
54 | | resolved: ResolvedFile,
55 | | destination: PathBuf,
... |
308 | | Ok(resolved)
309 | | }
| |_____^
|
= 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)]`
|
consider adding a `;` to the last statement for consistent formatting:
src/app/downloading.rs#L29
warning: consider adding a `;` to the last statement for consistent formatting
--> src/app/downloading.rs:29:13
|
29 | self.1()
| ^^^^^^^^ help: add a `;` here: `self.1();`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
= note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`
|
item in documentation is missing backticks:
src/core/mod.rs#L109
warning: item in documentation is missing backticks
--> src/core/mod.rs:109:14
|
109 | /// Save new_lockfile
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
109 | /// Save `new_lockfile`
| ~~~~~~~~~~~~~~
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/core/mod.rs#L92
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/core/mod.rs:92:25
|
92 | self.lockfile = match Lockfile::get_lockfile(&self.output_dir) {
| _________________________^
93 | | Ok(f) => f,
94 | | Err(_) => {
95 | | self.app.warn("Lockfile error, using default")?;
... |
100 | | },
101 | | };
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
= note: `#[warn(clippy::single_match_else)]` implied by `#[warn(clippy::pedantic)]`
help: try
|
92 ~ self.lockfile = if let Ok(f) = Lockfile::get_lockfile(&self.output_dir) { f } else {
93 + self.app.warn("Lockfile error, using default")?;
94 + Lockfile {
95 + path: self.output_dir.join(".mcman.lock"),
96 + ..Default::default()
97 + }
98 ~ };
|
|
item in documentation is missing backticks:
src/core/mod.rs#L90
warning: item in documentation is missing backticks
--> src/core/mod.rs:90:59
|
90 | /// Load to self.lockfile and create a default one at self.new_lockfile
| ^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: `#[warn(clippy::doc_markdown)]` implied by `#[warn(clippy::pedantic)]`
help: try
|
90 | /// Load to self.lockfile and create a default one at `self.new_lockfile`
| ~~~~~~~~~~~~~~~~~~~
|
unused `self` argument:
src/core/bootstrap.rs#L81
warning: unused `self` argument
--> src/core/bootstrap.rs:81:34
|
81 | 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#L26
warning: usage of `FromIterator::from_iter`
--> src/core/bootstrap.rs:26:62
|
26 | let lockfile_entries: HashMap<PathBuf, SystemTime> = HashMap::from_iter(self.lockfile.files.iter()
| ______________________________________________________________^
27 | | .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
help: use `.collect()` instead of `::from_iter()`
|
26 ~ let lockfile_entries: HashMap<PathBuf, SystemTime> = self.lockfile.files.iter()
27 ~ .map(|e| (e.path.clone(), e.date.clone())).collect::<HashMap<_, _>>();
|
|
usage of `FromIterator::from_iter`:
src/core/addons.rs#L45
warning: usage of `FromIterator::from_iter`
--> src/core/addons.rs:45:30
|
45 | let existing_files = HashSet::from_iter(match addon_type {
| ______________________________^
46 | | AddonType::Plugin => self.lockfile.plugins.iter(),
47 | | AddonType::Mod => self.lockfile.mods.iter(),
48 | | }.map(|(_, res)| res.filename.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()`
|
45 ~ let existing_files = match addon_type {
46 + AddonType::Plugin => self.lockfile.plugins.iter(),
47 + AddonType::Mod => self.lockfile.mods.iter(),
48 + }.map(|(_, res)| res.filename.clone()).collect::<HashSet::from_iter(match addon_type {
49 + AddonType::Plugin => self.lockfile.plugins.iter(),
50 ~ AddonType<_>>();
|
|
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#L55
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:55:22
|
55 | let world_name = zipfile
| ______________________^
56 | | .file_name()
57 | | .map(|o| o.to_string_lossy().into_owned())
58 | | .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
|
57 - .map(|o| o.to_string_lossy().into_owned())
57 + .map_or("world".to_owned(), |o| o.to_string_lossy().into_owned());
|
|
case-sensitive file extension comparison:
src/commands/world/unpack.rs#L17
warning: case-sensitive file extension comparison
--> src/commands/world/unpack.rs:17:48
|
17 | app.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
|
17 ~ app.server.path.join("worlds").join(if std::path::Path::new(&s)
18 + .extension()
19 ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("zip")) {
|
|
implicitly cloning a `String` by calling `to_owned` on its dereferenced type:
src/commands/add/modrinth.rs#L18
warning: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
--> src/commands/add/modrinth.rs:18:9
|
18 | 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 argument is passed by value, but not consumed in the function body:
src/commands/pull.rs#L19
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/pull.rs:19:17
|
19 | pub fn run(app: App, args: Args) -> Result<()> {
| ^^^ help: consider taking a reference instead: `&App`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
src/commands/info.rs#L7
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/info.rs:7:17
|
7 | pub fn run(app: App) -> Result<()> {
| ^^^ help: consider taking a reference instead: `&App`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
src/commands/env/mod.rs#L16
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/env/mod.rs:16:32
|
16 | pub fn run(app: App, commands: Commands) -> Result<()> {
| ^^^^^^^^ help: consider taking a reference instead: `&Commands`
|
help: consider marking this type as `Copy`
--> src/commands/env/mod.rs:9:1
|
9 | pub enum Commands {
| ^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
src/commands/env/gitignore.rs#L5
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/env/gitignore.rs:5:17
|
5 | pub fn run(app: App) -> Result<()> {
| ^^^ help: consider taking a reference instead: `&App`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
src/commands/env/docker.rs#L9
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/env/docker.rs:9:17
|
9 | pub fn run(app: App) -> Result<()> {
| ^^^ help: consider taking a reference instead: `&App`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
src/commands/eject.rs#L10
warning: this argument is passed by value, but not consumed in the function body
--> src/commands/eject.rs:10:17
|
10 | pub fn run(app: App) -> Result<()> {
| ^^^ help: consider taking a reference instead: `&App`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
note: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::needless_pass_by_value)]` implied by `#[warn(clippy::pedantic)]`
|
variant `Failed` is never constructed:
src/hot_reload/mod.rs#L55
warning: variant `Failed` is never constructed
--> src/hot_reload/mod.rs:55:5
|
52 | pub enum TestResult {
| ---------- variant in this enum
...
55 | Failed,
| ^^^^^^
|
variant `Stop` is never constructed:
src/hot_reload/mod.rs#L30
warning: variant `Stop` is never constructed
--> src/hot_reload/mod.rs:30:5
|
28 | pub enum Command {
| ------- variant in this enum
29 | Start,
30 | Stop,
| ^^^^
|
methods `to_mod` and `resolved_to_mod` are never used:
src/interop/packwiz.rs#L178
warning: methods `to_mod` and `resolved_to_mod` are never used
--> src/interop/packwiz.rs:178:18
|
39 | impl<'a> PackwizInterop<'a> {
| --------------------------- methods in this implementation
...
178 | pub async fn to_mod(&self, dl: &Downloadable) -> Result<Mod> {
| ^^^^^^
...
186 | pub async fn resolved_to_mod(&self, resolved_file: &ResolvedFile) -> Result<Mod> {
| ^^^^^^^^^^^^^^^
|
function `get_docker_version` is never used:
src/util/env.rs#L102
warning: function `get_docker_version` is never used
--> src/util/env.rs:102:8
|
102 | pub fn get_docker_version() -> Result<Option<String>> {
| ^^^^^^^^^^^^^^^^^^
|
function `get_git_branch` is never used:
src/util/env.rs#L82
warning: function `get_git_branch` is never used
--> src/util/env.rs:82:8
|
82 | pub fn get_git_branch() -> Result<Option<String>> {
| ^^^^^^^^^^^^^^
|
function `get_git_remote` is never used:
src/util/env.rs#L34
warning: function `get_git_remote` is never used
--> src/util/env.rs:34:8
|
34 | pub fn get_git_remote() -> Result<Option<String>> {
| ^^^^^^^^^^^^^^
|
function `try_get_url` is never used:
src/util/env.rs#L10
warning: function `try_get_url` is never used
--> src/util/env.rs:10:8
|
10 | pub fn try_get_url(folder: &PathBuf) -> Result<String> {
| ^^^^^^^^^^^
|
method `fetch_insights` is never used:
src/sources/mclogs.rs#L29
warning: method `fetch_insights` is never used
--> src/sources/mclogs.rs:29:18
|
12 | impl<'a> MCLogsAPI<'a> {
| ---------------------- method in this implementation
...
29 | pub async fn fetch_insights(&self, id: &str) -> Result<LogInsights> {
| ^^^^^^^^^^^^^^
|
method `fetch_versions` is never used:
src/sources/spigot.rs#L53
warning: method `fetch_versions` is never used
--> src/sources/spigot.rs:53:18
|
21 | impl<'a> SpigotAPI<'a> {
| ---------------------- method in this implementation
...
53 | pub async fn fetch_versions(&self, id: &str) -> Result<Vec<SpigotVersion>> {
| ^^^^^^^^^^^^^^
|
method `fetch_versions` is never used:
src/sources/purpur.rs#L26
warning: method `fetch_versions` is never used
--> src/sources/purpur.rs:26:18
|
13 | impl<'a> PurpurAPI<'a> {
| ---------------------- method in this implementation
...
26 | pub async fn fetch_versions(&self) -> Result<Vec<String>> {
| ^^^^^^^^^^^^^^
|
methods `fetch_api` and `fetch_versions` are never used:
src/sources/papermc.rs#L14
warning: methods `fetch_api` and `fetch_versions` are never used
--> src/sources/papermc.rs:14:18
|
13 | impl<'a> PaperMCAPI<'a> {
| ----------------------- methods in this implementation
14 | pub async fn fetch_api<T: DeserializeOwned + Clone + Serialize>(
| ^^^^^^^^^
...
31 | pub async fn fetch_versions(&self, project: &str) -> Result<Vec<String>> {
| ^^^^^^^^^^^^^^
|
method `search` is never used:
src/sources/modrinth.rs#L162
warning: method `search` is never used
--> src/sources/modrinth.rs:162:18
|
105 | impl<'a> ModrinthAPI<'a> {
| ------------------------ method in this implementation
...
162 | pub async fn search(&self, query: &str) -> Result<Vec<ModrinthProject>> {
| ^^^^^^
|
function `get_jenkins_download_url` is never used:
src/sources/jenkins.rs#L153
warning: function `get_jenkins_download_url` is never used
--> src/sources/jenkins.rs:153:14
|
153 | pub async fn get_jenkins_download_url(
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
method `inner` is never used:
src/model/lockfile/mod.rs#L39
warning: method `inner` is never used
--> src/model/lockfile/mod.rs:39:12
|
38 | impl<T> Change<T> {
| ----------------- method in this implementation
39 | pub fn inner(&self) -> &T {
| ^^^^^
|
variants `Added` and `Removed` are never constructed:
src/model/lockfile/mod.rs#L34
warning: variants `Added` and `Removed` are never constructed
--> src/model/lockfile/mod.rs:34:5
|
33 | pub enum Change<T> {
| ------ variants in this enum
34 | Added(T),
| ^^^^^
35 | Removed(T),
| ^^^^^^^
|
= note: `Change` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
|
method `get_type_name` is never used:
src/model/servertype/meta.rs#L6
warning: method `get_type_name` is never used
--> src/model/servertype/meta.rs:6:12
|
5 | impl ServerType {
| --------------- method in this implementation
6 | pub fn get_type_name(&self) -> String {
| ^^^^^^^^^^^^^
|
method `get_modrinth_facets` is never used:
src/model/servertype/mod.rs#L237
warning: method `get_modrinth_facets` is never used
--> src/model/servertype/mod.rs:237:12
|
98 | impl ServerType {
| --------------- method in this implementation
...
237 | pub fn get_modrinth_facets(&self, mcver: &str) -> Result<String> {
| ^^^^^^^^^^^^^^^^^^^
|
method `add_datapack` is never used:
src/model/servertoml/interactive.rs#L9
warning: method `add_datapack` is never used
--> src/model/servertoml/interactive.rs:9:12
|
8 | impl Server {
| ----------- method in this implementation
9 | pub fn add_datapack(&mut self, dl: Downloadable) -> Result<String> {
| ^^^^^^^^^^^^
|
associated function `hash_sha256` is never used:
src/app/hashing.rs#L18
warning: associated function `hash_sha256` is never used
--> src/app/hashing.rs:18:12
|
8 | impl App {
| -------- associated function in this implementation
...
18 | pub fn hash_sha256(contents: &str) -> String {
| ^^^^^^^^^^^
|
function `initialize_readme` is never used:
src/commands/markdown.rs#L31
warning: function `initialize_readme` is never used
--> src/commands/markdown.rs:31:8
|
31 | pub fn initialize_readme(server: &Server) -> Result<()> {
| ^^^^^^^^^^^^^^^^^
|
function `initialize_environment` is never used:
src/commands/init/mod.rs#L174
warning: function `initialize_environment` is never used
--> src/commands/init/mod.rs:174:8
|
174 | pub fn initialize_environment(is_proxy: bool) -> Result<()> {
| ^^^^^^^^^^^^^^^^^^^^^^
|
function `init_final` is never used:
src/commands/init/mod.rs#L132
warning: function `init_final` is never used
--> src/commands/init/mod.rs:132:14
|
132 | pub async fn init_final(
| ^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
variable `skipped` is assigned to, but never used:
src/commands/pull.rs#L28
warning: variable `skipped` is assigned to, but never used
--> src/commands/pull.rs:28:13
|
28 | let mut skipped = 0;
| ^^^^^^^
|
= note: consider using `_skipped` instead
|
unused variable: `query`:
src/commands/add/modrinth.rs#L17
warning: unused variable: `query`
--> src/commands/add/modrinth.rs:17:9
|
17 | let query = if let Some(s) = args.search {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_query`
|
unreachable expression:
src/commands/add/modrinth.rs#L165
warning: unreachable expression
--> src/commands/add/modrinth.rs:165:5
|
23 | todo!();
| ------- any code following this expression is unreachable
...
165 | Ok(())
| ^^^^^^ unreachable expression
|
unused variable: `cf_usecdn`:
src/commands/export/packwiz.rs#L21
warning: unused variable: `cf_usecdn`
--> src/commands/export/packwiz.rs:21:9
|
21 | let cf_usecdn = args.cfcdn;
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_cf_usecdn`
|
unused variable: `output_dir`:
src/commands/export/packwiz.rs#L19
warning: unused variable: `output_dir`
--> src/commands/export/packwiz.rs:19:9
|
19 | let output_dir = args.output.unwrap_or(default_output);
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_output_dir`
|
= note: `#[warn(unused_variables)]` on by default
|
unreachable expression:
src/commands/export/packwiz.rs#L25
warning: unreachable expression
--> src/commands/export/packwiz.rs:25:5
|
23 | todo!();
| ------- any code following this expression is unreachable
24 |
25 | Ok(())
| ^^^^^^ unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default
|
unused imports: `Downloadable`, `Server`, `SoftwareType`, `sources::modrinth`, `util::SelectItem`:
src/commands/add/modrinth.rs#L6
warning: unused imports: `Downloadable`, `Server`, `SoftwareType`, `sources::modrinth`, `util::SelectItem`
--> src/commands/add/modrinth.rs:6:13
|
6 | model::{Downloadable, Server, SoftwareType},
| ^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^
7 | sources::modrinth,
| ^^^^^^^^^^^^^^^^^
8 | util::SelectItem, app::App,
| ^^^^^^^^^^^^^^^^
|
unused imports: `Input`, `Select`, `theme::ColorfulTheme`:
src/commands/add/modrinth.rs#L3
warning: unused imports: `Input`, `Select`, `theme::ColorfulTheme`
--> src/commands/add/modrinth.rs:3:17
|
3 | use dialoguer::{theme::ColorfulTheme, Input, Select};
| ^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^^^
|
unused import: `console::style`:
src/commands/add/modrinth.rs#L2
warning: unused import: `console::style`
--> src/commands/add/modrinth.rs:2:5
|
2 | use console::style;
| ^^^^^^^^^^^^^^
|
unused imports: `Context`, `bail`:
src/commands/add/modrinth.rs#L1
warning: unused imports: `Context`, `bail`
--> src/commands/add/modrinth.rs:1:14
|
1 | use anyhow::{bail, Context, Result};
| ^^^^ ^^^^^^^
|
unused imports: `Downloadable`, `Server`:
src/commands/import/datapack.rs#L6
warning: unused imports: `Downloadable`, `Server`
--> src/commands/import/datapack.rs:6:13
|
6 | model::{Downloadable, Server}, app::App,
| ^^^^^^^^^^^^ ^^^^^^
|
unused import: `dialoguer::Input`:
src/commands/import/datapack.rs#L3
warning: unused import: `dialoguer::Input`
--> src/commands/import/datapack.rs:3:5
|
3 | use dialoguer::Input;
| ^^^^^^^^^^^^^^^^
|
unused import: `console::style`:
src/commands/import/datapack.rs#L2
warning: unused import: `console::style`
--> src/commands/import/datapack.rs:2:5
|
2 | use console::style;
| ^^^^^^^^^^^^^^
|
unused import: `Context`:
src/commands/import/datapack.rs#L1
warning: unused import: `Context`
--> src/commands/import/datapack.rs:1:14
|
1 | use anyhow::{Context, Result};
| ^^^^^^^
|
unused import: `Context`:
src/commands/export/packwiz.rs#L3
warning: unused import: `Context`
--> src/commands/export/packwiz.rs:3:14
|
3 | use anyhow::{Context, Result};
| ^^^^^^^
|
unused import: `model::Server`:
src/commands/env/docker.rs#L5
warning: unused import: `model::Server`
--> src/commands/env/docker.rs:5:5
|
5 | model::Server,
| ^^^^^^^^^^^^^
|
unused import: `console::style`:
src/commands/env/docker.rs#L2
warning: unused import: `console::style`
--> src/commands/env/docker.rs:2:5
|
2 | use console::style;
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` 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/
|