Skip to content

Commit

Permalink
github: update workflow (#27)
Browse files Browse the repository at this point in the history
and fix a few trivial clippy warnings...
  • Loading branch information
birkenfeld authored Aug 9, 2024
1 parent a74527f commit cd737c8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: CI

on: [push, pull_request]
on:
push:
branches: [master]
pull_request:

jobs:
test:
Expand All @@ -9,17 +12,14 @@ jobs:
strategy:
matrix:
toolchain:
- 1.48.0
- 1.63.0
- stable
- nightly
steps:
- name: Checkout the source code
uses: actions/checkout@master
- name: Install Rust
run: |
rustup toolchain update --no-self-update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
- name: Build
run: cargo build --all
- name: Test
run: cargo test --all
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
toolchain: ${{ matrix.toolchain }}
- run: cargo clippy --all-targets
- run: cargo test --all
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ quick-xml = "0.36.1"
regex = "<1.10.0"
structopt = "0.3.26"
strum = { version = "0.26.3", features = ["derive"] }
time = { version = "<0.3.21", features = ["formatting"] }
time = { version = "<0.3.18", features = ["formatting"] }
10 changes: 5 additions & 5 deletions examples/adstool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
let namelen = LE::read_u32(&routeinfo[36..]) as usize;
let host = String::from_utf8_lossy(&routeinfo[44..][..hostlen-1]);
let name = String::from_utf8_lossy(&routeinfo[44+hostlen..][..namelen-1]);
print!("{:-20} {:-22} {:-18}", name, netid.to_string(), host);
print!("{:-20} {:-22} {:-18}", name, netid, host);
if flags & 0x01 != 0 { print!(" temporary"); }
if flags & 0x80 != 0 { print!(" unidirectional"); }
if flags & 0x100 != 0 { print!(" virtual/nat"); }
Expand Down Expand Up @@ -446,7 +446,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
let dev = client.device(amsaddr);
match subargs {
FileAction::List { path } => {
let entries = file::listdir(dev, &path)?;
let entries = file::listdir(dev, path)?;
for (name, attr, size) in entries {
println!("{} {:8} {}",
if attr & file::DIRECTORY != 0 { "D" } else { " " },
Expand All @@ -465,7 +465,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
std::io::copy(&mut stdin(), &mut file)?;
}
FileAction::Delete { path } => {
file::File::delete(dev, &path, file::ENABLE_DIR)?;
file::File::delete(dev, path, file::ENABLE_DIR)?;
}
}
}
Expand Down Expand Up @@ -612,7 +612,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
for (name, ty) in &type_map {
if name.to_lowercase().contains(&filter) {
println!("** ({:6x}) {:40}", ty.size, name);
print_fields(&type_map, 0, &name, 1);
print_fields(&type_map, 0, name, 1);
}
}
}
Expand Down Expand Up @@ -774,7 +774,7 @@ fn convert_filetime(ft: i64) -> Option<OffsetDateTime> {
/// Format a GUID.
fn format_guid(guid: &[u8]) -> String {
format!("{:08X}-{:04X}-{:04X}-{:04X}-{:012X}",
LE::read_u32(&guid),
LE::read_u32(guid),
LE::read_u16(&guid[4..]),
LE::read_u16(&guid[6..]),
BE::read_u16(&guid[8..]),
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl Client {
let mut socket = if let Some(timeout) = timeouts.connect {
TcpStream::connect_timeout(&addr, timeout).ctx("connecting TCP socket with timeout")?
} else {
TcpStream::connect(&addr).ctx("connecting TCP socket")?
TcpStream::connect(addr).ctx("connecting TCP socket")?
};

// Disable Nagle to ensure small requests are sent promptly; we're
Expand Down
4 changes: 2 additions & 2 deletions src/test/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ fn test_string_type() {
let ret = device.read_value::<String5>(0x4020, 7).unwrap();
assert!(<[u8; 5]>::from(ret) == [b'a', b'b', b'c', 0, 0]);
assert!(String::try_from(ret).unwrap() == "abc");
assert!(<Vec<u8>>::try_from(ret).unwrap() == [b'a', b'b', b'c']);
assert!(<Vec<u8>>::from(ret) == [b'a', b'b', b'c']);
})
}

Expand Down Expand Up @@ -300,6 +300,6 @@ fn test_wstring_type() {
let ret = device.read_value::<WString5>(0x4020, 7).unwrap();
assert!(<[u16; 5]>::from(ret) == [b'a' as u16, b'b' as u16, b'c' as u16, 0, 0]);
assert!(String::try_from(ret).unwrap() == "abc");
assert!(<Vec<u16>>::try_from(ret).unwrap() == [b'a' as u16, b'b' as u16, b'c' as u16]);
assert!(<Vec<u16>>::from(ret) == [b'a' as u16, b'b' as u16, b'c' as u16]);
})
}

0 comments on commit cd737c8

Please sign in to comment.