battery: Fix clippy lints
This commit is contained in:
parent
7dbab103a8
commit
d1dcbd4915
4 changed files with 6 additions and 6 deletions
|
|
@ -111,7 +111,7 @@ impl Application for CosmicBatteryApplet {
|
|||
}
|
||||
}
|
||||
Message::SetScreenBrightness(brightness) => {
|
||||
self.screen_brightness = (brightness as f64 / 100.0).max(0.01).min(1.0);
|
||||
self.screen_brightness = (brightness as f64 / 100.0).clamp(0.01, 1.0);
|
||||
if let Some(tx) = &self.screen_sender {
|
||||
let _ = tx.send(ScreenBacklightRequest::Set(self.screen_brightness));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,10 +114,10 @@ async fn start_listening<I: Copy>(
|
|||
let b = (backlight.brightness().await.unwrap_or_default() as f64
|
||||
/ backlight.max_brightness().await.unwrap_or(1) as f64)
|
||||
.clamp(0., 1.);
|
||||
return (
|
||||
(
|
||||
Some((id, ScreenBacklightUpdate::Init(tx, b))),
|
||||
State::Waiting(backlight, screen_proxy, rx),
|
||||
);
|
||||
)
|
||||
}
|
||||
State::Waiting(backlight, proxy, mut rx) => match rx.recv().await {
|
||||
Some(req) => match req {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ async fn start_listening<I: Copy>(id: I, state: State) -> (Option<(I, DeviceDbus
|
|||
State::Waiting(device),
|
||||
);
|
||||
}
|
||||
return (None, State::Finished);
|
||||
(None, State::Finished)
|
||||
}
|
||||
State::Waiting(device) => {
|
||||
let mut stream = futures::stream_select!(
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ async fn start_listening<I: Copy>(
|
|||
|
||||
let b = kbd_proxy.get_brightness().await.unwrap_or_default() as f64
|
||||
/ kbd_proxy.get_max_brightness().await.unwrap_or(1) as f64;
|
||||
return (
|
||||
(
|
||||
Some((id, KeyboardBacklightUpdate::Init(tx, b))),
|
||||
State::Waiting(kbd_proxy, rx),
|
||||
);
|
||||
)
|
||||
}
|
||||
State::Waiting(proxy, mut rx) => match rx.recv().await {
|
||||
Some(req) => match req {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue