Skip to content

Commit

Permalink
Merge pull request coreos#1201 from bgilbert/clippy
Browse files Browse the repository at this point in the history
workflows: run clippy on tests
  • Loading branch information
bgilbert committed Jun 2, 2023
2 parents f435871 + bb8a60d commit 082f9cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ jobs:
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --features rdcore
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --features rdcore
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
Expand Down Expand Up @@ -120,13 +120,13 @@ jobs:
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --features rdcore
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --features rdcore
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
Expand Down Expand Up @@ -173,9 +173,9 @@ jobs:
- name: cargo fmt (check)
run: cargo fmt -- --check -l
- name: cargo clippy (warnings)
run: cargo clippy -- -D warnings
run: cargo clippy --all-targets -- -D warnings
- name: cargo clippy (rdcore, warnings)
run: cargo clippy --features rdcore -- -D warnings
run: cargo clippy --all-targets --features rdcore -- -D warnings
tests-other-channels:
name: "Tests, unstable toolchain"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -215,13 +215,13 @@ jobs:
git-fetch-with-cli = true
EOF
- name: cargo build
run: cargo build
run: cargo build --all-targets
- name: cargo test
run: cargo test
run: cargo test --all-targets
- name: cargo build (rdcore)
run: cargo build --features rdcore
run: cargo build --all-targets --features rdcore
- name: cargo test (rdcore)
run: cargo test --features rdcore
run: cargo test --all-targets --features rdcore
- name: Image tests
if: ${{ matrix.arch == 'x86_64' }}
run: tests/images.sh
Expand Down
2 changes: 1 addition & 1 deletion src/blockdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ mod tests {
guid
}

fn assert_partitions_eq(expected: &Vec<(u32, GPTPartitionEntry)>, found: &GPT, message: &str) {
fn assert_partitions_eq(expected: &[(u32, GPTPartitionEntry)], found: &GPT, message: &str) {
assert_eq!(
expected
.iter()
Expand Down
4 changes: 2 additions & 2 deletions src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ mod tests {
let mb: usize = 1024 * 1024;

let mut data = vec![0u8; len];
for i in 0..data.len() {
data[i] = (i % 256) as u8;
for (i, el) in data.iter_mut().enumerate() {
*el = (i % 256) as u8;
}

// no saved partitions
Expand Down
3 changes: 1 addition & 2 deletions src/io/peek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ mod tests {
}

fn read_bytes<R: Read>(peek: &mut PeekReader<R>, amt: usize) -> Vec<u8> {
let mut buf = Vec::with_capacity(amt);
buf.resize(amt, 0);
let mut buf = vec![0; amt];
let amt = peek.read(&mut buf).unwrap();
buf.truncate(amt);
buf
Expand Down

0 comments on commit 082f9cb

Please sign in to comment.