diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b074459..b395c26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/eif_build/src/main.rs b/eif_build/src/main.rs index 90f4d18..016bad9 100644 --- a/eif_build/src/main.rs +++ b/eif_build/src/main.rs @@ -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, }; @@ -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( diff --git a/src/defs/eif_hasher.rs b/src/defs/eif_hasher.rs index de47f47..3276aa7 100644 --- a/src/defs/eif_hasher.rs +++ b/src/defs/eif_hasher.rs @@ -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] diff --git a/src/defs/mod.rs b/src/defs/mod.rs index 83b2779..30dca8a 100644 --- a/src/defs/mod.rs +++ b/src/defs/mod.rs @@ -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()); } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index fe226c6..8a9aa05 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -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;