Skip to content

refactor: simplify imports and other minor optimizations #257

refactor: simplify imports and other minor optimizations

refactor: simplify imports and other minor optimizations #257

GitHub Actions / clippy failed Sep 23, 2024 in 1s

clippy

10 errors, 115 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 10
Warning 115
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 warning on line 14 in src/commands/update.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/update.rs:10:1
   |
10 | / pub async fn run(app: Arc<App>, args: Args) -> Result<()> {
11 | |     println!("{:#?}", git::version_check());
12 | |
13 | |     Ok(())
14 | | }
   | |_^
   |
   = 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 181 in src/commands/migrate.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/migrate.rs:71:1
    |
71  | / pub async fn migrate_server() -> Result<()> {
72  | |     let legacy_server = read_toml::<LegacyServer>(&PathBuf::from("./server.toml"))
73  | |         .with_context(|| "Reading server.toml")?;
...   |
180 | |     Ok(())
181 | | }
    | |_^
    |
    = 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 14 in src/commands/markdown/print.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/markdown/print.rs:10:1
   |
10 | / pub async fn run(app: Arc<App>, args: Args) -> Result<()> {
11 | |     todo!();
12 | |
13 | |     Ok(())
14 | | }
   | |_^
   |
   = 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 12 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:10:1
   |
10 | / pub async fn run(app: Arc<App>, args: Args) -> Result<()> {
11 | |     Ok(())
12 | | }
   | |_^
   |
   = 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 14 in src/commands/export/mrpack.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/mrpack.rs:12:1
   |
12 | / pub async fn run(app: Arc<App>, args: Args) -> Result<()> {
13 | |     Ok(())
14 | | }
   | |_^
   |
   = 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 93 in src/api/ws/mod.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/api/ws/mod.rs:91:5
   |
91 | /     pub async fn handle_event(self: Arc<Self>, event: MsgIn) -> Result<()> {
92 | |         Ok(())
93 | |     }
   | |_____^
   |
   = 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 74 in src/api/utils/zip.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/api/utils/zip.rs:51:1
   |
51 | / pub async fn zip<T: Write + Seek>(writer: T, folder: &Path) -> Result<()> {
52 | |     let mut archive = ZipWriter::new(writer);
53 | |
54 | |     archive.set_comment(format!("generated by mcman/{APP_VERSION}"));
...  |
73 | |     Ok(())
74 | | }
   | |_^
   |
   = 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 48 in src/api/utils/zip.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/api/utils/zip.rs:15:1
   |
15 | / pub async fn unzip<T: Read + Seek>(reader: T, to: &Path, prefix: Option<String>) -> Result<()> {
16 | |     let mut archive = ZipArchive::new(reader)?;
17 | |
18 | |     let mut files = archive
...  |
47 | |     Ok(())
48 | | }
   | |_^
   |
   = 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 55 in src/api/utils/accessor.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/api/utils/accessor.rs:45:5
   |
45 | /     pub async fn dir(&self) -> Result<Vec<String>> {
46 | |         match self {
47 | |             Self::ZipLocal((_, zip)) => Ok(zip.file_names().map(ToOwned::to_owned).collect()),
48 | |             Self::Local(path) => Ok(path
...  |
54 | |         }
55 | |     }
   | |_____^
   |
   = 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 78 in src/api/sources/spigot/mod.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/api/sources/spigot/mod.rs:72:5
   |
72 | /     pub async fn resolve_remove_steps(&self, id: &str, version: &str) -> Result<Vec<Step>> {
73 | |         Ok(vec![Step::RemoveFile(FileMeta::filename(format!(
74 | |             "spigot-{}-{}.jar",
75 | |             resource_id(id),
76 | |             version
77 | |         )))])
78 | |     }
   | |_____^
   |
   = 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 70 in src/api/sources/spigot/mod.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/api/sources/spigot/mod.rs:49:5
   |
49 | /     pub async fn resolve_steps(&self, id: &str, version: &str) -> Result<Vec<Step>> {
50 | |         let url = format!(
51 | |             "{}/resources/{}/versions/{}/download/proxy",
52 | |             self.0.options.api_urls.spiget,
...  |
69 | |         ])
70 | |     }
   | |_____^
   |
   = 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 103 in src/api/sources/quilt/mod.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/api/sources/quilt/mod.rs:71:5
    |
