Skip to content

Commit

Permalink
Fix warnings and add CI lint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Delfin authored and danobi committed Oct 25, 2024
1 parent fd741bb commit c8213ea
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
sudo udevadm trigger --name-match=kvm
fi
- name: Run clippy
run: make lint

- name: Run integration tests
run: make test

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ clean:
@cargo clean
@rm -rf $(ASSET_DIRECTORY)

.PHONY: lint
lint:
@cargo clippy -- -D warnings

$(ASSET_DIRECTORY):
@mkdir -p $@

Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub struct Target {
///
/// * The path is relative to `vmtest.toml`.
/// * If not specified, the host's rootfs will be used.
///
/// Default: /
#[serde(default = "Target::default_rootfs")]
pub rootfs: PathBuf,
Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod tests {
let tmp_dir = test_config().expect("Failed to create config");
let config_path = tmp_dir.path().join("vmtest.toml");

let args = Args::parse_from(&[
let args = Args::parse_from([
"cliname",
"-c",
config_path.to_str().expect("Failed to create config path"),
Expand All @@ -205,7 +205,7 @@ mod tests {
let tmp_dir = test_config().expect("Failed to create config");
let config_path = tmp_dir.path().join("vmtest.toml");

let args = Args::parse_from(&[
let args = Args::parse_from([
"cliname",
"-c",
config_path.to_str().expect("Failed to create config path"),
Expand All @@ -221,7 +221,7 @@ mod tests {
let tmp_dir = test_config().expect("Failed to create config");
let config_path = tmp_dir.path().join("vmtest.toml");

let args = Args::parse_from(&[
let args = Args::parse_from([
"cliname",
"-c",
config_path.to_str().expect("Failed to create config path"),
Expand All @@ -236,8 +236,7 @@ mod tests {
// Test that when using the kernel argument, the filter is not applied.
#[test]
fn test_config_with_kernel_ignore_filter() {
let args =
Args::parse_from(&["cliname", "-k", "mykernel", "-f", "test2", "command to run"]);
let args = Args::parse_from(["cliname", "-k", "mykernel", "-f", "test2", "command to run"]);
let vmtest = config(&args).expect("Failed to parse config");
assert_eq!(vmtest.targets().len(), 1);
assert_eq!(vmtest.targets()[0].name, "mykernel");
Expand Down
1 change: 1 addition & 0 deletions src/qga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct QgaWrapper {
pub struct Version {
pub major: u8,
pub minor: u8,
#[allow(unused)]
pub patch: u8,
}

Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use vmtest::Config;
// Returns a path to a test asset
pub fn asset(name: &str) -> PathBuf {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
let asset = root.join("tests/.assets").join(name);
asset

root.join("tests/.assets").join(name)
}

// Set up a test run
Expand Down
1 change: 0 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::fs;
use std::path::Path;
use std::sync::mpsc::channel;

use rexpect;
use tempfile::{tempdir, tempdir_in};
use test_log::test;

Expand Down

0 comments on commit c8213ea

Please sign in to comment.