Fix clippy warnings: needless lifetime, sort_by_key, dead_code guard field
- find_block: elide the unnecessary 'a lifetime - scan_wifi: use sort_by_key(Reverse) instead of sort_by for the signal-descending sort - WatcherHandle: mark the RecommendedWatcher field as intentionally unread — it's held only to keep the watcher alive for the process lifetime, never accessed directly
This commit is contained in:
parent
68db82dee1
commit
4741dff61b
3 changed files with 3 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ pub struct BreadbarStyle {
|
||||||
pub notification_border_radius: u32,
|
pub notification_border_radius: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_block<'a>(css: &'a str, selector: &str) -> Option<(usize, usize)> {
|
fn find_block(css: &str, selector: &str) -> Option<(usize, usize)> {
|
||||||
let pat = format!(r"(?m)^\s*{}\s*\{{", regex::escape(selector));
|
let pat = format!(r"(?m)^\s*{}\s*\{{", regex::escape(selector));
|
||||||
let re = Regex::new(&pat).ok()?;
|
let re = Regex::new(&pat).ok()?;
|
||||||
let m = re.find(css)?;
|
let m = re.find(css)?;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ pub async fn scan_wifi() -> Vec<WifiNetwork> {
|
||||||
by_ssid.entry(ssid.to_string()).and_modify(|existing| if net.signal > existing.signal { *existing = net.clone() }).or_insert(net);
|
by_ssid.entry(ssid.to_string()).and_modify(|existing| if net.signal > existing.signal { *existing = net.clone() }).or_insert(net);
|
||||||
}
|
}
|
||||||
let mut list: Vec<_> = by_ssid.into_values().collect();
|
let mut list: Vec<_> = by_ssid.into_values().collect();
|
||||||
list.sort_by(|a, b| b.signal.cmp(&a.signal));
|
list.sort_by_key(|n| std::cmp::Reverse(n.signal));
|
||||||
list
|
list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ pub fn watch_and_emit(app: &AppHandle) {
|
||||||
app.manage(WatcherHandle(watcher));
|
app.manage(WatcherHandle(watcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WatcherHandle(RecommendedWatcher);
|
struct WatcherHandle(#[allow(dead_code)] RecommendedWatcher);
|
||||||
|
|
||||||
fn tracing_or_eprintln(msg: &str) {
|
fn tracing_or_eprintln(msg: &str) {
|
||||||
eprintln!("{msg}");
|
eprintln!("{msg}");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue