Skip to content

Commit 16022c7

Browse files
committed
Fix issues clippy highlighted
1 parent ea49759 commit 16022c7

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

src/app.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use iced::{
1515
},
1616
window::{self, Id, Settings},
1717
};
18-
use std::path::Path;
1918

2019
#[cfg(target_os = "macos")]
2120
use crate::macos::{focus_this_app, transform_process_to_ui_element};
@@ -146,9 +145,6 @@ pub fn default_settings() -> Settings {
146145
}
147146
}
148147

149-
#[derive(Debug, Clone)]
150-
pub struct Temp {}
151-
152148
#[derive(Debug, Clone)]
153149
pub struct Tile {
154150
theme: iced::Theme,
@@ -170,7 +166,7 @@ pub struct Tile {
170166
impl Tile {
171167
/// A base window
172168
pub fn new(keybind_id: u32, config: &Config) -> (Self, Task<Message>) {
173-
let mut settings = default_settings();
169+
let settings = default_settings();
174170
#[cfg(target_os = "windows")]
175171
{
176172
// get normal settings and modify position

src/utils.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ use std::{
55
process::exit,
66
};
77

8-
use crate::app::{DEFAULT_WINDOW_HEIGHT, WINDOW_WIDTH};
98
use global_hotkey::hotkey::Code;
10-
use iced::{futures::io::Window, widget::image::Handle};
9+
use iced::widget::image::Handle;
1110
use icns::IconFamily;
1211
use image::RgbaImage;
1312
use rayon::iter::{IntoParallelIterator, ParallelIterator};
@@ -300,29 +299,29 @@ pub fn to_key_code(key_str: &str) -> Option<Code> {
300299
}
301300

302301
pub fn get_config_installation_dir() -> String {
303-
let path = if cfg!(target_os = "windows") {
302+
303+
304+
if cfg!(target_os = "windows") {
304305
std::env::var("LOCALAPPDATA").unwrap()
305306
} else {
306307
std::env::var("HOME").unwrap()
307-
};
308-
309-
return path;
308+
}
310309
}
311310

312311
pub fn get_config_file_path() -> String {
313312
let home = get_config_installation_dir();
314-
let file_path = if cfg!(target_os = "windows") {
313+
314+
315+
if cfg!(target_os = "windows") {
315316
home + "\\rustcast\\config.toml"
316317
} else {
317318
home + "/.config/rustcast/config.toml"
318-
};
319-
320-
return file_path;
319+
}
321320
}
322321
use crate::config::Config;
323322

324323
pub fn read_config_file(file_path: &str) -> Result<Config, std::io::Error> {
325-
let config: Config = match std::fs::read_to_string(&file_path) {
324+
let config: Config = match std::fs::read_to_string(file_path) {
326325
Ok(a) => toml::from_str(&a).unwrap(),
327326
Err(_) => Config::default(),
328327
};
@@ -335,27 +334,26 @@ pub fn create_config_file_if_not_exists(
335334
config: &Config,
336335
) -> Result<(), std::io::Error> {
337336
// check if file exists
338-
if let Ok(exists) = std::fs::metadata(&file_path) {
339-
if exists.is_file() {
337+
if let Ok(exists) = std::fs::metadata(file_path)
338+
&& exists.is_file() {
340339
return Ok(());
341340
}
342-
}
343341

344342
let path = Path::new(&file_path);
345343
if let Some(parent) = path.parent() {
346344
std::fs::create_dir_all(parent).unwrap();
347345
}
348346

349347
std::fs::write(
350-
&file_path,
348+
file_path,
351349
toml::to_string(&config).unwrap_or_else(|x| x.to_string()),
352350
)
353351
.unwrap();
354352

355353
Ok(())
356354
}
357355

358-
pub fn open_application(path: &String) {
356+
pub fn open_application(path: &str) {
359357
#[cfg(target_os = "windows")]
360358
{
361359
use std::process::Command;

0 commit comments

Comments
 (0)