Skip to content

Commit

Permalink
Fix clippy errors on 1.80.0
Browse files Browse the repository at this point in the history
... and test the whole workspace in github's pipeline.

Signed-off-by: Sabin Rapan <[email protected]>
  • Loading branch information
sabin-rapan authored and eugkoira committed Jul 31, 2024
1 parent d2025e4 commit 40288e2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: rustup install ${{ matrix.rust }}
- run: cargo +${{ matrix.rust }} build --verbose
- run: cargo +${{ matrix.rust }} test --verbose
- run: cargo +${{ matrix.rust }} build --workspace
- run: cargo +${{ matrix.rust }} test --workspace
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup component add clippy
- run: cargo clippy
- run: cargo clippy --workspace
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup component add rustfmt
- run: cargo fmt -- --check
- run: cargo fmt --all --check
4 changes: 2 additions & 2 deletions eif_build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn main() {
.to_string()
}),
img_version: img_version.unwrap_or_else(|| "1.0".to_string()),
build_info: build_info,
build_info,
docker_info: json!(null),
custom_info: metadata,
};
Expand Down Expand Up @@ -302,7 +302,7 @@ pub fn build_eif(
let flags = match arch {
"aarch64" => EIF_HDR_ARCH_ARM64,
"x86_64" => 0,
_ => None.expect(format!("Invalid architecture {arch}").as_str()),
_ => panic!("Invalid architecture: {}", arch),
};

let mut build = EifBuilder::new(
Expand Down
6 changes: 3 additions & 3 deletions src/defs/eif_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ mod tests {
#[test]
fn invalid_block_size() {
let hasher = EifHasher::new(31, Sha256::new());
assert_eq!(hasher.is_err(), true);
assert!(hasher.is_err());

let hasher = EifHasher::new(63, Sha512::new());
assert_eq!(hasher.is_err(), true);
assert!(hasher.is_err());

let hasher = EifHasher::new(47, Sha384::new());
assert_eq!(hasher.is_err(), true)
assert!(hasher.is_err())
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/defs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ mod tests {
// so we get an invalid section to cause the error.
bytes[1] = 6;

assert_eq!(EifSectionHeader::from_be_bytes(&bytes).is_err(), true);
assert!(EifSectionHeader::from_be_bytes(&bytes).is_err());
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ use std::collections::BTreeMap;
/// - kernel_file
/// - cmdline string
/// - ramdisks files.
/// TODO:
/// - Unittests.
/// - Add support to write default_mem & default_cpus, flags.
/// - Various validity checks: E.g: kernel is a bzImage.
///
/// TODO:
/// - Unittests.
/// - Add support to write default_mem & default_cpus, flags.
/// - Various validity checks: E.g: kernel is a bzImage.
use std::ffi::CString;
use std::fmt::Debug;
use std::fs::File;
Expand Down

0 comments on commit 40288e2

Please sign in to comment.