format monitor helpers
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
e39796fd9e9023ae7b34a397d13e5b8a63e6a940- Parents
-
315dfe6 - Tree
9c0ded7
e39796f
e39796fd9e9023ae7b34a397d13e5b8a63e6a940315dfe6
9c0ded7| Status | File | + | - |
|---|---|---|---|
| M |
tarmac/src/core/monitor.rs
|
2 | 8 |
tarmac/src/core/monitor.rsmodified@@ -57,18 +57,12 @@ pub fn next_index_nowrap(monitors: &[Monitor], from: usize) -> Option<usize> { | ||
| 57 | 57 | pub fn prev_index_nowrap(monitors: &[Monitor], from: usize) -> Option<usize> { |
| 58 | 58 | let sorted = sorted_indices(monitors); |
| 59 | 59 | let pos = sorted.iter().position(|&i| i == from).unwrap_or(0); |
| 60 | - if pos > 0 { | |
| 61 | - Some(sorted[pos - 1]) | |
| 62 | - } else { | |
| 63 | - None | |
| 64 | - } | |
| 60 | + if pos > 0 { Some(sorted[pos - 1]) } else { None } | |
| 65 | 61 | } |
| 66 | 62 | |
| 67 | 63 | /// Find which monitor index contains a screen point. |
| 68 | 64 | pub fn index_at_point(monitors: &[Monitor], x: f64, y: f64) -> Option<usize> { |
| 69 | - monitors | |
| 70 | - .iter() | |
| 71 | - .position(|m| m.frame.contains_point(x, y)) | |
| 65 | + monitors.iter().position(|m| m.frame.contains_point(x, y)) | |
| 72 | 66 | } |
| 73 | 67 | |
| 74 | 68 | #[cfg(test)] |