[pdm-devel] [PATCH proxmox-yew-comp 11/15] use std::mem::swap instead of manual swapping
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Jan 13 15:27:21 CET 2025
Fixes:
warning: this looks like you are swapping `start_x` and `end_x` manually
--> src/rrd_graph_new.rs:643:25
|
643 | / let t = start_x;
644 | | start_x = end_x;
645 | | end_x = t;
| |__________________________________^ help: try: `std::mem::swap(&mut start_x, &mut end_x);`
|
= note: or maybe you should use `std::mem::replace`?
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap
= note: `#[warn(clippy::manual_swap)]` on by default
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
src/rrd_graph_new.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/rrd_graph_new.rs b/src/rrd_graph_new.rs
index 0b08e08..32b6126 100644
--- a/src/rrd_graph_new.rs
+++ b/src/rrd_graph_new.rs
@@ -640,9 +640,7 @@ impl PwtRRDGraph {
let mut end_x = compute_x(*end_data);
if start_x > end_x {
- let t = start_x;
- start_x = end_x;
- end_x = t;
+ std::mem::swap(&mut start_x, &mut end_x);
}
let start_y = compute_y(min_data);
--
2.39.5
More information about the pdm-devel
mailing list