From 4801969e3576a57f45437dedfbd2c10d4633baf2 Mon Sep 17 00:00:00 2001 From: "Valeriy V. Vorotyntsev" Date: Sun, 2 Jul 2023 13:00:37 +0300 Subject: [PATCH] Spell check with `typos`. Add `spell-check` CI job --- .github/workflows/ci.yml | 6 ++++++ pnet_base/src/macaddr.rs | 2 +- pnet_datalink/src/bpf.rs | 4 ++-- pnet_datalink/src/winpcap.rs | 2 +- pnet_sys/src/lib.rs | 2 +- src/lib.rs | 4 ++-- typos.toml | 6 ++++++ 7 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84b6dbfd..aedc71b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,12 @@ env: VERBOSE: 1 jobs: + spell-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: crate-ci/typos@master + build-ubuntu: runs-on: ubuntu-latest steps: diff --git a/pnet_base/src/macaddr.rs b/pnet_base/src/macaddr.rs index 1fd6fcef..83a5e7d5 100644 --- a/pnet_base/src/macaddr.rs +++ b/pnet_base/src/macaddr.rs @@ -310,7 +310,7 @@ mod tests { } #[test] - fn convertion() { + fn conversion() { let mac = MacAddr(0x12, 0x34, 0x56, 0x78, 0x90, 0xAB); let addr = [0x12, 0x34, 0x56, 0x78, 0x90, 0xAB]; diff --git a/pnet_datalink/src/bpf.rs b/pnet_datalink/src/bpf.rs index a64bfdcb..0dc04ab5 100644 --- a/pnet_datalink/src/bpf.rs +++ b/pnet_datalink/src/bpf.rs @@ -294,7 +294,7 @@ impl DataLinkSender for DataLinkSenderImpl { ) }; if ret == -1 { - // Error occured! + // Error occurred! return Some(Err(io::Error::last_os_error())); } else if ret == 0 { return Some(Err(io::Error::new(io::ErrorKind::TimedOut, "Timed out"))); @@ -339,7 +339,7 @@ impl DataLinkSender for DataLinkSenderImpl { ) }; if ret == -1 { - // Error occured! + // Error occurred! return Some(Err(io::Error::last_os_error())); } else if ret == 0 { return Some(Err(io::Error::new(io::ErrorKind::TimedOut, "Timed out"))); diff --git a/pnet_datalink/src/winpcap.rs b/pnet_datalink/src/winpcap.rs index 64415d2f..5fdb460f 100644 --- a/pnet_datalink/src/winpcap.rs +++ b/pnet_datalink/src/winpcap.rs @@ -343,7 +343,7 @@ pub fn interfaces() -> Vec { buf.resize(buflen as usize, 0); // Second call should now work with the correct buffer size. If not, this may be - // due to some privilege or other unforseen issue. + // due to some privilege or other unforeseen issue. if unsafe { winpcap::PacketGetAdapterNames(buf.as_mut_ptr() as *mut i8, &mut buflen) } == 0 { panic!("Unable to get interface list despite increasing buffer size"); diff --git a/pnet_sys/src/lib.rs b/pnet_sys/src/lib.rs index 125286a5..5582a67e 100644 --- a/pnet_sys/src/lib.rs +++ b/pnet_sys/src/lib.rs @@ -111,7 +111,7 @@ pub fn set_socket_receive_timeout(socket: CSocket, t: Duration) -> io::Result<() } } -/// Extracts and returns a timout for reading from the socket. +/// Extracts and returns a timeout for reading from the socket. #[cfg(unix)] pub fn get_socket_receive_timeout(socket: CSocket) -> io::Result { let ts = libc::timeval { diff --git a/src/lib.rs b/src/lib.rs index 4423b8e4..8abff094 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ //! //! ## Terminology //! -//! The documentation uses the following terms interchangably: +//! The documentation uses the following terms interchangeably: //! //! * Layer 2, datalink layer; //! * Layer 3, network layer; @@ -48,7 +48,7 @@ //! ### Ethernet echo server //! //! This (fairly useless) code implements an Ethernet echo server. Whenever a -//! packet is received on an interface, it echo's the packet back; reversing the +//! packet is received on an interface, it echoes the packet back; reversing the //! source and destination addresses. //! //! ```rust,ignore diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..b4c8229e --- /dev/null +++ b/typos.toml @@ -0,0 +1,6 @@ +[default] +extend-ignore-identifiers-re = [ + "tolen", + "ND", + "SunNd", +]