@@ -4,7 +4,6 @@ use crate::{
4
4
utils,
5
5
} ;
6
6
use gethostname:: gethostname;
7
- use lazy_static:: lazy_static;
8
7
use librespot:: {
9
8
core:: { cache:: Cache , config:: DeviceType as LSDeviceType , config:: SessionConfig , version} ,
10
9
playback:: config:: { Bitrate as LSBitrate , PlayerConfig } ,
@@ -18,26 +17,16 @@ use url::Url;
18
17
19
18
const CONFIG_FILE_NAME : & str = "spotifyd.conf" ;
20
19
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
+ ] ;
41
30
42
31
/// The backend used by librespot
43
32
#[ derive( Clone , Copy , Debug , Deserialize , PartialEq , StructOpt ) ]
@@ -74,18 +63,13 @@ impl ToString for Backend {
74
63
}
75
64
}
76
65
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
+ ] ;
89
73
90
74
#[ derive( Clone , Copy , Debug , Deserialize , PartialEq , StructOpt ) ]
91
75
#[ serde( rename_all = "snake_case" ) ]
@@ -109,18 +93,16 @@ impl FromStr for VolumeController {
109
93
}
110
94
}
111
95
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
+ ] ;
124
106
125
107
// Spotify's device type (copied from it's config.rs)
126
108
#[ derive( Clone , Copy , Debug , Deserialize , PartialEq , StructOpt ) ]
@@ -185,9 +167,7 @@ impl ToString for DeviceType {
185
167
}
186
168
}
187
169
188
- lazy_static ! {
189
- static ref BITRATE_VALUES : Vec <& ' static str > = vec![ "96" , "160" , "320" ] ;
190
- }
170
+ static BITRATE_VALUES : & [ & str ] = & [ "96" , "160" , "320" ] ;
191
171
192
172
/// Spotify's audio bitrate
193
173
#[ derive( Clone , Copy , Debug , PartialEq , StructOpt ) ]
0 commit comments