cli/node: Replace manual pushing with Table::extend()

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2025-09-07 12:42:24 +02:00 committed by Lorenz Leutgeb
parent 2f28232676
commit 646d4360e7
1 changed files with 5 additions and 3 deletions

View File

@ -375,7 +375,7 @@ pub fn sessions(node: &Node) -> Result<Option<term::Table<5, term::Label>>, node
]);
table.divider();
for sess in sessions {
table.extend(sessions.into_iter().map(|sess| {
let nid = term::format::tertiary(term::format::node_id_human(&sess.nid)).into();
let (addr, state, time) = match sess.state {
node::State::Initial => (
@ -403,8 +403,10 @@ pub fn sessions(node: &Node) -> Result<Option<term::Table<5, term::Label>>, node
node::Link::Inbound => term::Label::from(link_direction_inbound()),
node::Link::Outbound => term::Label::from(link_direction_outbound()),
};
table.push([nid, addr, state, direction, time]);
}
[nid, addr, state, direction, time]
}));
Ok(Some(table))
}