Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 91a1d01

Browse files
committed
Apply clippy lints
1 parent 17d61b6 commit 91a1d01

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

src/controller.rs

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -503,65 +503,60 @@ pub fn create_supervisor_listener(
503503
std::thread::spawn(move || {
504504
let rt = Runtime::new().unwrap();
505505
rt.block_on(async {
506-
loop {
507-
if let Some(r_msg) = client_recv.next().await {
508-
trace!("Message received from supervisor client");
509-
match r_msg {
510-
Ok(msg) => match msg {
511-
TMessage::Text(data) => {
512-
if data == "Reset" {
513-
sender
514-
.send(SupervisorAction::Quit)
515-
.expect("Could not send SupervisorAction");
516-
break;
517-
} else if data == "Received" {
518-
sender
519-
.send(SupervisorAction::Received)
520-
.expect("Could not send SupervisorAction");
521-
} else if data.contains("Map") || data.contains("map") {
522-
sender
523-
.send(SupervisorAction::Config(data))
524-
.expect("Could not send config");
525-
} else if data == "Quit" {
526-
sender
527-
.send(SupervisorAction::ForceQuit)
528-
.expect("Could not send ForceQuit");
529-
}
530-
}
531-
TMessage::Ping(payload) => {
506+
while let Some(r_msg) = client_recv.next().await {
507+
trace!("Message received from supervisor client");
508+
match r_msg {
509+
Ok(msg) => match msg {
510+
TMessage::Text(data) => {
511+
if data == "Reset" {
512+
sender
513+
.send(SupervisorAction::Quit)
514+
.expect("Could not send SupervisorAction");
515+
break;
516+
} else if data == "Received" {
532517
sender
533-
.send(SupervisorAction::Ping(payload))
518+
.send(SupervisorAction::Received)
534519
.expect("Could not send SupervisorAction");
520+
} else if data.contains("Map") || data.contains("map") {
521+
sender
522+
.send(SupervisorAction::Config(data))
523+
.expect("Could not send config");
524+
} else if data == "Quit" {
525+
sender
526+
.send(SupervisorAction::ForceQuit)
527+
.expect("Could not send ForceQuit");
535528
}
536-
_ => {}
537-
},
538-
Err(Error::AlreadyClosed) => {
539-
error!("Supervisor Error::AlreadyClosed");
540-
sender
541-
.send(SupervisorAction::ForceQuit)
542-
.expect("Could not send ForceQuit");
543-
break;
544529
}
545-
Err(Error::Capacity(e)) => {
546-
error!("{:?}", e);
530+
TMessage::Ping(payload) => {
547531
sender
548-
.send(SupervisorAction::ForceQuit)
549-
.expect("Could not send ForceQuit");
550-
break;
551-
}
552-
Err(e) => {
553-
error!("{:?}", e);
554-
sender
555-
.send(SupervisorAction::ForceQuit)
556-
.expect("Could not send ForceQuit");
557-
break;
532+
.send(SupervisorAction::Ping(payload))
533+
.expect("Could not send SupervisorAction");
558534
}
535+
_ => {}
536+
},
537+
Err(Error::AlreadyClosed) => {
538+
error!("Supervisor Error::AlreadyClosed");
539+
sender
540+
.send(SupervisorAction::ForceQuit)
541+
.expect("Could not send ForceQuit");
542+
break;
543+
}
544+
Err(Error::Capacity(e)) => {
545+
error!("{:?}", e);
546+
sender
547+
.send(SupervisorAction::ForceQuit)
548+
.expect("Could not send ForceQuit");
549+
break;
550+
}
551+
Err(e) => {
552+
error!("{:?}", e);
553+
sender
554+
.send(SupervisorAction::ForceQuit)
555+
.expect("Could not send ForceQuit");
556+
break;
559557
}
560-
} else {
561-
break;
562558
}
563559
}
564-
return;
565560
});
566561
});
567562
}

0 commit comments

Comments
 (0)