Fix lints for clippy 1.75. (#1494)

This commit is contained in:
Laurent Mazare
2023-12-28 20:26:20 +01:00
committed by GitHub
parent cd889c0f8a
commit 1e442d4bb9
6 changed files with 38 additions and 40 deletions

View File

@ -34,8 +34,8 @@ pub enum Msg {
Run,
UpdateStatus(String),
SetModel(ModelData),
WorkerInMsg(WorkerInput),
WorkerOutMsg(Result<WorkerOutput, String>),
WorkerIn(WorkerInput),
WorkerOut(Result<WorkerOutput, String>),
}
pub struct CurrentDecode {
@ -75,7 +75,7 @@ impl Component for App {
let status = "loading weights".to_string();
let cb = {
let link = ctx.link().clone();
move |e| link.send_message(Self::Message::WorkerOutMsg(e))
move |e| link.send_message(Self::Message::WorkerOut(e))
};
let worker = Worker::bridge(std::rc::Rc::new(cb));
Self {
@ -128,11 +128,11 @@ impl Component for App {
let prompt = self.prompt.borrow().clone();
console_log!("temp: {}, top_p: {}, prompt: {}", temp, top_p, prompt);
ctx.link()
.send_message(Msg::WorkerInMsg(WorkerInput::Run(temp, top_p, prompt)))
.send_message(Msg::WorkerIn(WorkerInput::Run(temp, top_p, prompt)))
}
true
}
Msg::WorkerOutMsg(output) => {
Msg::WorkerOut(output) => {
match output {
Ok(WorkerOutput::WeightsLoaded) => self.status = "weights loaded!".to_string(),
Ok(WorkerOutput::GenerationDone(Err(err))) => {
@ -165,7 +165,7 @@ impl Component for App {
}
true
}
Msg::WorkerInMsg(inp) => {
Msg::WorkerIn(inp) => {
self.worker.send(inp);
true
}

View File

@ -42,8 +42,8 @@ pub enum Msg {
Run(usize),
UpdateStatus(String),
SetDecoder(ModelData),
WorkerInMsg(WorkerInput),
WorkerOutMsg(Result<WorkerOutput, String>),
WorkerIn(WorkerInput),
WorkerOut(Result<WorkerOutput, String>),
}
pub struct CurrentDecode {
@ -116,7 +116,7 @@ impl Component for App {
let status = "loading weights".to_string();
let cb = {
let link = ctx.link().clone();
move |e| link.send_message(Self::Message::WorkerOutMsg(e))
move |e| link.send_message(Self::Message::WorkerOut(e))
};
let worker = Worker::bridge(std::rc::Rc::new(cb));
Self {
@ -165,18 +165,16 @@ impl Component for App {
Err(err) => {
let output = Err(format!("decoding error: {err:?}"));
// Mimic a worker output to so as to release current_decode
Msg::WorkerOutMsg(output)
}
Ok(wav_bytes) => {
Msg::WorkerInMsg(WorkerInput::DecodeTask { wav_bytes })
Msg::WorkerOut(output)
}
Ok(wav_bytes) => Msg::WorkerIn(WorkerInput::DecodeTask { wav_bytes }),
}
})
}
//
true
}
Msg::WorkerOutMsg(output) => {
Msg::WorkerOut(output) => {
let dt = self.current_decode.as_ref().and_then(|current_decode| {
current_decode.start_time.and_then(|start_time| {
performance_now().map(|stop_time| stop_time - start_time)
@ -198,7 +196,7 @@ impl Component for App {
}
true
}
Msg::WorkerInMsg(inp) => {
Msg::WorkerIn(inp) => {
self.worker.send(inp);
true
}

View File

@ -33,8 +33,8 @@ pub enum Msg {
Run,
UpdateStatus(String),
SetModel(ModelData),
WorkerInMsg(WorkerInput),
WorkerOutMsg(Result<WorkerOutput, String>),
WorkerIn(WorkerInput),
WorkerOut(Result<WorkerOutput, String>),
}
pub struct CurrentDecode {
@ -117,7 +117,7 @@ impl Component for App {
let status = "loading weights".to_string();
let cb = {
let link = ctx.link().clone();
move |e| link.send_message(Self::Message::WorkerOutMsg(e))
move |e| link.send_message(Self::Message::WorkerOut(e))
};
let worker = Worker::bridge(std::rc::Rc::new(cb));
Self {
@ -166,7 +166,7 @@ impl Component for App {
let status = format!("{err:?}");
Msg::UpdateStatus(status)
}
Ok(image_data) => Msg::WorkerInMsg(WorkerInput::RunData(RunData {
Ok(image_data) => Msg::WorkerIn(WorkerInput::RunData(RunData {
image_data,
conf_threshold: 0.5,
iou_threshold: 0.5,
@ -176,7 +176,7 @@ impl Component for App {
}
true
}
Msg::WorkerOutMsg(output) => {
Msg::WorkerOut(output) => {
match output {
Ok(WorkerOutput::WeightsLoaded) => self.status = "weights loaded!".to_string(),
Ok(WorkerOutput::ProcessingDone(Err(err))) => {
@ -218,7 +218,7 @@ impl Component for App {
}
true
}
Msg::WorkerInMsg(inp) => {
Msg::WorkerIn(inp) => {
self.worker.send(inp);
true
}