Refactor out a repeating pattern with get_or_default_sysroot

This commit is contained in:
Maybe Waffle
2024-02-15 00:03:34 +00:00
parent a03d19ef63
commit 5441523f07
5 changed files with 15 additions and 29 deletions

View File

@@ -336,10 +336,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
let early_dcx = EarlyDiagCtxt::new(config.opts.error_format);
let sysroot = match &config.opts.maybe_sysroot {
Some(sysroot) => sysroot.clone(),
None => filesearch::get_or_default_sysroot().expect("Failed finding sysroot"),
};
let sysroot = filesearch::materialize_sysroot(config.opts.maybe_sysroot.clone());
let (codegen_backend, target_cfg) = match config.make_codegen_backend {
None => {