mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-20 03:49:45 +00:00
fix: update code and docs about syntax mode (#2248)
which was detected by gemini review.
This commit is contained in:
parent
9d5beb196b
commit
f5db6e8d31
3 changed files with 13 additions and 9 deletions
|
|
@ -7,8 +7,12 @@ mod system {
|
|||
::battery::Manager::new()
|
||||
.ok()
|
||||
.and_then(|manager| manager.batteries().ok())
|
||||
.map(|mut batteries| {
|
||||
batteries.any(|battery| match battery {
|
||||
.map(|batteries| {
|
||||
let mut batteries = batteries.peekable();
|
||||
if batteries.peek().is_none() {
|
||||
return false;
|
||||
}
|
||||
batteries.all(|battery| match battery {
|
||||
Ok(bat) => matches!(bat.state(), ::battery::State::Discharging),
|
||||
Err(_) => false,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue