Skip to content

Commit

Permalink
remove unwrap_or_break macro
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxVerevkin committed Oct 8, 2023
1 parent 830c398 commit 82192ee
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/blocks/xrandr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ impl Monitor {
}
}

macro_rules! unwrap_or_break {
($e: expr) => {
match $e {
Some(e) => e,
None => break,
}
};
}

async fn get_monitors() -> Result<Vec<Monitor>> {
let mut monitors = Vec::new();

Expand Down Expand Up @@ -174,11 +165,7 @@ async fn get_monitors() -> Result<Vec<Monitor>> {

let mut it = monitors_info.lines().filter(|line| regex.is_match(line));

#[allow(clippy::while_let_loop)]
loop {
let line1 = unwrap_or_break!(it.next());
let line2 = unwrap_or_break!(it.next());

while let (Some(line1), Some(line2)) = (it.next(), it.next()) {
let mut tokens = line1.split_ascii_whitespace().peekable();
let name = tokens.next().error("Failed to parse xrandr output")?.into();
let _ = tokens.next();
Expand Down

0 comments on commit 82192ee

Please sign in to comment.