diff --git a/src-tauri/src/gpu.rs b/src-tauri/src/gpu.rs index 1cf184fb..606c81b1 100644 --- a/src-tauri/src/gpu.rs +++ b/src-tauri/src/gpu.rs @@ -35,7 +35,7 @@ pub fn disable_hardware_accel_windows() { let existing_args = std::env::var("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS").unwrap_or_default(); std::env::set_var( "WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", - format!("{} --disable-gpu", existing_args), + format!("{existing_args} --disable-gpu"), ); } diff --git a/src-tauri/src/injection/client_mod.rs b/src-tauri/src/injection/client_mod.rs index 7aa3244c..cfc4b153 100644 --- a/src-tauri/src/injection/client_mod.rs +++ b/src-tauri/src/injection/client_mod.rs @@ -110,7 +110,7 @@ pub fn load_mods_js() -> String { continue; } - exec = format!("{};{}", exec, result); + exec = format!("{exec};{result}"); } exec @@ -175,7 +175,7 @@ pub fn load_mods_css() -> String { continue; } - exec = format!("{} {}", exec, result); + exec = format!("{exec};{result}"); } exec diff --git a/src-tauri/src/injection/injection_runner.rs b/src-tauri/src/injection/injection_runner.rs index 7c57a96f..4f20bf82 100644 --- a/src-tauri/src/injection/injection_runner.rs +++ b/src-tauri/src/injection/injection_runner.rs @@ -40,24 +40,18 @@ pub fn load_plugins(win: &tauri::WebviewWindow, plugins: HashMap } } - // Scuffed logging solution. - win - .eval(format!("console.log('Executing plugin: {}')", name).as_str()) - .unwrap_or(()); - // Execute the plugin in a try/catch, so we can capture whatever error occurs win .eval( format!( " + console.log('Executing plugin: {name}') try {{ - {} + {script} }} catch(e) {{ - console.error(`Plugin {} returned error: ${{e}}`) + console.error(`Plugin {name} returned error: ${{e}}`) console.log('The plugin could still work! Just don\\'t expect it to.') - }} - ", - script, name + }}" ) .as_str(), ) diff --git a/src-tauri/src/injection/theme.rs b/src-tauri/src/injection/theme.rs index 93bbf752..08e28ea5 100644 --- a/src-tauri/src/injection/theme.rs +++ b/src-tauri/src/injection/theme.rs @@ -12,8 +12,8 @@ pub fn get_themes() -> Result { let themes = get_theme_dir(); let mut all_contents = String::new(); - for entry in fs::read_dir(themes).map_err(|e| format!("Error reading theme directory: {}", e))? { - let entry = entry.map_err(|e| format!("Error reading theme directory: {}", e))?; + for entry in fs::read_dir(themes).map_err(|e| format!("Error reading theme directory: {e}"))? { + let entry = entry.map_err(|e| format!("Error reading theme directory: {e}"))?; let file_name = entry .file_name() .to_str() @@ -37,7 +37,7 @@ pub fn get_themes() -> Result { pub fn get_theme_names() -> Result, String> { let themes_dir = get_theme_dir(); let theme_folders = - fs::read_dir(themes_dir).map_err(|e| format!("Error reading theme directory: {}", e))?; + fs::read_dir(themes_dir).map_err(|e| format!("Error reading theme directory: {e}"))?; let names = theme_folders .filter_map(|entry| { entry.ok().and_then(|file| { diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 504ea683..a05cd8ac 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -108,7 +108,7 @@ fn main() { if client_type == "default" { url += "https://discord.com/app"; } else { - url = format!("https://{}.discord.com/app", client_type); + url = format!("https://{client_type}.discord.com/app"); } let parsed = reqwest::Url::parse(&url).unwrap(); diff --git a/src-tauri/src/processors/css_preprocess.rs b/src-tauri/src/processors/css_preprocess.rs index b6143d4f..3490b855 100644 --- a/src-tauri/src/processors/css_preprocess.rs +++ b/src-tauri/src/processors/css_preprocess.rs @@ -37,7 +37,7 @@ pub fn localize_imports(win: tauri::WebviewWindow, css: String, name: String) -> if get_config().cache_css.unwrap_or(true) { let cache_path = get_theme_dir().join("cache"); - let cache_file = cache_path.join(format!("{}_cache.css", name)); + let cache_file = cache_path.join(format!("{name}_cache.css")); if fs::metadata(&cache_file).is_ok() { log!("Using cached CSS for {}", name); @@ -154,7 +154,7 @@ pub fn localize_imports(win: tauri::WebviewWindow, css: String, name: String) -> fs::create_dir(&cache_path).expect("Failed to create cache directory!"); } - let cache_file = cache_path.join(format!("{}_cache.css", name)); + let cache_file = cache_path.join(format!("{name}_cache.css")); fs::write(cache_file, new_css.clone()).expect("Failed to write cache file!"); } @@ -194,8 +194,8 @@ pub fn localize_imports(_win: tauri::WebviewWindow, css: String, _name: String) // Now add all the @import statements to the top for import in seen_imports { - let import = format!("@import url(\"https://{}\");", import); - new_css = format!("{}\n{}", import, new_css); + let import = format!("@import url(\"https://{import}\");"); + new_css = format!("{import}\n{new_css}"); } new_css @@ -225,7 +225,7 @@ pub fn localize_images(win: tauri::WebviewWindow, css: String) -> String { win .emit( "loading_log", - format!("Too many images to process ({}), skipping...", count), + format!("Too many images to process ({count}), skipping...",), ) .unwrap_or_default(); return new_css; @@ -304,7 +304,7 @@ pub fn localize_images(win: tauri::WebviewWindow, css: String) -> String { Some(( url.to_owned(), - format!("data:image/{};base64,{}", filetype, b64), + format!("data:image/{filetype};base64,{b64}"), )) })); } diff --git a/src-tauri/src/processors/js_preprocess.rs b/src-tauri/src/processors/js_preprocess.rs index d3ba3bb1..9c52a711 100644 --- a/src-tauri/src/processors/js_preprocess.rs +++ b/src-tauri/src/processors/js_preprocess.rs @@ -33,7 +33,7 @@ pub fn eval_js_imports(window: &tauri::WebviewWindow, scripts: Vec) { for script in scripts { match window.eval(script.as_str()) { Ok(r) => r, - Err(e) => log(format!("Error evaluating import: {}", e)), + Err(e) => log(format!("Error evaluating import: {e}")), }; } } diff --git a/src-tauri/src/util/helpers.rs b/src-tauri/src/util/helpers.rs index ff115b4a..6dd5894c 100644 --- a/src-tauri/src/util/helpers.rs +++ b/src-tauri/src/util/helpers.rs @@ -30,7 +30,7 @@ pub async fn fetch_image(url: String) -> Option { let bytes = response.bytes().await.unwrap(); let base64 = general_purpose::STANDARD.encode(bytes); - let image = format!("data:{};base64,{}", content_type, base64); + let image = format!("data:{content_type};base64,{base64}"); Some(image) } diff --git a/src-tauri/src/util/notifications.rs b/src-tauri/src/util/notifications.rs index 805b4dab..74f1d406 100644 --- a/src-tauri/src/util/notifications.rs +++ b/src-tauri/src/util/notifications.rs @@ -171,7 +171,7 @@ pub unsafe fn set_notif_icon(_: &tauri::WebviewWindow, amount: i32) { use objc2_foundation::{MainThreadMarker, NSString}; let label = if amount > 0 { - Some(NSString::from_str(&format!("{}", amount))) + Some(NSString::from_str(&format!("{amount}"))) } else if amount == -1 { Some(NSString::from_str("●")) } else { diff --git a/src-tauri/src/util/window_helpers.rs b/src-tauri/src/util/window_helpers.rs index 21e0096b..501b18a2 100644 --- a/src-tauri/src/util/window_helpers.rs +++ b/src-tauri/src/util/window_helpers.rs @@ -79,7 +79,7 @@ pub fn window_zoom_level(win: tauri::WebviewWindow, value: Option) { ); win - .eval(&format!("document.body.style.zoom = '{}'", zoom)) + .eval(&format!("document.body.style.zoom = '{zoom}'")) .expect("Failed to set zoom level!"); } diff --git a/updater/src/github.rs b/updater/src/github.rs index 90e4692b..81dcfee2 100644 --- a/updater/src/github.rs +++ b/updater/src/github.rs @@ -20,14 +20,14 @@ pub fn get_release(user: impl AsRef, repo: impl AsRef) -> Result PathBuf { let url = format!( - "https://github.com/{}/{}/releases/download/{}/{}", - user, repo, tag_name, release_name + "https://github.com/{user}/{repo}/releases/download/{tag_name}/{release_name}", ); let client = reqwest::blocking::Client::new(); diff --git a/updater/src/main.rs b/updater/src/main.rs index 2dba93bf..f1919bcd 100644 --- a/updater/src/main.rs +++ b/updater/src/main.rs @@ -75,7 +75,7 @@ pub fn reopen_as_elevated() { // get program args (without first one) and join by , std::env::args() .skip(1) - .map(|arg| format!("'\"{}\"'", arg)) + .map(|arg| format!("'\"{arg}\"'")) .collect::>() .join(",") ));