mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-10 20:04:20 +01:00
simplify prev function
Thanks chatgpt, I thought this was more verbose than it could have been. Changelog-None: Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -240,13 +240,7 @@ impl<'a> NavTitle<'a> {
|
||||
}
|
||||
|
||||
fn prev<R>(xs: &[R]) -> Option<&R> {
|
||||
let len = xs.len() as i32;
|
||||
let ind = len - 2;
|
||||
if ind < 0 {
|
||||
None
|
||||
} else {
|
||||
Some(&xs[ind as usize])
|
||||
}
|
||||
xs.get(xs.len().checked_sub(2)?)
|
||||
}
|
||||
|
||||
fn chevron(
|
||||
|
||||
Reference in New Issue
Block a user