71  | /     pub async fn resolve_steps_build(
72  | |         &self,
73  | |         jar_name: &str,
74  | |         mc_version: &str,
...   |
102 | |         }])
103 | |     }
    | |_____^
    |
    = 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 121 in src/api/sources/maven/mod.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/api/sources/maven/mod.rs:84:5
    |
84  | /     pub async fn resolve(
85  | |         &self,
86  | |         url: &str,
87  | |         group_id: &str,
...   |
120 | |         Ok((download_url, metadata))
121 | |     }
    | |_____^
    |
    = 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 81 in src/api/sources/fabric/mod.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/api/sources/fabric/mod.rs:35:5
   |
35 | /     pub async fn resolve_steps(
36 | |         &self,
37 | |         mc_version: &str,
38 | |         loader: &str,
...  |
80 | |         Ok(steps)
81 | |     }
   | |_____^
   |
   = 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 103 in src/api/sources/buildtools/mod.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/api/sources/buildtools/mod.rs:65:1
    |
65  | / pub async fn resolve_compile_steps(
66  | |     _app: &App,
67  | |     jar_name: &str,
68  | |     craftbukkit: bool,
...   |
102 | |     ])
103 | | }
    | |_^
    |
    = 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 49 in src/api/sources/buildtools/mod.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/api/sources/buildtools/mod.rs:40:1
   |
40 | / pub async fn resolve_remove_steps(
41 | |     _app: &App,
42 | |     _craftbukkit: bool,
43 | |     _custom_args: &[String],
...  |
48 | |     )))])
49 | | }
   | |_^
   |
   = 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 108 in src/api/models/packwiz/mod.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/api/models/packwiz/mod.rs:78:5
    |
78  | /     pub async fn into_addon(&self, app: &App, target: AddonTarget) -> Result<Addon> {
79  | |         let addon_type = if let Some(update) = &self.update {
80  | |             match update {
81  | |                 PackwizModUpdate::Modrinth { mod_id, version } => AddonType::Modrinth {
...   |
107 | |         Ok(addon)
108 | |     }
    | |_____^
    |
    = 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 59 in src/api/models/packwiz/mod.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/api/models/packwiz/mod.rs:57:5
   |
57 | /     pub async fn from_steps(steps: &[Step]) -> Self {
58 | |         todo!()
59 | |     }
   | |_____^
   |
   = 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 46 in src/api/models/mrpack/mod.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/api/models/mrpack/mod.rs:34:5
   |
34 | /     pub async fn into_addon(&self) -> Result<Addon> {
35 | |         Ok(Addon {
36 | |             environment: self.env.as_ref().map(|e| e.clone().into()),
37 | |             addon_type: AddonType::Url {
...  |
45 | |         })
46 | |     }
   | |_____^
   |
   = 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 111 in src/api/app/actions/build/bootstrap.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/api/app/actions/build/bootstrap.rs:90:5
    |
90  | /     pub async fn should_bootstrap_file(&self, file: &Path) -> bool {
91  | |         let ext = file
92  | |             .extension()
93  | |             .unwrap_or_default()
...   |
110 | |         bootstrap_exts.contains(&ext)
111 | |     }
    | |_____^
    |
    = 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: `-W clippy::unused-async` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::unused_async)]`

Check failure on line 30 in src/api/ws/msg.rs

See this annotation in the file changed.

@github-actions 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 106 in src/api/utils/pathdiff.rs

See this annotation in the file changed.

@github-actions 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 7 in src/api/utils/logger/mod.rs

See this annotation in the file changed.

@github-actions 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 34 in src/api/utils/accessor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

case-sensitive file extension comparison

warning: case-sensitive file extension comparison
  --> src/api/utils/accessor.rs:34:19
   |
34 |         } 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
   |
34 ~         } else if std::path::Path::new(str)
35 +             .extension()
36 ~             .map_or(false, |ext| ext.eq_ignore_ascii_case("zip")) || str.ends_with(".mrpack") {
   |

Check warning on line 14 in src/api/tools/java/check.rs

See this annotation in the file changed.

@github-actions 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)]`