Skip to content

did more stuff ig

did more stuff ig #87

GitHub Actions / clippy failed Oct 21, 2023 in 2s

clippy

43 errors, 104 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 43
Warning 104
Note 0
Help 0

Versions

  • rustc 1.73.0 (cc66ad468 2023-10-03)
  • cargo 1.73.0 (9c4383fb5 2023-08-26)
  • clippy 0.1.73 (cc66ad4 2023-10-03)

Annotations

Check warning on line 98 in src/core/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `std::result::Result` that must be used

warning: unused `std::result::Result` that must be used
  --> src/core/mod.rs:94:9
   |
94 | /         self.app.success(format!(
95 | |             "Successfully built {} in {}",
96 | |             style(&server_name).green().bold(),
97 | |             style(FormattedDuration(progress_bar.elapsed())).blue(),
98 | |         ));
   | |__________^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
   |
94 |         let _ = self.app.success(format!(
   |         +++++++

Check warning on line 193 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

warning: unused `async` for function with no await statements
   --> src/interop/packwiz.rs:164:5
    |
164 | /     pub async fn resolved_to_mod(&self, resolved_file: &ResolvedFile) -> Result<Mod> {
165 | |         let hash = App::get_best_hash(&resolved_file.hashes);
166 | |
167 | |         let (hash_format, hash) = match hash {
...   |
192 | |         })
193 | |     }
    | |_____^
    |
    = 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

Check warning on line 24 in src/app/from_string.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

warning: unused `async` for function with no await statements
  --> src/app/from_string.rs:19:5
   |
19 | /     pub async fn dl_from_url(
20 | |         &self,
21 | |         url: &str
22 | |     ) -> Result<Downloadable> {
23 | |         todo!()
24 | |     }
   | |_____^
   |
   = 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

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

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

Check warning on line 166 in src/commands/add/modrinth.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

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

Check warning on line 26 in src/commands/export/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `async` for function with no await statements

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

Check warning on line 81 in src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> src/main.rs:81:93
   |
81 |         Commands::Build(args) => commands::build::run(base_app.upgrade()?, args).await.map(|_| ()),
   |                                                                                             ^ 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)]`

Check failure on line 30 in src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

name `CLI` contains a capitalized acronym

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

Check warning on line 43 in src/interop/markdown.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
  --> src/interop/markdown.rs:41:17
   |
41 | /                 content = re.replace_all(&content, |_caps: &regex::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
   = note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`
help: add a `;` here
   |
41 ~                 content = re.replace_all(&content, |_caps: &regex::Captures| {
42 +                     format!("<!--start:mcman-{id}-->\n{}\n<!--end:mcman-{id}-->", table.render())
43 +                 }).to_string();
   |

Check warning on line 185 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this match arm has an identical body to the `_` wildcard arm

warning: this match arm has an identical body to the `_` wildcard arm
   --> src/interop/packwiz.rs:185:21
    |
185 |                     "md5" => HashFormat::Md5,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the arm
    |
    = help: or try changing either arm body
note: `_` wildcard arm here
   --> src/interop/packwiz.rs:187:21
    |
187 |                     _ => HashFormat::Md5,
    |                     ^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 173 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this could be rewritten as `let...else`

warning: this could be rewritten as `let...else`
   --> src/interop/packwiz.rs:167:9
    |
167 | /         let (hash_format, hash) = match hash {
168 | |             Some(t) => t,
169 | |             None => {
170 | |                 // TODO calculate hash manually (by cached file or download it and compute)
171 | |                 todo!()
172 | |             }
173 | |         };
    | |__________^
    |
    = 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
    |
167 ~         let Some((hash_format, hash)) = hash else {
168 +                 // TODO calculate hash manually (by cached file or download it and compute)
169 +                 todo!()
170 +             };
    |

Check failure on line 157 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

error: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/interop/packwiz.rs:157:42
    |
157 |         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

Check failure on line 148 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

error: useless use of `format!`
   --> src/interop/packwiz.rs:148:29
    |
148 |                 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

Check failure on line 134 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods called `from_*` usually take no `self`

error: methods called `from_*` usually take no `self`
   --> src/interop/packwiz.rs:134:28
    |
134 |     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

Check failure on line 122 in src/interop/packwiz.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods called `from_*` usually take no `self`

error: methods called `from_*` usually take no `self`
   --> src/interop/packwiz.rs:122:27
    |
