Skip to content

Commit ec030ef

Browse files
committed
Fix warning when CI runs cargo test
1 parent e878b69 commit ec030ef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/i2c.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use crate::gpio::{Alternate, AF4};
1313
use crate::hal::blocking::i2c::{Read, Write, WriteRead};
1414
use crate::pac::{DWT, I2C1, I2C2, I2C3};
1515
use crate::rcc::{sealed::RccBus, Clocks, Enable, GetBusFreq, Reset};
16-
use micromath::F32Ext;
1716
use nb::Error::{Other, WouldBlock};
1817
use nb::{Error as NbError, Result as NbResult};
1918

@@ -276,6 +275,12 @@ fn calculate_timing(
276275
an_filter: bool,
277276
dnf: u8,
278277
) -> I2cTiming {
278+
// We get an "unused" warning here when running `cargo test`. I haven't
279+
// looked into it, but I suspect that is only used when `std` isn't
280+
// available, which would explain that behavior.
281+
#[cfg(not(test))]
282+
use micromath::F32Ext as _;
283+
279284
// frequency limit check
280285
assert!(scl_freq <= spec.freq_max);
281286
// T_sync or delay introduced in SCL

0 commit comments

Comments
 (0)