Skip to content

Commit f84babc

Browse files
committed
Fix compilation error when printing Error with defmt
This fixes compilation errors like below: ``` error[E0277]: the trait bound `nom::internal::Err<nom::error::Error<&str>>: Format` is not satisfied --> nyan.rs:245:21 | 245 | defmt::warn!("{:a}: {}", line, err); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Format` is not implemented for `nom::internal::Err<nom::error::Error<&str>>` | = help: the following other types implement trait `Format`: &T &mut T () (T0, T1) (T0, T1, T2) (T0, T1, T2, T3) (T0, T1, T2, T3, T4) (T0, T1, T2, T3, T4, T5) and 234 others = note: required for `nmea::Error<'_>` to implement `Format` note: required by a bound in `defmt::export::fmt` ```
1 parent afb133b commit f84babc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/error.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ pub enum Error<'a> {
2020
/// An unknown [`GnssType`] was found in the NMEA message.
2121
UnknownGnssType(&'a str),
2222
/// The sentence could not be parsed because its format was invalid.
23-
#[cfg_attr(feature = "defmt-03", defmt(defmt::Debug2Format))]
24-
ParsingError(nom::Err<nom::error::Error<&'a str>>),
23+
ParsingError(
24+
#[cfg_attr(feature = "defmt-03", defmt(Debug2Format))] nom::Err<nom::error::Error<&'a str>>,
25+
),
2526
/// The sentence was too long to be parsed, our current limit is `SENTENCE_MAX_LEN` characters.
2627
SentenceLength(usize),
2728
/// Parameter was too long to fit into fixed ArrayString.

0 commit comments

Comments
 (0)