rustc_codegen_ssa: use slice patterns instead of len-check+indexing
This commit is contained in:
parent
c182ce9cbc
commit
c930bb2cfb
1 changed files with 5 additions and 5 deletions
|
@ -572,10 +572,10 @@ fn produce_final_output_artifacts(
|
||||||
};
|
};
|
||||||
|
|
||||||
let copy_if_one_unit = |output_type: OutputType, keep_numbered: bool| {
|
let copy_if_one_unit = |output_type: OutputType, keep_numbered: bool| {
|
||||||
if compiled_modules.modules.len() == 1 {
|
if let [module] = &compiled_modules.modules[..] {
|
||||||
// 1) Only one codegen unit. In this case it's no difficulty
|
// 1) Only one codegen unit. In this case it's no difficulty
|
||||||
// to copy `foo.0.x` to `foo.x`.
|
// to copy `foo.0.x` to `foo.x`.
|
||||||
let module_name = Some(&compiled_modules.modules[0].name[..]);
|
let module_name = Some(&module.name[..]);
|
||||||
let path = crate_output.temp_path(output_type, module_name);
|
let path = crate_output.temp_path(output_type, module_name);
|
||||||
let output = crate_output.path(output_type);
|
let output = crate_output.path(output_type);
|
||||||
if !output_type.is_text_output() && output.is_tty() {
|
if !output_type.is_text_output() && output.is_tty() {
|
||||||
|
@ -707,8 +707,8 @@ fn produce_final_output_artifacts(
|
||||||
}
|
}
|
||||||
|
|
||||||
if sess.opts.json_artifact_notifications {
|
if sess.opts.json_artifact_notifications {
|
||||||
if compiled_modules.modules.len() == 1 {
|
if let [module] = &compiled_modules.modules[..] {
|
||||||
compiled_modules.modules[0].for_each_output(|_path, ty| {
|
module.for_each_output(|_path, ty| {
|
||||||
if sess.opts.output_types.contains_key(&ty) {
|
if sess.opts.output_types.contains_key(&ty) {
|
||||||
let descr = ty.shorthand();
|
let descr = ty.shorthand();
|
||||||
// for single cgu file is renamed to drop cgu specific suffix
|
// for single cgu file is renamed to drop cgu specific suffix
|
||||||
|
@ -864,7 +864,7 @@ pub(crate) fn compute_per_cgu_lto_type(
|
||||||
// require LTO so the request for LTO is always unconditionally
|
// require LTO so the request for LTO is always unconditionally
|
||||||
// passed down to the backend, but we don't actually want to do
|
// passed down to the backend, but we don't actually want to do
|
||||||
// anything about it yet until we've got a final product.
|
// anything about it yet until we've got a final product.
|
||||||
let is_rlib = sess_crate_types.len() == 1 && sess_crate_types[0] == CrateType::Rlib;
|
let is_rlib = matches!(sess_crate_types, [CrateType::Rlib]);
|
||||||
|
|
||||||
match sess_lto {
|
match sess_lto {
|
||||||
Lto::ThinLocal if !linker_does_lto && !is_allocator => ComputedLtoType::Thin,
|
Lto::ThinLocal if !linker_does_lto && !is_allocator => ComputedLtoType::Thin,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue