mirror of https://github.com/helix-editor/helix
use format! instead of preallocating
this is more efficient apparentlypull/13133/head
parent
07c69c1e74
commit
8f0721f00a
|
@ -71,11 +71,5 @@ pub fn format_relative_time(timestamp: i64, timezone_offset: i32) -> String {
|
||||||
"from now"
|
"from now"
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut relative_time = String::with_capacity(value.len() + 1 + unit.len() + 1 + label.len());
|
format!("{value} {unit} {label}")
|
||||||
relative_time.push_str(&value);
|
|
||||||
relative_time.push(' ');
|
|
||||||
relative_time.push_str(unit);
|
|
||||||
relative_time.push(' ');
|
|
||||||
relative_time.push_str(label);
|
|
||||||
relative_time
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue