From fb6714aeee30304f358b69b0642b5562499f51d0 Mon Sep 17 00:00:00 2001 From: arabian Date: Sat, 13 Sep 2025 18:30:19 +0300 Subject: [PATCH] better imports --- src/app.rs | 26 +++++++++++++------------- src/app/pw.rs | 4 +--- src/app/settings.rs | 9 ++++++--- src/main.rs | 3 +-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/app.rs b/src/app.rs index 85be192..826d612 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,27 +1,27 @@ mod pw; pub mod settings; +pub use settings::Settings; + use eframe::{CreationContext, Frame, NativeOptions}; use egui::{ Button, CentralPanel, ComboBox, Context, Label, ScrollArea, Separator, Slider, TextEdit, Ui, Vec2, }; use egui_material_icons::icons; + use metadata::media_file::MediaFileMetadata; use rfd::FileDialog; use rodio::{Decoder, OutputStream, OutputStreamBuilder, Sink}; -pub use settings::Settings; use std::{fs, path::PathBuf}; -#[derive(PartialEq)] -#[derive(Default)] +#[derive(PartialEq, Default)] enum PlayerState { Playing, #[default] Paused, } - pub struct App { saved_settings: Settings, @@ -329,15 +329,15 @@ impl App { if let Some(extension) = path.extension().and_then(|n| n.to_str()) && music_extensions.contains(&extension.to_lowercase().as_str()) - && path - .to_str() - .unwrap() - .to_string() - .to_lowercase() - .contains(self.search_query.as_str()) - { - music_files.push(path); - } + && path + .to_str() + .unwrap() + .to_string() + .to_lowercase() + .contains(self.search_query.as_str()) + { + music_files.push(path); + } } ui.vertical(|ui| { let search_entry = TextEdit::singleline(&mut self.search_query); diff --git a/src/app/pw.rs b/src/app/pw.rs index 042653e..9b4e7cd 100644 --- a/src/app/pw.rs +++ b/src/app/pw.rs @@ -1,6 +1,4 @@ -use std::collections::HashMap; -use std::error::Error; -use std::process::Command; +use std::{collections::HashMap, error::Error, process::Command}; pub struct AudioDevice { pub nick: String, diff --git a/src/app/settings.rs b/src/app/settings.rs index 4f26f9d..dd32384 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -1,7 +1,10 @@ use serde::{Deserialize, Serialize}; -use std::fs; -use std::io::{Read, Write}; -use std::path::PathBuf; + +use std::{ + fs, + io::{Read, Write}, + path::PathBuf, +}; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Settings { diff --git a/src/main.rs b/src/main.rs index a01ce7c..bcaaa55 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ -use std::fs; - mod app; +use std::fs; fn main() -> Result<(), eframe::Error> { let settings = generate_settings(); app::run(settings)