From 251ab95ac576fb5b774d4fd23c563464830024f1 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 6 Apr 2023 23:02:20 +0100 Subject: [PATCH] Neater rtsim_npc --- server/src/cmd.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 04616f7966..da2b46ce45 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -1276,6 +1276,7 @@ fn handle_rtsim_npc( if let (Some(query), count) = parse_cmd_args!(args, String, u32) { let terms = query .split(',') + .filter(|s| !s.is_empty()) .map(|s| s.trim().to_lowercase()) .collect::>(); @@ -1294,9 +1295,9 @@ fn handle_rtsim_npc( format!("{:?}", npc.mode), format!("{}", idx), ]; - terms.iter().all(|term| { - term == "" || tags.iter().any(|tag| term.eq_ignore_ascii_case(tag.trim())) - }) + terms + .iter() + .all(|term| tags.iter().any(|tag| term.eq_ignore_ascii_case(tag.trim()))) }) .collect::>(); if let Ok(pos) = position(server, target, "target") {