Flatten ifs in rustc_codegen_ssa
This commit is contained in:
@@ -566,16 +566,13 @@ fn produce_final_output_artifacts(
|
||||
|
||||
// Produce final compile outputs.
|
||||
let copy_gracefully = |from: &Path, to: &OutFileName| match to {
|
||||
OutFileName::Stdout => {
|
||||
if let Err(e) = copy_to_stdout(from) {
|
||||
sess.dcx().emit_err(errors::CopyPath::new(from, to.as_path(), e));
|
||||
}
|
||||
OutFileName::Stdout if let Err(e) = copy_to_stdout(from) => {
|
||||
sess.dcx().emit_err(errors::CopyPath::new(from, to.as_path(), e));
|
||||
}
|
||||
OutFileName::Real(path) => {
|
||||
if let Err(e) = fs::copy(from, path) {
|
||||
sess.dcx().emit_err(errors::CopyPath::new(from, path, e));
|
||||
}
|
||||
OutFileName::Real(path) if let Err(e) = fs::copy(from, path) => {
|
||||
sess.dcx().emit_err(errors::CopyPath::new(from, path, e));
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
let copy_if_one_unit = |output_type: OutputType, keep_numbered: bool| {
|
||||
@@ -685,14 +682,12 @@ fn produce_final_output_artifacts(
|
||||
needs_crate_object || (user_wants_objects && sess.codegen_units().as_usize() > 1);
|
||||
|
||||
for module in compiled_modules.modules.iter() {
|
||||
if let Some(ref path) = module.object {
|
||||
if !keep_numbered_objects {
|
||||
if !keep_numbered_objects {
|
||||
if let Some(ref path) = module.object {
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref path) = module.dwarf_object {
|
||||
if !keep_numbered_objects {
|
||||
if let Some(ref path) = module.dwarf_object {
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
@@ -704,12 +699,11 @@ fn produce_final_output_artifacts(
|
||||
}
|
||||
}
|
||||
|
||||
if !user_wants_bitcode {
|
||||
if let Some(ref allocator_module) = compiled_modules.allocator_module {
|
||||
if let Some(ref path) = allocator_module.bytecode {
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
if !user_wants_bitcode
|
||||
&& let Some(ref allocator_module) = compiled_modules.allocator_module
|
||||
&& let Some(ref path) = allocator_module.bytecode
|
||||
{
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user