diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2024-03-25 13:42:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 13:42:17 +0800 |
commit | 451daea0aca8c241c6cc3e33aabf5aed57ddd0e8 (patch) | |
tree | db2df4215f65000fb73af6c77b717940686a32c7 | |
parent | 32506e7f245171b43b22df1bda7fbcfcc7717f3e (diff) |
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>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/display/ui.rs | 2 | ||||
-rw-r--r-- | src/display/ui_state.rs | 6 |
3 files changed, 6 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b68a2..5ee803b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/display/ui.rs b/src/display/ui.rs index e9df82d..7f7994c 100644 --- a/src/display/ui.rs +++ b/src/display/ui.rs @@ -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 diff --git a/src/display/ui_state.rs b/src/display/ui_state.rs index e01bbf3..95aa9d2 100644 --- a/src/display/ui_state.rs +++ b/src/display/ui_state.rs @@ -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() }; |