mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 09:58:27 +00:00
Simplify
This commit is contained in:
parent
c0c5a281fd
commit
f5d315dbaf
@ -78,7 +78,7 @@ impl TextRenderer {
|
||||
},
|
||||
);
|
||||
|
||||
for (op, selected, indent) in operations.operations().into_iter() {
|
||||
for (op, selected, indent) in operations.operations() {
|
||||
let mut attrs = glyphon::Attrs::new();
|
||||
|
||||
if selected {
|
||||
|
@ -24,15 +24,13 @@ impl OperationView {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn operations(&self) -> Vec<(&Self, bool, usize)> {
|
||||
iter::once((self, true, 0))
|
||||
.chain(
|
||||
self.children
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, op)| (op, Some(i) == self.selected, 1)),
|
||||
)
|
||||
.collect()
|
||||
pub fn operations(&self) -> impl Iterator<Item = (&Self, bool, usize)> {
|
||||
iter::once((self, true, 0)).chain(
|
||||
self.children
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, op)| (op, Some(i) == self.selected, 1)),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn select_last(&mut self) {
|
||||
@ -55,7 +53,6 @@ impl OperationView {
|
||||
self.selected
|
||||
.and_then(|selected| {
|
||||
self.operations()
|
||||
.into_iter()
|
||||
.nth(selected)
|
||||
.map(|(op, _, _)| op)
|
||||
.cloned()
|
||||
@ -64,7 +61,7 @@ impl OperationView {
|
||||
}
|
||||
|
||||
fn last_index(&self) -> usize {
|
||||
self.operations().len().saturating_sub(1)
|
||||
self.operations().count().saturating_sub(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user