diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2023-07-01 03:28:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-01 03:28:23 -0400 |
commit | 3f53818c54502bcfa02a920ed7b8d288b5edf201 (patch) | |
tree | bc189032a33b6af24f97b7af078a1a5167f0e3c5 /src/app | |
parent | dce30ee882195b5e0a5a1971067b7279227eba7e (diff) |
other: remove some unnecessary vec allocations (#1234)
* other: remove unnecessary vector allocations in farmer
* other: remove unnecessary vector allocations when drawing tui Rows
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/data_farmer.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/app/data_farmer.rs b/src/app/data_farmer.rs index d1db6070..37e58229 100644 --- a/src/app/data_farmer.rs +++ b/src/app/data_farmer.rs @@ -318,7 +318,7 @@ impl DataCollection { cpu.iter() .for_each(|cpu| new_entry.cpu_data.push(cpu.cpu_usage)); - self.cpu_harvest = cpu.to_vec(); + self.cpu_harvest = cpu; } fn eat_load_avg(&mut self, load_avg: cpu::LoadAvgHarvest, new_entry: &mut TimedData) { @@ -328,14 +328,12 @@ impl DataCollection { } fn eat_temp(&mut self, temperature_sensors: Vec<temperature::TempHarvest>) { - // TODO: [PO] To implement - self.temp_harvest = temperature_sensors.to_vec(); + self.temp_harvest = temperature_sensors; } fn eat_disks( &mut self, disks: Vec<disks::DiskHarvest>, io: disks::IoHarvest, harvested_time: Instant, ) { - // TODO: [PO] To implement let time_since_last_harvest = harvested_time .duration_since(self.current_instant) .as_secs_f64(); @@ -457,6 +455,6 @@ impl DataCollection { gpu.iter().for_each(|data| { new_entry.gpu_data.push(data.1.use_percent); }); - self.gpu_harvest = gpu.to_vec(); + self.gpu_harvest = gpu; } } |