Skip to content

Commit 17126e5

Browse files
authored
Merge branch 'master' into toml_config
2 parents a5c7933 + 7c34e6b commit 17126e5

File tree

3 files changed

+28
-50
lines changed

3 files changed

+28
-50
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ futures = "0.1"
1919
gethostname = "0.2.0"
2020
hex = "0.4"
2121
keyring = { version = "0.9.0", optional = true }
22-
lazy_static = "1.4.0"
2322
libc = "0.2.73"
2423
log = "0.4.6"
2524
percent-encoding = "2.1.0"

src/config.rs

+28-48
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::{
44
utils,
55
};
66
use gethostname::gethostname;
7-
use lazy_static::lazy_static;
87
use librespot::{
98
core::{cache::Cache, config::DeviceType as LSDeviceType, config::SessionConfig, version},
109
playback::config::{Bitrate as LSBitrate, PlayerConfig},
@@ -18,26 +17,16 @@ use url::Url;
1817

1918
const CONFIG_FILE_NAME: &str = "spotifyd.conf";
2019

21-
lazy_static! {
22-
static ref BACKEND_VALUES: Vec<&'static str> = {
23-
let mut vec = Vec::new();
24-
25-
if cfg!(feature = "alsa_backend") {
26-
vec.push("alsa");
27-
}
28-
if cfg!(feature = "pulseaudio_backend") {
29-
vec.push("pulseaudio");
30-
}
31-
if cfg!(feature = "portaudio_backend") {
32-
vec.push("portaudio");
33-
}
34-
if cfg!(feature = "rodio_backend") {
35-
vec.push("rodio");
36-
}
37-
38-
vec
39-
};
40-
}
20+
static BACKEND_VALUES: &[&str] = &[
21+
#[cfg(feature = "alsa_backend")]
22+
"alsa",
23+
#[cfg(feature = "pulseaudio_backend")]
24+
"pulseaudio",
25+
#[cfg(feature = "portaudio_backend")]
26+
"portaudio",
27+
#[cfg(feature = "rodio_backend")]
28+
"rodio",
29+
];
4130

4231
/// The backend used by librespot
4332
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, StructOpt)]
@@ -74,18 +63,13 @@ impl ToString for Backend {
7463
}
7564
}
7665

77-
lazy_static! {
78-
static ref VOLUME_CONTROLLER_VALUES: Vec<&'static str> = {
79-
let mut vec = vec!["softvol"];
80-
81-
if cfg!(feature = "alsa_backend") {
82-
vec.push("alsa");
83-
vec.push("alsa_linear");
84-
}
85-
86-
vec
87-
};
88-
}
66+
static VOLUME_CONTROLLER_VALUES: &[&str] = &[
67+
"softvol",
68+
#[cfg(feature = "alsa_backend")]
69+
"alsa",
70+
#[cfg(feature = "alsa_backend")]
71+
"alsa_linear",
72+
];
8973

9074
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, StructOpt)]
9175
#[serde(rename_all = "snake_case")]
@@ -109,18 +93,16 @@ impl FromStr for VolumeController {
10993
}
11094
}
11195

112-
lazy_static! {
113-
static ref DEVICETYPE_VALUES: Vec<&'static str> = vec![
114-
"computer",
115-
"tablet",
116-
"smartphone",
117-
"speaker",
118-
"tv",
119-
"avr",
120-
"stb",
121-
"audiodongle"
122-
];
123-
}
96+
static DEVICETYPE_VALUES: &[&str] = &[
97+
"computer",
98+
"tablet",
99+
"smartphone",
100+
"speaker",
101+
"tv",
102+
"avr",
103+
"stb",
104+
"audiodongle",
105+
];
124106

125107
// Spotify's device type (copied from it's config.rs)
126108
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, StructOpt)]
@@ -185,9 +167,7 @@ impl ToString for DeviceType {
185167
}
186168
}
187169

188-
lazy_static! {
189-
static ref BITRATE_VALUES: Vec<&'static str> = vec!["96", "160", "320"];
190-
}
170+
static BITRATE_VALUES: &[&str] = &["96", "160", "320"];
191171

192172
/// Spotify's audio bitrate
193173
#[derive(Clone, Copy, Debug, PartialEq, StructOpt)]

0 commit comments

Comments
 (0)