From 4e62dc75a2480c2c073836ace2b8c44df5f9c4a1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 16 Apr 2024 22:04:50 +0200 Subject: [PATCH] fix: always set optimizer details --- crates/config/src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 51769ab314a0..39408326eeef 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -1028,11 +1028,18 @@ impl Config { } /// Returns the `Optimizer` based on the configured settings + /// + /// Note: optimizer details can be set independently of `enabled` + /// See also: + /// and pub fn optimizer(&self) -> Optimizer { - // only configure optimizer settings if optimizer is enabled - let details = if self.optimizer { self.optimizer_details.clone() } else { None }; - - Optimizer { enabled: Some(self.optimizer), runs: Some(self.optimizer_runs), details } + Optimizer { + enabled: Some(self.optimizer), + runs: Some(self.optimizer_runs), + // we always set the details because `enabled` is effectively a specific details profile + // that can still be modified + details: self.optimizer_details.clone(), + } } /// returns the [`foundry_compilers::ConfigurableArtifacts`] for this config, that includes the