Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sled-agent/src/bin/sled-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ async fn do_run() -> Result<(), CmdError> {
rss_config_path.push("config-rss.toml");
rss_config_path
};
let rss_config = rss_config_path.exists().then_some({
let rss_config = if rss_config_path.exists() {
let rss_config =
RackInitializeRequest::from_file(rss_config_path)
.map_err(|e| CmdError::Failure(anyhow!(e)))?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this compiles - does this mean rss_config is now an Option<Result<...>>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Of course. :-(

Copy link
Contributor Author

@dancrossnyc dancrossnyc Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it didn't mean that; then_some was already returning an Option<RackInitializeRequestParams>; the Result was being destructured by the ? on line 68. But you can't (conveniently) use ? in a closure, so it did fail to compile.

It's possible one could omit the ? and try to play games with .transpose or .ok or some combination of things like that, but I don't think the result would be comprehensible. My conclusion is that none of the slick methods on bool are really useful here, so I just switched it back to an if expression.

let skip_timesync = config.skip_timesync.unwrap_or(false);
RackInitializeRequestParams::new(rss_config, skip_timesync)
});
Some(RackInitializeRequestParams::new(
rss_config,
skip_timesync,
))
} else {
None
};

let server = bootstrap_server::Server::start(config)
.await
Expand Down
Loading