Skip to content

Commit

Permalink
Fix two manual let-else
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Jan 10, 2025
1 parent 623687e commit 7dee2f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 4 additions & 7 deletions src/niri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,13 +1536,10 @@ impl State {

debug!(session_id, "StartCast");

let gbm = match self.backend.gbm_device() {
Some(gbm) => gbm,
None => {
warn!("error starting screencast: no GBM device available");
self.niri.stop_cast(session_id);
return;
}
let Some(gbm) = self.backend.gbm_device() else {
warn!("error starting screencast: no GBM device available");
self.niri.stop_cast(session_id);
return;
};

let pw = if let Some(pw) = &self.niri.pipewire {
Expand Down
9 changes: 3 additions & 6 deletions src/pw_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,9 @@ impl Cast {
return false;
}

let mut buffer = match self.stream.dequeue_buffer() {
Some(buffer) => buffer,
None => {
warn!("no available buffer in pw stream, skipping frame");
return false;
}
let Some(mut buffer) = self.stream.dequeue_buffer() else {
warn!("no available buffer in pw stream, skipping frame");
return false;
};

let fd = buffer.datas_mut()[0].as_raw().fd;
Expand Down

0 comments on commit 7dee2f6

Please sign in to comment.