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:
parent
04c354584d
commit
27ea8d2770
4 changed files with 9 additions and 21 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -1083,7 +1083,6 @@ name = "cosmic-player"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"dirs",
|
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"fork",
|
"fork",
|
||||||
"gstreamer-tag",
|
"gstreamer-tag",
|
||||||
|
|
@ -1093,13 +1092,11 @@ dependencies = [
|
||||||
"icu_collator",
|
"icu_collator",
|
||||||
"icu_provider",
|
"icu_provider",
|
||||||
"image",
|
"image",
|
||||||
"lazy_static",
|
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"log",
|
"log",
|
||||||
"mpris-server",
|
"mpris-server",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"serde",
|
"serde",
|
||||||
"smol_str",
|
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,8 @@ edition = "2021"
|
||||||
vergen = { version = "8", features = ["git", "gitcl"] }
|
vergen = { version = "8", features = ["git", "gitcl"] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dirs = "5"
|
|
||||||
gstreamer-tag = "0.23"
|
gstreamer-tag = "0.23"
|
||||||
image = "0.24.9"
|
image = "0.24.9"
|
||||||
lazy_static = "1"
|
|
||||||
serde = { version = "1", features = ["serde_derive"] }
|
serde = { version = "1", features = ["serde_derive"] }
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
tokio = { version = "1", features = ["sync"] }
|
tokio = { version = "1", features = ["sync"] }
|
||||||
|
|
@ -45,10 +43,6 @@ features = ["tokio", "winit"]
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.smol_str]
|
|
||||||
version = "0.2.1"
|
|
||||||
features = ["serde"]
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
fork = "0.2"
|
fork = "0.2"
|
||||||
|
|
||||||
|
|
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -103,20 +103,19 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
|
||||||
localize::localize();
|
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) => {
|
Ok(config_handler) => {
|
||||||
let config = match Config::get_entry(&config_handler) {
|
match Config::get_entry(&config_handler) {
|
||||||
Ok(ok) => ok,
|
Ok(ok) => ok,
|
||||||
Err((errs, config)) => {
|
Err((errs, config)) => {
|
||||||
log::error!("errors loading config: {:?}", errs);
|
log::error!("errors loading config: {:?}", errs);
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
(Some(config_handler), config)
|
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("failed to create config handler: {}", 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));
|
settings = settings.size_limits(Limits::NONE.min_width(360.0).min_height(180.0));
|
||||||
|
|
||||||
let flags = Flags {
|
let flags = Flags {
|
||||||
config_handler,
|
|
||||||
config,
|
config,
|
||||||
config_state_handler,
|
config_state_handler,
|
||||||
config_state,
|
config_state,
|
||||||
|
|
@ -195,7 +193,6 @@ impl MenuAction for Action {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Flags {
|
pub struct Flags {
|
||||||
config_handler: Option<cosmic_config::Config>,
|
|
||||||
config: Config,
|
config: Config,
|
||||||
config_state_handler: Option<cosmic_config::Config>,
|
config_state_handler: Option<cosmic_config::Config>,
|
||||||
config_state: ConfigState,
|
config_state: ConfigState,
|
||||||
|
|
@ -1420,7 +1417,7 @@ impl Application for App {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn header_start(&self) -> Vec<Element<Self::Message>> {
|
fn header_start(&self) -> Vec<Element<'_, Self::Message>> {
|
||||||
vec![menu::menu_bar(
|
vec![menu::menu_bar(
|
||||||
&self.flags.config,
|
&self.flags.config,
|
||||||
&self.flags.config_state,
|
&self.flags.config_state,
|
||||||
|
|
@ -1430,7 +1427,7 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a view after each update.
|
/// Creates a view after each update.
|
||||||
fn view(&self) -> Element<Self::Message> {
|
fn view(&self) -> Element<'_, Self::Message> {
|
||||||
let theme = theme::active();
|
let theme = theme::active();
|
||||||
let cosmic_theme::Spacing {
|
let cosmic_theme::Spacing {
|
||||||
space_xxs,
|
space_xxs,
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ use std::{collections::HashMap, path::PathBuf};
|
||||||
use crate::{fl, Action, Config, ConfigState, Message};
|
use crate::{fl, Action, Config, ConfigState, Message};
|
||||||
|
|
||||||
pub fn menu_bar<'a>(
|
pub fn menu_bar<'a>(
|
||||||
config: &Config,
|
_config: &Config,
|
||||||
config_state: &ConfigState,
|
config_state: &ConfigState,
|
||||||
key_binds: &HashMap<KeyBind, Action>,
|
key_binds: &HashMap<KeyBind, Action>,
|
||||||
projects: &Vec<(String, PathBuf)>,
|
projects: &[(String, PathBuf)],
|
||||||
) -> Element<'a, Message> {
|
) -> Element<'a, Message> {
|
||||||
let home_dir_opt = dirs::home_dir();
|
let home_dir_opt = std::env::home_dir();
|
||||||
let format_path = |path: &PathBuf| -> String {
|
let format_path = |path: &PathBuf| -> String {
|
||||||
if let Some(home_dir) = &home_dir_opt {
|
if let Some(home_dir) = &home_dir_opt {
|
||||||
if let Ok(part) = path.strip_prefix(home_dir) {
|
if let Ok(part) = path.strip_prefix(home_dir) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue