Skip to content

Commit e57aaeb

Browse files
committed
fix: use lazy argument evaluation to handle errors
An instance of `.then_some` on a bool should have been `.then`. The former evaluates its arguments eagerly, so runs _regardless of the value of the bool_, while the latter does so lazily, which was the desired behavior. In testing, all of our configurations had the file we were testing the presence of before reading. But other folks do not. Fixes #9051
1 parent 4029c53 commit e57aaeb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sled-agent/src/bin/sled-agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async fn do_run() -> Result<(), CmdError> {
6262
rss_config_path.push("config-rss.toml");
6363
rss_config_path
6464
};
65-
let rss_config = rss_config_path.exists().then_some({
65+
let rss_config = rss_config_path.exists().then(|| {
6666
let rss_config =
6767
RackInitializeRequest::from_file(rss_config_path)
6868
.map_err(|e| CmdError::Failure(anyhow!(e)))?;

0 commit comments

Comments
 (0)