Skip to content

Commit 4e459f5

Browse files
committed
fix: fix unreachable code lints on Android
When compiling for Android, the linter will warn about unreachable branches such as the `(b"Linux", b"i686")` one, since it's already covered by the `(_, b"i686")` case.
1 parent 2be04c5 commit 4e459f5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/dist/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -490,19 +490,8 @@ impl TargetTriple {
490490
)
491491
};
492492

493+
#[cfg(not(target_os = "android"))]
493494
let host_triple = match (sysname, machine) {
494-
#[cfg(target_os = "android")]
495-
(_, b"arm") => Some("arm-linux-androideabi"),
496-
#[cfg(target_os = "android")]
497-
(_, b"armv7l") => Some("armv7-linux-androideabi"),
498-
#[cfg(target_os = "android")]
499-
(_, b"armv8l") => Some("armv7-linux-androideabi"),
500-
#[cfg(target_os = "android")]
501-
(_, b"aarch64") => Some("aarch64-linux-android"),
502-
#[cfg(target_os = "android")]
503-
(_, b"i686") => Some("i686-linux-android"),
504-
#[cfg(target_os = "android")]
505-
(_, b"x86_64") => Some("x86_64-linux-android"),
506495
(b"Linux", b"x86_64") => Some(TRIPLE_X86_64_UNKNOWN_LINUX),
507496
(b"Linux", b"i686") => Some("i686-unknown-linux-gnu"),
508497
(b"Linux", b"mips") => Some(TRIPLE_MIPS_UNKNOWN_LINUX_GNU),
@@ -529,6 +518,17 @@ impl TargetTriple {
529518
_ => None,
530519
};
531520

521+
#[cfg(target_os = "android")]
522+
let host_triple = match (sysname, machine) {
523+
(_, b"arm") => Some("arm-linux-androideabi"),
524+
(_, b"armv7l") => Some("armv7-linux-androideabi"),
525+
(_, b"armv8l") => Some("armv7-linux-androideabi"),
526+
(_, b"aarch64") => Some("aarch64-linux-android"),
527+
(_, b"i686") => Some("i686-linux-android"),
528+
(_, b"x86_64") => Some("x86_64-linux-android"),
529+
_ => None,
530+
};
531+
532532
host_triple.map(TargetTriple::new)
533533
}
534534

0 commit comments

Comments
 (0)