fix capacity

This commit is contained in:
Stephan Dilly 2021-08-22 12:53:53 +02:00
parent 7e9c988f50
commit 60d512a5b3

View File

@ -24,7 +24,7 @@ use tui::{
Frame, Frame,
}; };
const ELEMENTS_PER_LINE: usize = 10; const ELEMENTS_PER_LINE: usize = 9;
/// ///
pub struct CommitList { pub struct CommitList {
@ -235,8 +235,7 @@ impl CommitList {
now: DateTime<Local>, now: DateTime<Local>,
marked: Option<bool>, marked: Option<bool>,
) -> Spans<'a> { ) -> Spans<'a> {
let mut txt: Vec<Span> = Vec::new(); let mut txt: Vec<Span> = Vec::with_capacity(
txt.reserve(
ELEMENTS_PER_LINE + if marked.is_some() { 2 } else { 0 }, ELEMENTS_PER_LINE + if marked.is_some() { 2 } else { 0 },
); );