Ignore unused variables when compiler-builtins is set

This commit is contained in:
Trevor Gross 2025-02-24 04:55:38 +00:00 committed by Trevor Gross
parent 9021b2820c
commit 3f6b08ac1e
2 changed files with 7 additions and 5 deletions

View file

@ -11,18 +11,18 @@ test = false
bench = false
[features]
default = ["arch", "unstable-float"]
default = ["arch", "compiler-builtins", "unstable-float"]
# Copied from `libm`'s root `Cargo.toml`'
unstable-float = []
arch = []
compiler-builtins = []
unstable-float = []
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(arch_enabled)",
"cfg(assert_no_panic)",
"cfg(intrinsics_enabled)",
'cfg(feature, values("compiler-builtins"))',
'cfg(feature, values("force-soft-floats"))',
'cfg(feature, values("unstable"))',
'cfg(feature, values("unstable-intrinsics"))',

View file

@ -248,7 +248,8 @@ impl<F: Float> fmt::LowerHex for Hexf<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
cfg_if! {
if #[cfg(feature = "compiler-builtins")] {
unreachable!()
let _ = f;
unimplemented!()
} else {
fmt_any_hex(&self.0, f)
}
@ -272,7 +273,8 @@ impl fmt::LowerHex for Hexf<i32> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
cfg_if! {
if #[cfg(feature = "compiler-builtins")] {
unreachable!()
let _ = f;
unimplemented!()
} else {
fmt::LowerHex::fmt(&self.0, f)
}