Clean up dependencies, lints

`lazy_static` and `smol_str` weren't used. COSMIC Player used `dirs`
once to find the user's home directory. Rust fixed and undeprecated its
`home_dir` function in 1.85, which released earlier this year and is the
MSRV of libcosmic.
This commit is contained in:
Josh Megnauth 2025-11-03 16:12:38 -05:00
parent 04c354584d
commit 27ea8d2770
No known key found for this signature in database
GPG key ID: 70813183462EFAD3
4 changed files with 9 additions and 21 deletions

View file

@ -103,20 +103,19 @@ fn main() -> Result<(), Box<dyn Error>> {
localize::localize();
let (config_handler, config) = match cosmic_config::Config::new(App::APP_ID, CONFIG_VERSION) {
let config = match cosmic_config::Config::new(App::APP_ID, CONFIG_VERSION) {
Ok(config_handler) => {
let config = match Config::get_entry(&config_handler) {
match Config::get_entry(&config_handler) {
Ok(ok) => ok,
Err((errs, config)) => {
log::error!("errors loading config: {:?}", errs);
config
}
};
(Some(config_handler), config)
}
}
Err(err) => {
log::error!("failed to create config handler: {}", err);
(None, Config::default())
Config::default()
}
};
@ -142,7 +141,6 @@ fn main() -> Result<(), Box<dyn Error>> {
settings = settings.size_limits(Limits::NONE.min_width(360.0).min_height(180.0));
let flags = Flags {
config_handler,
config,
config_state_handler,
config_state,
@ -195,7 +193,6 @@ impl MenuAction for Action {
#[derive(Clone)]
pub struct Flags {
config_handler: Option<cosmic_config::Config>,
config: Config,
config_state_handler: Option<cosmic_config::Config>,
config_state: ConfigState,
@ -1420,7 +1417,7 @@ impl Application for App {
Command::none()
}
fn header_start(&self) -> Vec<Element<Self::Message>> {
fn header_start(&self) -> Vec<Element<'_, Self::Message>> {
vec![menu::menu_bar(
&self.flags.config,
&self.flags.config_state,
@ -1430,7 +1427,7 @@ impl Application for App {
}
/// Creates a view after each update.
fn view(&self) -> Element<Self::Message> {
fn view(&self) -> Element<'_, Self::Message> {
let theme = theme::active();
let cosmic_theme::Spacing {
space_xxs,

View file

@ -10,12 +10,12 @@ use std::{collections::HashMap, path::PathBuf};
use crate::{fl, Action, Config, ConfigState, Message};
pub fn menu_bar<'a>(
config: &Config,
_config: &Config,
config_state: &ConfigState,
key_binds: &HashMap<KeyBind, Action>,
projects: &Vec<(String, PathBuf)>,
projects: &[(String, PathBuf)],
) -> Element<'a, Message> {
let home_dir_opt = dirs::home_dir();
let home_dir_opt = std::env::home_dir();
let format_path = |path: &PathBuf| -> String {
if let Some(home_dir) = &home_dir_opt {
if let Ok(part) = path.strip_prefix(home_dir) {