From 65bc6d382c2c1561a56b45ed862b1aa13465e05d Mon Sep 17 00:00:00 2001
From: matcool <26722564+matcool@users.noreply.github.com>
Date: Sun, 8 Dec 2024 18:07:14 -0300
Subject: [PATCH] fix clippy warnings

---
 Cargo.lock              |  2 +-
 Cargo.toml              |  2 +-
 src/file.rs             |  1 +
 src/index.rs            |  8 ++++----
 src/info.rs             |  3 +--
 src/package.rs          | 20 ++++++++++----------
 src/profile.rs          |  1 -
 src/sdk.rs              |  4 +++-
 src/util/config.rs      |  4 ++--
 src/util/spritesheet.rs |  2 +-
 10 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 14efda4..5195b95 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1025,7 +1025,7 @@ dependencies = [
 
 [[package]]
 name = "geode"
-version = "3.2.2"
+version = "3.3.0"
 dependencies = [
  "ansi_term",
  "cfg-if 1.0.0",
diff --git a/Cargo.toml b/Cargo.toml
index f610039..06b2dc2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "geode"
-version = "3.2.2"
+version = "3.3.0"
 authors = [
     "HJfod <dreadrollmusic@gmail.com>",
     "Camila314 <ilaca314@gmail.com>",
diff --git a/src/file.rs b/src/file.rs
index 6f16914..4dedfa0 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -17,6 +17,7 @@ pub fn read_dir_recursive(src: &PathBuf) -> Result<Vec<PathBuf>, io::Error> {
 	Ok(res)
 }
 
+#[allow(unused)]
 pub fn copy_dir_recursive(src: &PathBuf, dest: &PathBuf) -> Result<(), io::Error> {
 	fs::create_dir_all(dest)?;
 	for item in fs::read_dir(src)? {
diff --git a/src/index.rs b/src/index.rs
index a3e07e0..c5b6619 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -1,24 +1,24 @@
 use crate::config::Config;
 use crate::server::{ApiResponse, PaginatedData};
 use crate::util::logging::ask_value;
-use crate::util::mod_file::parse_mod_info;
-use crate::{done, fatal, index_admin, index_auth, index_dev, info, warn, NiceUnwrap};
+use crate::{done, fatal, index_admin, index_auth, index_dev, info, NiceUnwrap};
 use clap::Subcommand;
 use reqwest::header::USER_AGENT;
 use semver::VersionReq;
 use serde::{Deserialize, Serialize};
-use serde_json::json;
 use sha3::{Digest, Sha3_256};
 use std::fs;
 use std::io::Cursor;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
 use zip::read::ZipFile;
 
 #[derive(Deserialize)]
 pub struct ServerModVersion {
+	#[allow(unused)]
 	pub name: String,
 	pub version: String,
 	pub download_link: String,
+	#[allow(unused)]
 	pub hash: String,
 }
 
diff --git a/src/info.rs b/src/info.rs
index 25ea98b..bfe2362 100644
--- a/src/info.rs
+++ b/src/info.rs
@@ -1,11 +1,10 @@
 use crate::config::{self, Config};
 use crate::logging::ask_value;
 use crate::util::config::Profile;
-use crate::{done, fail, info, warn, NiceUnwrap};
+use crate::{done, fail, warn, NiceUnwrap};
 use clap::Subcommand;
 use colored::Colorize;
 use std::cell::RefCell;
-use std::io::BufRead;
 
 /**
  * geode info
diff --git a/src/package.rs b/src/package.rs
index fe18b70..1539a9d 100644
--- a/src/package.rs
+++ b/src/package.rs
@@ -191,7 +191,7 @@ fn create_resources(
 			spritesheet::downscale(&mut sprite, 2);
 			sprite.save(output_dir.join(base.to_string() + ".png"))
 		})()
-		.nice_unwrap(&format!(
+		.nice_unwrap(format!(
 			"Unable to copy sprite at {}",
 			sprite_path.display()
 		));
@@ -203,7 +203,7 @@ fn create_resources(
 	// Move other resources
 	for file in &mod_info.resources.files {
 		std::fs::copy(file, output_dir.join(file.file_name().unwrap()))
-			.nice_unwrap(&format!("Unable to copy file at '{}'", file.display()));
+			.nice_unwrap(format!("Unable to copy file at '{}'", file.display()));
 	}
 
 	if !&mod_info.resources.libraries.is_empty() {
@@ -212,7 +212,7 @@ fn create_resources(
 	// Move other resources
 	for file in &mod_info.resources.libraries {
 		std::fs::copy(file, working_dir.join(file.file_name().unwrap()))
-			.nice_unwrap(&format!("Unable to copy file at '{}'", file.display()));
+			.nice_unwrap(format!("Unable to copy file at '{}'", file.display()));
 	}
 }
 
@@ -282,7 +282,7 @@ fn create_package(
 		&mod_file_info,
 		&mut cache_bundle,
 		&mut new_cache,
-		&working_dir,
+		working_dir,
 		&working_dir.join("resources").join(&mod_file_info.id),
 		false,
 	);
@@ -292,7 +292,7 @@ fn create_package(
 		let path = root_path.join(file);
 		if path.exists() {
 			std::fs::copy(path, working_dir.join(file))
-				.nice_unwrap(&format!("Could not copy {file}"));
+				.nice_unwrap(format!("Could not copy {file}"));
 		}
 	}
 
@@ -301,7 +301,7 @@ fn create_package(
 		for header in &api.include {
 			let out = working_dir.join(header);
 			out.parent().map(fs::create_dir_all);
-			fs::copy(root_path.join(header), &out).nice_unwrap(&format!(
+			fs::copy(root_path.join(header), &out).nice_unwrap(format!(
 				"Unable to copy header {} to {}",
 				header.display(),
 				out.display()
@@ -328,7 +328,7 @@ fn create_package(
 			) {
 			let binary = name.to_string_lossy().to_string() + "." + ext.to_string_lossy().as_ref();
 			std::fs::copy(path, working_dir.join(&binary))
-				.nice_unwrap(&format!("Unable to copy binary '{}'", binary));
+				.nice_unwrap(format!("Unable to copy binary '{}'", binary));
 			binaries_added = true;
 		}
 	}
@@ -353,7 +353,7 @@ fn create_package(
 		}
 
 		std::fs::copy(binary, working_dir.join(binary_name))
-			.nice_unwrap(&format!("Unable to copy binary at '{}'", binary.display()));
+			.nice_unwrap(format!("Unable to copy binary at '{}'", binary.display()));
 		binaries_added = true;
 	}
 
@@ -363,9 +363,9 @@ fn create_package(
 		info!("Help: Add a binary with `--binary <bin_path>`");
 	}
 
-	new_cache.save(&working_dir);
+	new_cache.save(working_dir);
 
-	zip_folder(&working_dir, &output);
+	zip_folder(working_dir, &output);
 
 	if do_install {
 		let config = Config::new().assert_is_setup();
diff --git a/src/profile.rs b/src/profile.rs
index 55c17da..bfe0068 100644
--- a/src/profile.rs
+++ b/src/profile.rs
@@ -2,7 +2,6 @@ use crate::config::{Config, Profile as CfgProfile};
 use crate::{done, fail, info, warn, NiceUnwrap};
 use clap::{Subcommand, ValueEnum};
 use colored::Colorize;
-use rustyline::config;
 use std::cell::RefCell;
 use std::process::Command;
 
diff --git a/src/sdk.rs b/src/sdk.rs
index eba2879..17bf5ba 100644
--- a/src/sdk.rs
+++ b/src/sdk.rs
@@ -10,7 +10,6 @@ use reqwest::header::{AUTHORIZATION, USER_AGENT};
 use semver::{Prerelease, Version};
 use serde::Deserialize;
 use std::env;
-use std::ffi::OsStr;
 use std::fs;
 use std::path::{Path, PathBuf};
 use std::process::Command;
@@ -35,6 +34,7 @@ struct GithubReleaseResponse {
 	assets: Vec<GithubReleaseAsset>,
 }
 
+#[allow(unused)]
 struct LinuxShellConfig {
 	profile: String,
 	profile_bak: String,
@@ -268,6 +268,7 @@ fn set_sdk_env(path: &Path) -> bool {
 	env_success
 }
 
+#[allow(unused)]
 fn detect_user_shell() -> Option<UserShell> {
 	let shell = match env::var("SHELL") {
 		Err(_) => {
@@ -288,6 +289,7 @@ fn detect_user_shell() -> Option<UserShell> {
 	None
 }
 
+#[allow(unused)]
 fn get_linux_shell_info(shell: UserShell, path: &Path) -> Option<LinuxShellConfig> {
 	let home = match env::var("HOME") {
 		Err(_) => return None,
diff --git a/src/util/config.rs b/src/util/config.rs
index 5ea70ba..5fc41f6 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
 use serde_json::Value;
 use std::path::PathBuf;
 
-use crate::{done, fail, fatal, info, warn, NiceUnwrap};
+use crate::{done, fail, fatal, warn, NiceUnwrap};
 
 #[derive(Serialize, Deserialize, Clone)]
 #[serde(rename_all = "kebab-case")]
@@ -272,7 +272,7 @@ impl Config {
 	pub fn rename_profile(&mut self, old: &str, new: String) {
 		let profile = self
 			.get_profile(&Some(String::from(old)))
-			.nice_unwrap(&format!("Profile named '{}' does not exist", old));
+			.nice_unwrap(format!("Profile named '{}' does not exist", old));
 
 		if self.get_profile(&Some(new.to_owned())).is_some() {
 			fail!("The name '{}' is already taken!", new);
diff --git a/src/util/spritesheet.rs b/src/util/spritesheet.rs
index 07ee4b5..ddc4e3f 100644
--- a/src/util/spritesheet.rs
+++ b/src/util/spritesheet.rs
@@ -67,7 +67,7 @@ impl SheetBundles {
 }
 
 pub fn read_to_image(path: &Path) -> RgbaImage {
-	image::io::Reader::open(path)
+	image::ImageReader::open(path)
 		.nice_unwrap(format!("Error reading sprite '{}'", path.display()))
 		.decode()
 		.nice_unwrap(format!("Error decoding sprite '{}'", path.display()))