From 64278afa9d75c150ab30cbc049a9a2a9e6a55e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E6=95=B0?= <33194175+hanshuaikang@users.noreply.github.com> Date: Sat, 25 Jan 2025 17:24:52 +0800 Subject: [PATCH] fix: chart display sort (#56) --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b7cd8fe..10d206d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,11 @@ async fn main() -> Result<(), Box> { } - let targets: Vec = args.target.into_iter().collect::>().into_iter().collect(); + // after de-duplication, the original order is still preserved + let mut seen = HashSet::new(); + let targets: Vec = args.target.into_iter() + .filter(|item| seen.insert(item.clone())) + .collect(); let res = run_app(targets, args.count, args.interval, running.clone(), args.force_ipv6, args.multiple, args.view_type).await;