diff --git a/src/github.rs b/src/github.rs index faa0a9f..f8b1e97 100644 --- a/src/github.rs +++ b/src/github.rs @@ -66,7 +66,7 @@ pub async fn latest_version( let tag = latest_tag(owner, repo, prerelease).await?; let cleaned_tag = tag.replace('v', ""); Version::parse(&cleaned_tag) - .map_err(|e| format!("Failed to parse version '{}': {}", cleaned_tag, e).into()) + .map_err(|e| format!("Failed to parse version '{cleaned_tag}': {e}").into()) } pub fn download_url(owner: &str, repo: &str, tag: Option<&str>) -> String { diff --git a/src/http.rs b/src/http.rs index d8654da..c16c6de 100644 --- a/src/http.rs +++ b/src/http.rs @@ -17,18 +17,18 @@ pub async fn quick_request(url: &str) -> Result { - info!("Successfully received response from: {}", url); + info!("Successfully received response from: {url}"); Ok(text) } Err(e) => { - warn!("Failed to get response text from {}: {}", url, e); + warn!("Failed to get response text from {url}: {e}"); Err(e.into()) } } diff --git a/src/http_async.rs b/src/http_async.rs index e993fcc..a9b6bc4 100644 --- a/src/http_async.rs +++ b/src/http_async.rs @@ -32,7 +32,7 @@ pub async fn download_file_progress( .send() .await .map_err(|e| { - error!("Failed to GET from '{}': {}", url, e); + error!("Failed to GET from '{url}': {e}"); format!("Failed to GET from '{url}'") })?; @@ -89,14 +89,14 @@ pub async fn get_body(url: &str) -> Result, String> { ) .send() .await - .map_err(|e| format!("Failed to send request: {}", e))?; + .map_err(|e| format!("Failed to send request: {e}"))?; debug!("{} {url}", res.status()); res.bytes() .await .map(|b| b.to_vec()) - .map_err(|e| format!("Failed to get body: {}", e)) + .map_err(|e| format!("Failed to get body: {e}")) } pub async fn get_body_string(url: &str) -> Result { @@ -119,7 +119,7 @@ pub async fn get_json(url: &str) -> Result(url: &str) -> Result(&body).map_err(|e| format!("Failed to parse JSON: {}", e)) + serde_json::from_slice::(&body).map_err(|e| format!("Failed to parse JSON: {e}")) } diff --git a/src/main.rs b/src/main.rs index 0044073..37ff97c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -763,9 +763,9 @@ async fn main() { std::process::exit(1); }; - info!("Launching game in offline mode with client: {}", client); + info!("Launching game in offline mode with client: {client}"); // Launch game without updates - launch(&install_path.join(format!("{}.exe", client)), &cfg.args); + launch(&install_path.join(format!("{client}.exe")), &cfg.args); return; } diff --git a/src/misc.rs b/src/misc.rs index 51bf9d6..5737727 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -41,7 +41,7 @@ pub fn is_program_in_path(program: &str) -> bool { paths.to_str().map(|paths| { paths .split(':') - .any(|dir| fs::metadata(format!("{}/{}", dir, program)).is_ok()) + .any(|dir| fs::metadata(format!("{dir}/{program}")).is_ok()) }) }) .unwrap_or(false) @@ -54,8 +54,8 @@ pub fn is_program_in_path(program: &str) -> bool { paths.to_str().map(|paths| { paths.split(';').any(|dir| { fs::metadata(format!("{}\\{}.exe", dir, program)).is_ok() - || fs::metadata(format!("{}\\{}.cmd", dir, program)).is_ok() - || fs::metadata(format!("{}\\{}.bat", dir, program)).is_ok() + || fs::metadata(format!("{dir}\\{program}.cmd")).is_ok() + || fs::metadata(format!("{dir}\\{program}.bat")).is_ok() }) }) }) diff --git a/src/self_update.rs b/src/self_update.rs index 6533ebc..328b59f 100644 --- a/src/self_update.rs +++ b/src/self_update.rs @@ -15,7 +15,7 @@ pub async fn self_update_available(prerelease: Option) -> bool { let latest_version = match github::latest_version(GH_OWNER, GH_REPO, prerelease).await { Ok(v) => v, Err(e) => { - error!("Failed to get latest version: {}", e); + error!("Failed to get latest version: {e}"); return false; } };