@@ -21,10 +21,13 @@ fn utf8bytes_to_string(bytes: Utf8Bytes) -> String {
2121 bytes. to_string ( )
2222}
2323
24+ #[ allow( unused_imports) ]
25+ use crate :: master:: SlaveConnection ;
26+ #[ allow( unused_imports) ]
27+ use crate :: servers:: send_termination_message;
2428use crate :: {
2529 app_state:: AppState , configuration:: Config , controlled_program:: ControlledProgramDescriptor ,
26- master:: SlaveConnection , messages:: * , servers:: send_termination_message,
27- theme:: ThemeCollection ,
30+ messages:: * , theme:: ThemeCollection ,
2831} ;
2932#[ no_mangle]
3033pub async fn handle_ws_upgrade ( ws : WebSocketUpgrade , State ( state) : State < AppState > ) -> Response {
@@ -127,10 +130,8 @@ async fn process_message(text: String, state: AppState) {
127130 . unwrap_or_else ( || "themes" . to_string ( ) ) ;
128131 drop ( config) ;
129132
130- let theme_collection = match ThemeCollection :: load_from_directory ( & themes_folder) {
131- Ok ( collection) => collection,
132- Err ( _) => ThemeCollection :: default ( ) ,
133- } ;
133+ let theme_collection =
134+ ThemeCollection :: load_from_directory ( & themes_folder) . unwrap_or_default ( ) ;
134135
135136 let theme_names: Vec < String > = theme_collection
136137 . themes
@@ -148,6 +149,7 @@ async fn process_message(text: String, state: AppState) {
148149 }
149150 "getThemeCSS" => {
150151 #[ derive( Deserialize ) ]
152+ #[ allow( dead_code) ]
151153 struct GetThemeCSSWeb {
152154 r#type : String ,
153155 theme_name : String ,
@@ -169,10 +171,8 @@ async fn process_message(text: String, state: AppState) {
169171 . unwrap_or_else ( || "themes" . to_string ( ) ) ;
170172 drop ( config) ;
171173
172- let theme_collection = match ThemeCollection :: load_from_directory ( & themes_folder) {
173- Ok ( collection) => collection,
174- Err ( _) => ThemeCollection :: default ( ) ,
175- } ;
174+ let theme_collection =
175+ ThemeCollection :: load_from_directory ( & themes_folder) . unwrap_or_default ( ) ;
176176
177177 let css = if let Some ( theme) = theme_collection
178178 . themes
@@ -227,14 +227,14 @@ async fn process_message(text: String, state: AppState) {
227227 specialized_info : server. specialized_server_info . clone ( ) ,
228228 host : None ,
229229 } ;
230- if val. arguments . get ( 0 ) . copied ( ) . unwrap_or ( false ) {
230+ if val. arguments . first ( ) . copied ( ) . unwrap_or ( false ) {
231231 let cl: String = server. curr_output_in_progress . clone ( ) ;
232232 let split: Vec < & str > = cl. split ( "\n " ) . collect ( ) ;
233233 let mut inp = split. len ( ) ;
234234 if inp < 150 {
235235 inp = 0 ;
236236 } else {
237- inp = inp - 150 ;
237+ inp -= 150 ;
238238 }
239239 s_info. output = split[ inp..split. len ( ) ] . join ( "\n " ) ;
240240 }
@@ -283,7 +283,7 @@ async fn process_message(text: String, state: AppState) {
283283 drop ( servers) ;
284284 let config = state. config . lock ( ) . await ;
285285 #[ allow( unused) ]
286- let slave = config. slave . clone ( ) ;
286+ let slave = config. slave ;
287287 drop ( config) ;
288288 // If not active, and value is "start", start the server
289289 if !is_active_server && value. value == "start" {
@@ -311,6 +311,7 @@ async fn process_message(text: String, state: AppState) {
311311 }
312312 "configChange" => {
313313 #[ derive( Deserialize ) ]
314+ #[ allow( dead_code) ]
314315 struct ConfigChangeMessage {
315316 r#type : String ,
316317 #[ serde( alias = "updatedConfig" , alias = "updated_config" ) ]
0 commit comments