Skip to content

Commit

Permalink
github: update workflow
Browse files Browse the repository at this point in the history
and fix a few trivial clippy warnings...
  • Loading branch information
birkenfeld committed Aug 9, 2024
1 parent a74527f commit 701ac5e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,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
8 changes: 4 additions & 4 deletions examples/adstool.rs
Original file line number Diff line number Diff line change
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 701ac5e

Please sign in to comment.