Allocating with capacity
This commit is contained in:
parent
217ce94e1c
commit
21584f4edf
3 changed files with 7 additions and 6 deletions
|
|
@ -35,7 +35,7 @@ fn layout_groups(area: Rect, groups: &[GroupViewState]) -> Vec<Rect> {
|
|||
let line_height = content_height as usize / total_lines;
|
||||
|
||||
let mut current_y = area.y + 1;
|
||||
let mut areas = Vec::new();
|
||||
let mut areas = Vec::with_capacity(groups.len());
|
||||
|
||||
for group in groups {
|
||||
let group_lines = group.monitors.len() + 2;
|
||||
|
|
@ -185,13 +185,14 @@ fn get_formated_line(text: String, color: Color, modifier: Modifier) -> Line<'st
|
|||
}
|
||||
|
||||
fn create_status_line_spans(status_history: &[MonitorStatus]) -> Line<'_> {
|
||||
let mut spans = Vec::new();
|
||||
let recent_status: Vec<_> = status_history
|
||||
.iter()
|
||||
.rev()
|
||||
.take(STATUS_LINE_LENGTH)
|
||||
.collect();
|
||||
|
||||
let mut spans = Vec::with_capacity(recent_status.len());
|
||||
|
||||
for status in recent_status.iter().rev() {
|
||||
let c = get_status_char(status);
|
||||
let color = get_status_color(status);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue