From e249e4db7bb7bb874dffb79ca1161f8448065c2d Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 20 Dec 2023 17:07:18 +0100 Subject: [PATCH] Change Setting::apply function signature --- milli/src/update/settings.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index d406c121c..e47a5ad52 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -78,11 +78,19 @@ impl Setting { } } - pub fn apply(&mut self, new: Self) { + /// Returns `true` if applying the new setting changed this setting + pub fn apply(&mut self, new: Self) -> bool + where + T: PartialEq + Eq, + { if let Setting::NotSet = new { - return; + return false; + } + if self == &new { + return false; } *self = new; + true } }