clippy
32 errors, 43 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 32 |
Warning | 43 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.81.0 (eeb90cda1 2024-09-04)
- cargo 1.81.0 (2dbb1af80 2024-08-20)
- clippy 0.1.81 (eeb90cd 2024-09-04)
Annotations
Check failure on line 79 in src/api/ws/mod.rs
github-actions / clippy
redundant pattern matching, consider using `is_err()`
error: redundant pattern matching, consider using `is_err()`
--> src/api/ws/mod.rs:79:20
|
79 | if let Err(_) = client.send(msg.clone()).await {
| -------^^^^^^--------------------------------- help: try: `if (client.send(msg.clone()).await).is_err()`
|
= note: this will change drop order of the result, as well as all temporaries
= note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `-D clippy::redundant-pattern-matching` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::redundant_pattern_matching)]`
Check failure on line 30 in src/api/ws/msg.rs
github-actions / clippy
large size difference between variants
error: large size difference between variants
--> src/api/ws/msg.rs:21:1
|
21 | / pub enum MsgOut {
22 | | / Connected {
23 | | | version: String,
24 | | | },
| | |_____- the second-largest variant contains at least 24 bytes
25 | |
26 | | / AppInfo {
27 | | | server: Option<Server>,
28 | | | network: Option<Network>,
29 | | | },
| | |_____- the largest variant contains at least 760 bytes
30 | | }
| |___^ the entire enum is at least 760 bytes
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
= note: `-D clippy::large-enum-variant` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::large_enum_variant)]`
help: consider boxing the large fields to reduce the total size of the enum
|
27 | server: Box<Option<Server>>,
| ~~~~~~~~~~~~~~~~~~~
Check warning on line 41 in src/api/utils/serde.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/serde.rs:41:19
|
41 | pub fn is_true(b: &bool) -> bool {
| ^^^^^ help: consider passing by value instead: `bool`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
Check warning on line 45 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:45:24
|
45 | pub fn script_args(&self) -> &'static str {
| ^^^^^ 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
Check warning on line 38 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:38:21
|
38 | pub fn line_sep(&self) -> &'static str {
| ^^^^^ 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
Check warning on line 31 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:31:21
|
31 | pub fn file_ext(&self) -> &'static str {
| ^^^^^ 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
Check warning on line 24 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:24:19
|
24 | pub fn header(&self) -> &'static str {
| ^^^^^ 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
Check warning on line 17 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:17:20
|
17 | pub fn comment(&self, comment: &str) -> 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
Check warning on line 8 in src/api/utils/script.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/script.rs:8:28
|
8 | pub fn generate_script(&self, lines: Vec<String>) -> 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
Check warning on line 8 in src/api/utils/script.rs
github-actions / clippy
this argument is passed by value, but not consumed in the function body
warning: this argument is passed by value, but not consumed in the function body
--> src/api/utils/script.rs:8:42
|
8 | pub fn generate_script(&self, lines: Vec<String>) -> String {
| ^^^^^^^^^^^ help: consider changing the type to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
Check failure on line 93 in src/api/utils/pathdiff.rs
github-actions / clippy
redundant guard
error: redundant guard
--> src/api/utils/pathdiff.rs:93:39
|
93 | (Some(_), Some(b)) if b == Component::ParentDir => return None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
help: try
|
93 - (Some(_), Some(b)) if b == Component::ParentDir => return None,
93 + (Some(_), Some(Component::ParentDir)) => return None,
|
Check failure on line 92 in src/api/utils/pathdiff.rs
github-actions / clippy
redundant guard
error: redundant guard
--> src/api/utils/pathdiff.rs:92:39
|
92 | (Some(a), Some(b)) if b == Component::CurDir => comps.push(a),
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
= note: `-D clippy::redundant-guards` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::redundant_guards)]`
help: try
|
92 - (Some(a), Some(b)) if b == Component::CurDir => comps.push(a),
92 + (Some(a), Some(Component::CurDir)) => comps.push(a),
|
Check warning on line 106 in src/api/utils/pathdiff.rs
github-actions / clippy
unnecessary `!=` operation
warning: unnecessary `!=` operation
--> src/api/utils/pathdiff.rs:72:5
|
72 | / if path.is_absolute() != base.is_absolute() {
73 | | if path.is_absolute() {
74 | | Some(PathBuf::from(path))
75 | | } else {
... |
105 | | Some(comps.iter().map(|c| c.as_os_str()).collect())
106 | | }
| |_____^
|
= help: change to `==` 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
Check warning on line 100 in src/api/utils/markdown/mod.rs
github-actions / clippy
this argument is passed by value, but not consumed in the function body
warning: this argument is passed by value, but not consumed in the function body
--> src/api/utils/markdown/mod.rs:100:45
|
100 | fn wrap(tag: &'static str, content: String) -> String {
| ^^^^^^ help: consider changing the type to: `&str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
Check warning on line 7 in src/api/utils/logger/mod.rs
github-actions / clippy
this function's return value is unnecessary
warning: this function's return value is unnecessary
--> src/api/utils/logger/mod.rs:3:1
|
3 | / pub fn init_logger() -> Result<()> {
4 | | env_logger::init();
5 | |
6 | | Ok(())
7 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
= note: `-W clippy::unnecessary-wraps` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::unnecessary_wraps)]`
help: remove the return type...
|
3 | pub fn init_logger() -> Result<()> {
| ~~~~~~~~~~
help: ...and then remove returned values
|
6 - Ok(())
|
Check warning on line 25 in src/api/utils/hashing/mod.rs
github-actions / clippy
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> src/api/utils/hashing/mod.rs:25:23
|
25 | pub fn get_digest(&self) -> Box<dyn DynDigest + Send> {
| ^^^^^ 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
Check warning on line 32 in src/api/utils/accessor.rs
github-actions / clippy
case-sensitive file extension comparison
warning: case-sensitive file extension comparison
--> src/api/utils/accessor.rs:32:19
|
32 | } else if str.ends_with(".zip") || str.ends_with(".mrpack") {
| ^^^^^^^^^^^^^^^^^^^^^
|
= 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: `-W clippy::case-sensitive-file-extension-comparisons` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::case_sensitive_file_extension_comparisons)]`
help: use std::path::Path
|
32 ~ } else if std::path::Path::new(str)
33 + .extension()
34 ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("zip")) || str.ends_with(".mrpack") {
|
Check warning on line 23 in src/api/utils/accessor.rs
github-actions / clippy
this match arm has an identical body to another arm
warning: this match arm has an identical body to another arm
--> src/api/utils/accessor.rs:23:13
|
23 | Accessor::ZipLocal((path, _)) => path.to_string_lossy().into_owned(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try changing either arm body
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
|
23 | Accessor::ZipLocal((path, _)) | Accessor::Local(path) => path.to_string_lossy().into_owned(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
21 - Accessor::Local(path) => path.to_string_lossy().into_owned(),
|
Check failure on line 26 in src/api/utils/accessor.rs
github-actions / clippy
direct implementation of `ToString`
error: direct implementation of `ToString`
--> src/api/utils/accessor.rs:18:1
|
18 | / impl ToString for Accessor {
19 | | fn to_string(&self) -> String {
20 | | match self {
21 | | Accessor::Local(path) => path.to_string_lossy().into_owned(),
... |
25 | | }
26 | | }
| |_^
|
= help: prefer implementing `Display` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
Check warning on line 23 in src/api/tools/java/installation.rs
github-actions / clippy
this match arm has an identical body to another arm
warning: this match arm has an identical body to another arm
--> src/api/tools/java/installation.rs:23:13
|
23 | (Some("1"), Some(ver)) => ver,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try changing either arm body
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
|
23 | (Some("1"), Some(ver)) | (Some(ver), _) => ver,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
24 - (Some(ver), _) => ver,
|
Check warning on line 14 in src/api/tools/java/check.rs
github-actions / clippy
unnecessary `!=` operation
warning: unnecessary `!=` operation
--> src/api/tools/java/check.rs:10:16
|
10 | let path = if path.file_name()?.to_str()? != JAVA_BIN {
| ________________^
11 | | path.join(JAVA_BIN)
12 | | } else {
13 | | path.clone()
14 | | };
| |_____^
|
= help: change to `==` 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: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::if_not_else)]`
Check failure on line 7 in src/api/tools/git/mod.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.80.0`
error: current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.80.0`
--> src/api/tools/git/mod.rs:7:48
|
7 | static GIT_VERSION: LazyLock<Option<String>> = LazyLock::new(version_check);
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
= note: `-D clippy::incompatible-msrv` implied by `-D clippy::all`
= help: to override `-D clippy::all` add `#[allow(clippy::incompatible_msrv)]`
Check warning on line 57 in src/api/sources/vanilla/mod.rs
github-actions / clippy
wildcard matches only a single variant and will also match any future added variants
warning: wildcard matches only a single variant and will also match any future added variants
--> src/api/sources/vanilla/mod.rs:57:13
|
57 | _ => bail!("You cant have both smh"),
| ^ help: try: `Environment::Both`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
Check failure on line 20 in src/api/sources/vanilla/mod.rs
github-actions / clippy
methods called `into_*` usually take `self` by value
error: methods called `into_*` usually take `self` by value
--> src/api/sources/vanilla/mod.rs:20:22
|
20 | pub fn into_step(&self, ty: DownloadType) -> Option<Vec<Step>> {
| ^^^^^
|
= 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 warning on line 87 in src/api/sources/vanilla/version.rs
github-actions / clippy
possible intra-doc link using quotes instead of backticks
warning: possible intra-doc link using quotes instead of backticks
--> src/api/sources/vanilla/version.rs:87:25
|
87 | /// "exclude": ["META-INF/"],
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
= note: `-W clippy::doc-link-with-quotes` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_link_with_quotes)]`