Skip to content

Commit

Permalink
Spell check with typos. Add spell-check CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
vvv committed Jul 2, 2023
1 parent f5ab216 commit 1835015
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pnet_base/src/macaddr.rs
Expand Up @@ -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];

Expand Down
4 changes: 2 additions & 2 deletions pnet_datalink/src/bindings/bpf.rs
Expand Up @@ -20,7 +20,7 @@ const IF_NAMESIZE: usize = 16;
const IFNAMSIZ: usize = IF_NAMESIZE;
const IOC_IN: libc::c_ulong = 0x80000000;
const IOC_OUT: libc::c_ulong = 0x40000000;
const IOC_INOUT: libc::c_ulong = IOC_IN | IOC_OUT;
const IOC_INPUT: libc::c_ulong = IOC_IN | IOC_OUT;
const IOCPARM_SHIFT: libc::c_ulong = 13;
const IOCPARM_MASK: libc::c_ulong = (1 << (IOCPARM_SHIFT as usize)) - 1;

Expand All @@ -45,7 +45,7 @@ pub const BIOCGDLT: libc::c_ulong =
IOC_OUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 106;

pub const BIOCSBLEN: libc::c_ulong =
IOC_INOUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 102;
IOC_INPUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 102;
pub const BIOCSHDRCMPLT: libc::c_ulong =
IOC_IN | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 117;
pub const BIOCSRTIMEOUT: libc::c_ulong =
Expand Down
4 changes: 2 additions & 2 deletions pnet_datalink/src/bpf.rs
Expand Up @@ -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")));
Expand Down Expand Up @@ -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")));
Expand Down
2 changes: 1 addition & 1 deletion pnet_datalink/src/winpcap.rs
Expand Up @@ -343,7 +343,7 @@ pub fn interfaces() -> Vec<NetworkInterface> {
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");
Expand Down
2 changes: 1 addition & 1 deletion pnet_sys/src/lib.rs
Expand Up @@ -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<Duration> {
let ts = libc::timeval {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions typos.toml
@@ -0,0 +1,6 @@
[default]
extend-ignore-identifiers-re = [
"tolen",
"ND",
"SunNd",
]

0 comments on commit 1835015

Please sign in to comment.