122 |     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)]`

Check warning on line 231 in src/interop/mrpack.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function's return value is unnecessarily wrapped by `Result`

warning: this function's return value is unnecessarily wrapped by `Result`
   --> src/interop/mrpack.rs:207:5
    |
207 | /     pub fn get_files(&self) -> Result<HashMap<String, String>> {
208 | |         let mut map = HashMap::new();
209 | |
210 | |         for filename in self.0.file_names() {
...   |
230 | |         Ok(map)
231 | |     }
    | |_____^
    |
    = 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 `Result` from the return type...
    |
207 |     pub fn get_files(&self) -> std::collections::HashMap<std::string::String, std::string::String> {
    |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
    |
230 |         map
    |

Check failure on line 43 in src/util/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

error: single-character string constant used as pattern
  --> src/util/mod.rs:43:33
   |
43 |     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

Check failure on line 41 in src/util/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

error: single-character string constant used as pattern
  --> src/util/mod.rs:41:33
   |
41 |     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

Check failure on line 44 in src/util/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

error: returning the result of a `let` binding from a block
  --> src/util/mod.rs:44:5
   |
43 |     let folder = folder.replace(" ", "-");
   |     -------------------------------------- unnecessary `let` binding
44 |     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
   |
43 ~     
44 ~     folder.replace(" ", "-")
   |

Check failure on line 57 in src/util/hash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `format!` to build up a string from an iterator

error: use of `format!` to build up a string from an iterator
  --> src/util/hash.rs:54:16
   |
54 |       let hash = (hasher.finalize().as_slice() as &[u8])
   |  ________________^
55 | |         .iter()
56 | |         .map(|b| format!("{b:x?}"))
57 | |         .collect::<String>();
   | |____________________________^
   |
help: call `fold` instead
  --> src/util/hash.rs:56:10
   |
56 |         .map(|b| format!("{b:x?}"))
   |          ^^^
help: ... and use the `write!` macro here
  --> src/util/hash.rs:56:18
   |
56 |         .map(|b| format!("{b:x?}"))
   |                  ^^^^^^^^^^^^^^^^^
   = note: this can be written more efficiently by appending to a `String` directly
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect

Check failure on line 32 in src/util/hash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `format!` to build up a string from an iterator

error: use of `format!` to build up a string from an iterator
  --> src/util/hash.rs:29:16
   |
29 |       let hash = (hasher.finalize().as_slice() as &[u8])
   |  ________________^
30 | |         .iter()
31 | |         .map(|b| format!("{b:x?}"))
32 | |         .collect::<String>();
   | |____________________________^
   |
help: call `fold` instead
  --> src/util/hash.rs:31:10
   |
31 |         .map(|b| format!("{b:x?}"))
   |          ^^^
help: ... and use the `write!` macro here
  --> src/util/hash.rs:31:18
   |
31 |         .map(|b| format!("{b:x?}"))
   |                  ^^^^^^^^^^^^^^^^^
   = note: this can be written more efficiently by appending to a `String` directly
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect

Check failure on line 16 in src/util/hash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `format!` to build up a string from an iterator

error: use of `format!` to build up a string from an iterator
  --> src/util/hash.rs:13:16
   |
13 |       let hash = (hasher.finalize().as_slice() as &[u8])
   |  ________________^
14 | |         .iter()
15 | |         .map(|b| format!("{b:x?}"))
16 | |         .collect::<String>();
   | |____________________________^
   |
help: call `fold` instead
  --> src/util/hash.rs:15:10
   |
15 |         .map(|b| format!("{b:x?}"))
   |          ^^^
help: ... and use the `write!` macro here
  --> src/util/hash.rs:15:18
   |
15 |         .map(|b| format!("{b:x?}"))
   |                  ^^^^^^^^^^^^^^^^^
   = note: this can be written more efficiently by appending to a `String` directly
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
   = note: `#[deny(clippy::format_collect)]` implied by `#[deny(clippy::all)]`

Check failure on line 49 in src/util/env.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `unwrap_or` to construct default value

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

Check warning on line 88 in src/sources/hangar.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i64` to `u64` may lose the sign of the value

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

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

See this annotation in the file changed.

@github-actions github-actions / clippy

needlessly taken reference of both operands

error: needlessly taken reference of both operands
  --> src/sources/hangar.rs: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)
   |                           ~~~~~~    ~~~~~~~