Refactor out a repeating pattern with get_or_default_sysroot
This commit is contained in:
parent
a03d19ef63
commit
5441523f07
5 changed files with 15 additions and 29 deletions
|
@ -888,9 +888,7 @@ pub fn version_at_macro_invocation(
|
|||
let debug_flags = matches.opt_strs("Z");
|
||||
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
|
||||
let opts = config::Options::default();
|
||||
let sysroot = opts.maybe_sysroot.clone().unwrap_or_else(|| {
|
||||
filesearch::get_or_default_sysroot().expect("Failed finding sysroot")
|
||||
});
|
||||
let sysroot = filesearch::materialize_sysroot(opts.maybe_sysroot.clone());
|
||||
let target = config::build_target_config(early_dcx, &opts, None, &sysroot);
|
||||
|
||||
get_codegen_backend(early_dcx, &sysroot, backend_name, &target).print_version();
|
||||
|
@ -1100,9 +1098,7 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->
|
|||
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
|
||||
|
||||
let opts = config::Options::default();
|
||||
let sysroot = opts.maybe_sysroot.clone().unwrap_or_else(|| {
|
||||
filesearch::get_or_default_sysroot().expect("Failed finding sysroot")
|
||||
});
|
||||
let sysroot = filesearch::materialize_sysroot(opts.maybe_sysroot.clone());
|
||||
let target = config::build_target_config(early_dcx, &opts, None, &sysroot);
|
||||
|
||||
get_codegen_backend(early_dcx, &sysroot, backend_name, &target).print_passes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue