Apply suggestions from new clippy lint clippy::assigning_clones (#382)

* fix: clippy warnings

* Additional fix

* Write changelog

---------

Co-authored-by: Krithic Kumar <krithickumarub@protonmail.com>
This commit is contained in:
cyqsimon
2024-03-25 13:42:17 +08:00
committed by GitHub
parent 32506e7f24
commit 451daea0ac
3 changed files with 6 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* Remove redundant imports #377 - @cyqsimon
* CI: use GitHub API to exempt dependabot from changelog requirement #378 - @cyqsimon
* Remove unnecessary logging synchronisation #381 - @cyqsimon
* Apply suggestions from new clippy lint clippy::assigning_clones #382 - @cyqsimon
## Added
* CI: include generated assets in release archive #359 - @cyqsimon

View File

@@ -33,7 +33,7 @@ where
terminal.hide_cursor().unwrap();
let state = {
let mut state = UIState::default();
state.interface_name = opts.interface.clone();
state.interface_name.clone_from(&opts.interface);
state.unit_family = opts.render_opts.unit_family.into();
state.cumulative_mode = opts.render_opts.total_utilization;
state

View File

@@ -129,7 +129,9 @@ impl UIState {
.or_default();
connection_data.total_bytes_downloaded += connection_info.total_bytes_downloaded;
connection_data.total_bytes_uploaded += connection_info.total_bytes_uploaded;
connection_data.interface_name = connection_info.interface_name.clone();
connection_data
.interface_name
.clone_from(&connection_info.interface_name);
data_for_remote_address.total_bytes_downloaded +=
connection_info.total_bytes_downloaded;
data_for_remote_address.total_bytes_uploaded +=
@@ -179,7 +181,7 @@ impl UIState {
let proc_info = proc_info
.cloned()
.unwrap_or_else(|| ProcessInfo::new("<UNKNOWN>", 0));
connection_data.process_name = proc_info.name.clone();
connection_data.process_name.clone_from(&proc_info.name);
processes.entry(proc_info).or_default()
};