commit e9e9e400afb049dabdb1aad8b1521f231febdf83
parent e14339810dff44c4728aa42563c2e388d1a05d76
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 7 Feb 2025 21:10:13 -0800
improve code perf
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -1270,8 +1270,8 @@ fn post_msg(client: &Client, post_type_recv: PostType, full_url: &str, session:
}
PostType::Incognito => {
set_profile_base_info(&client, full_url, &mut params)?;
- if params.iter().any(|(key, _)| *key == "incognito") {
- params.retain(|(key, _)| *key != "incognito");
+ if let Some(pos) = params.iter().position(|(key, _)| *key == "incognito") {
+ params.remove(pos);
} else {
params.push(("incognito", "on".to_owned()));
}