Merge no-op match arms that clippy flagged as identical

Clippy's match_same_arms lint reports 15 pairs. Most sit in relocation
tables that follow the relocation number order, where merging would
break the order, so only the two that are not in such tables change.
This commit is contained in:
Rui Ueyama committed 2026-09-19 14:07:08 +09:00
1 parent 36ec82df73
commit 54b68f6e42
2 files changed
+3 -5

No files matched your search

+2 -3
View File
@@ -492,7 +492,6 @@ impl Arch for Ppc64V1 {
let loc = &mut buf[rel.r_offset() as usize..];
match rel.r_type() {
R_PPC64_TOC => {}
R_PPC64_TOC16_HA => write_ub16(loc, ha(sa.wrapping_sub(toc)) as u16),
R_PPC64_TOC16_LO => write_ub16(loc, lo(sa.wrapping_sub(toc)) as u16),
R_PPC64_TOC16_DS => {
@@ -553,8 +552,8 @@ impl Arch for Ppc64V1 {
R_PPC64_TPREL16_HA => write_ub16(loc, ha(sa.wrapping_sub(ctx.tp_addr)) as u16),
R_PPC64_TPREL16_LO => write_ub16(loc, lo(sa.wrapping_sub(ctx.tp_addr)) as u16),
R_PPC64_TPREL16_LO_DS => or16(loc, sa.wrapping_sub(ctx.tp_addr) & 0xfffc),
R_PPC64_ADDR64 | R_PPC64_PLTSEQ | R_PPC64_PLTCALL | R_PPC64_TLS | R_PPC64_TLSGD
| R_PPC64_TLSLD => {}
R_PPC64_TOC | R_PPC64_ADDR64 | R_PPC64_PLTSEQ | R_PPC64_PLTCALL | R_PPC64_TLS
| R_PPC64_TLSGD | R_PPC64_TLSLD => {}
_ => unreachable!("unexpected relocation {}", rel.type_name::<Self>()),
}
}
+1 -2
View File
@@ -2297,8 +2297,7 @@ pub fn compute_section_sizes<E: Arch>(ctx: &mut Context<E>) {
for i in 0..ctx.chunks.len() {
let id = ctx.chunks[i];
match id {
ChunkId::Output(_) => {}
ChunkId::Merged(_) => {}
ChunkId::Output(_) | ChunkId::Merged(_) => {}
_ => chunks::compute_section_size(ctx, id),
}
}