Skip to content

Commit

Permalink
Merge pull request #134 from AeroRust/chore/fix-clippy-warnings
Browse files Browse the repository at this point in the history
fix: clippy warnings
  • Loading branch information
elpiel authored Oct 11, 2024
2 parents f0881e1 + ec31a33 commit 2e14541
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[alias]

build-docs = "doc --no-deps --workspace --document-private-items --all-features"
5 changes: 3 additions & 2 deletions benches-harness/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//! Dummy crate for testing with [`criterion`]` without bumping MSRV of `nmea`
//! every time there's an MSRV change in dependency crate like [`criterion`].
//! Dummy crate for testing with [`criterion`](https://crates.io/crates/criterion) without bumping MSRV of `nmea`
//! every time there's an MSRV change in dependency crate like [`criterion`](https://crates.io/crates/criterion).
//!
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'a> From<nom::Err<nom::error::Error<&'a str>>> for Error<'a> {
}
}

impl<'a> fmt::Display for Error<'a> {
impl fmt::Display for Error<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Utf8Decoding => {
Expand Down Expand Up @@ -107,4 +107,4 @@ impl<'a> fmt::Display for Error<'a> {

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl<'a> std::error::Error for Error<'a> {}
impl std::error::Error for Error<'_> {}
2 changes: 1 addition & 1 deletion src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct NmeaSentence<'a> {
pub checksum: u8,
}

impl<'a> NmeaSentence<'a> {
impl NmeaSentence<'_> {
pub fn calc_checksum(&self) -> u8 {
checksum(
self.talker_id
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use serde::{de::Visitor, ser::SerializeSeq, Deserialize, Serialize};
/// nmea.parse(gga).unwrap();
/// println!("{}", nmea);
/// # }

///
/// ```
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
Expand Down
2 changes: 1 addition & 1 deletion src/sentences/mda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub struct MdaData {
/// 19: 0.6 Wind speed meters/second
/// 20: M
/// 21: *16 Mandatory NMEA checksum

///
pub fn parse_mda(sentence: NmeaSentence) -> Result<MdaData, Error> {
if sentence.message_id != SentenceType::MDA {
Err(Error::WrongSentenceHeader {
Expand Down
6 changes: 3 additions & 3 deletions src/sentences/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ mod tests {
assert_eq!(err, nom::Err::Error(err_expected));

let lat_lon = parse_lat_lon("1234.567,N,09876.543,W");
assert_eq!(lat_lon.is_ok(), true);
assert!(lat_lon.is_ok());

let lat_lon = parse_lat_lon("0000.000,S,00000.000,E");
assert_eq!(lat_lon.is_ok(), true);
assert!(lat_lon.is_ok());

let lat_lon = parse_lat_lon("1234.567,S,09876.543,E");
assert_eq!(lat_lon.is_ok(), true);
assert!(lat_lon.is_ok());

let lat_lon = parse_lat_lon("1234.567,S,09876.543,E");
assert!(lat_lon.is_ok());
Expand Down

0 comments on commit 2e14541

Please sign in to comment.