mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-10-02 19:53:27 +00:00
perf: pre-allocate strings
This commit is contained in:
parent
c139026704
commit
9713138e94
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ pub fn get_current() -> Result<String, io::Error> {
|
|||
let hours = (uptime_seconds / 3600) % 24;
|
||||
let minutes = (uptime_seconds / 60) % 60;
|
||||
|
||||
let mut result = String::new();
|
||||
let mut result = String::with_capacity(32);
|
||||
if days > 0 {
|
||||
result.push_str(&days.to_string());
|
||||
result.push_str(if days == 1 { " day" } else { " days" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue