From bf65721cec429f8783d42fe0659c24659f5d1070 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Tue, 28 Oct 2025 16:42:30 +0000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(core):=20rename?= =?UTF-8?q?=20initialise=5Fmessage=5Flist=20to=20initialise=5Flists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rename initialise_message_list to initialise_lists for clarity - update all references to the function with the new name - the function now initialises both message and label lists --- src/cli/main.rs | 2 +- src/rule_processor.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cli/main.rs b/src/cli/main.rs index fc9a283..cc83f3f 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -497,7 +497,7 @@ async fn run_rules(client: &mut GmailClient, rules: Rules, execute: bool) -> Res }; log::info!("Executing rule `#{}` for label `{label}`", rule.describe()); - client.initialise_message_list(); + client.initialise_lists(); client.set_rule(rule.clone()); client.set_execute(execute); if let Err(e) = client.find_rule_and_messages_for_label(&label).await { diff --git a/src/rule_processor.rs b/src/rule_processor.rs index 37aefcf..c6f82d8 100644 --- a/src/rule_processor.rs +++ b/src/rule_processor.rs @@ -196,7 +196,7 @@ pub trait RuleProcessor { /// in dry-run mode (`false`) before enabling execution. fn set_execute(&mut self, value: bool); - /// Initialises the message list to prepare for application of rule. + /// Initialises the message and label lists to prepare for application of rule. /// /// # Arguments /// @@ -221,7 +221,7 @@ pub trait RuleProcessor { /// Ok(()) /// } /// ``` - fn initialise_message_list(&mut self); + fn initialise_lists(&mut self); /// Configures the end-of-life rule to apply during processing. /// @@ -323,8 +323,9 @@ impl RuleProcessor for GmailClient { /// on the in-scope messages. /// /// This must be called before processing any labels. - fn initialise_message_list(&mut self) { + fn initialise_lists(&mut self) { self.messages = Vec::new(); + self.label_ids = Vec::new(); } /// Configures the end-of-life rule for this Gmail client. @@ -735,11 +736,13 @@ mod tests { messages: Vec, rule: Option, execute: bool, + labels: Vec, } impl RuleProcessor for MockProcessor { - fn initialise_message_list(&mut self) { + fn initialise_lists(&mut self) { self.messages = Vec::new(); + self.labels = Vec::new(); } fn set_rule(&mut self, rule: EolRule) { @@ -775,6 +778,7 @@ mod tests { rule: None, execute: false, messages: Vec::new(), + labels: Vec::new(), }; // Test initial state