Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Jan 3, 2024
1 parent f0d55a8 commit 51ea282
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src-tauri/src/monitors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::ffi::OsStr;

use monitor::{Feature, Interface, Monitor};
use serde::{Deserialize, Serialize};
use tauri::async_runtime::RwLock;
Expand Down Expand Up @@ -33,10 +35,11 @@ pub async fn get_monitors(monitors: State<'_, Monitors>) -> JSResult<Vec<String>
.collect())
}

fn get_monitor_by_id<'a>(monitors: &'a Vec<Monitor>, id: &'_ str) -> JSResult<&'a Monitor> {
fn get_monitor_by_id<'a>(monitors: &'a [Monitor], id: &'_ str) -> JSResult<&'a Monitor> {
let id_os: &OsStr = id.as_ref();
monitors
.iter()
.find(|monitor| monitor.id.to_string_lossy() == id)
.find(|monitor| monitor.id == id_os)
.ok_or_else(|| format!("no such monitor: '{id}'").into())
}

Expand Down

0 comments on commit 51ea282

Please sign in to comment.