Skip to content

Commit fcc0a0b

Browse files
committed
refactor(config): simplify toolchain_from_partial()
1 parent c94ef35 commit fcc0a0b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,13 @@ impl<'a> Cfg<'a> {
502502
&self,
503503
toolchain: Option<PartialToolchainDesc>,
504504
) -> anyhow::Result<Toolchain<'_>> {
505-
let toolchain = match toolchain {
506-
Some(toolchain) => {
507-
let desc = toolchain.resolve(&self.get_default_host_triple()?)?;
508-
Some(LocalToolchainName::Named(ToolchainName::Official(desc)))
509-
}
510-
None => None,
511-
};
505+
let toolchain = toolchain
506+
.map(|desc| {
507+
anyhow::Ok(LocalToolchainName::Named(ToolchainName::Official(
508+
desc.resolve(&self.get_default_host_triple()?)?,
509+
)))
510+
})
511+
.transpose()?;
512512
self.local_toolchain(toolchain)
513513
}
514514

0 commit comments

Comments
 (0)