Skip to content

Commit e974d2e

Browse files
author
g
committed
fix: replace unnecessary unwrap with if let Ok pattern
1 parent 9ad7159 commit e974d2e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/handler.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,7 @@ pub async fn handle_commands(
400400
use obws::requests::ui::OpenVideoMixProjector;
401401
use obws::requests::ui::VideoMixType::Program as OpenVideoMixProjectorType;
402402
println!("Open fullscreen projector");
403-
let monitor_list_res = client.ui().list_monitors().await;
404-
if monitor_list_res.is_ok() {
405-
let monitor_list = monitor_list_res.unwrap();
403+
if let Ok(monitor_list) = client.ui().list_monitors().await {
406404
if monitor_list.len() > (*monitor_index as usize) {
407405
let res = client
408406
.ui()
@@ -428,9 +426,7 @@ pub async fn handle_commands(
428426
use obws::requests::ui::Location::MonitorIndex as MonitorLocationIndex;
429427
use obws::requests::ui::OpenSourceProjector;
430428
println!("Open source projector");
431-
let monitor_list_res = client.ui().list_monitors().await;
432-
if monitor_list_res.is_ok() {
433-
let monitor_list = monitor_list_res.unwrap();
429+
if let Ok(monitor_list) = client.ui().list_monitors().await {
434430
if monitor_list.len() > (*monitor_index as usize) {
435431
let res = client
436432
.ui()

0 commit comments

Comments
 (0)