diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2699d42d269e858d351add8ee274ee1fe6b464d..866dc01cfb32ab67678619928601f5839935a702 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -65,7 +65,7 @@ rust-nightly-clippy: - target/ <<: *rust_template script: - - cargo clippy --all --verbose -- -D warnings + - cargo clippy --all --tests --verbose -- -D warnings pages: stage: build diff --git a/src/lib.rs b/src/lib.rs index fe83c57fb7e7378a32cca2e6ff452ca0bb95c9c6..50b2c9fa26b8a046e7f1e80104870086c1a4884a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(rust_2018_idioms, nonstandard_style)] +#![warn(future_incompatible)] #![doc = include_str!("../README.md")] /// CLI application utilities. diff --git a/src/rundir.rs b/src/rundir.rs index 7d1db45c0e397c90ada1834f017b60e91039df8f..35179dafb65c25186131ff88fe9aae64ce0be557 100644 --- a/src/rundir.rs +++ b/src/rundir.rs @@ -225,7 +225,7 @@ mod tests { use std::path::PathBuf; #[test] - fn test_initialize() -> () { + fn test_initialize() { // Create dir for the first time. let result = RunDir::new("tests/rundir").initialize(); @@ -272,21 +272,21 @@ mod tests { } #[test] - fn test_subdirs() -> () { + fn test_subdirs() { let rundir = RunDir::new("tests/rundir2").allow_cleaning(true); rundir.initialize().unwrap(); - assert_eq!(PathBuf::from("tests/rundir2/subtest").exists(), false); - assert_eq!(rundir.subdir_exists("subtest").unwrap(), false); + assert!(!PathBuf::from("tests/rundir2/subtest").exists()); + assert!(!rundir.subdir_exists("subtest").unwrap()); rundir.create_subdir("subtest").unwrap(); - assert_eq!(PathBuf::from("tests/rundir2/subtest").exists(), true); - assert_eq!(rundir.subdir_exists("subtest").unwrap(), true); + assert!(PathBuf::from("tests/rundir2/subtest").exists()); + assert!(rundir.subdir_exists("subtest").unwrap()); rundir.remove_subdir_all("subtest").unwrap(); - assert_eq!(PathBuf::from("tests/rundir2/subtest").exists(), false); - assert_eq!(rundir.subdir_exists("subtest").unwrap(), false); + assert!(!PathBuf::from("tests/rundir2/subtest").exists()); + assert!(!rundir.subdir_exists("subtest").unwrap()); rundir.cleanup().unwrap(); } diff --git a/src/str.rs b/src/str.rs index b5d4be9a1723eac51e73bc7ae944c390adb7a673..d78ce45065f24a30ae893400a8acfb29fcbe412e 100644 --- a/src/str.rs +++ b/src/str.rs @@ -14,7 +14,7 @@ mod test { use super::*; #[test] - fn test_to_train_case() -> () { + fn test_to_train_case() { assert_eq!(to_train_case("omg-OMG_omg123 omg"), "OMG_OMG_OMG123_OMG") } } diff --git a/src/thread/handle.rs b/src/thread/handle.rs index ea519903c70e1531be00b2398fafdd71c40619d0..8dac14ce3fe0bb22f2fada8fe92c1507f72576ca 100644 --- a/src/thread/handle.rs +++ b/src/thread/handle.rs @@ -154,7 +154,7 @@ mod tests { let end_handle = handle.get_end_handle(); - assert_eq!((&end_handle).has_ended(), Ok(false)); + assert_eq!(end_handle.has_ended(), Ok(false)); end_tx.send(()).unwrap(); @@ -181,7 +181,7 @@ mod tests { end_handles.insert(handle.thread().id(), handle.get_end_handle()); } - for (_, end_handle) in &end_handles { + for end_handle in end_handles.values() { assert_eq!(end_handle.has_ended(), Ok(false)); } diff --git a/src/thread/monitor.rs b/src/thread/monitor.rs index b81e01e45ba4553581ed06983cc2380f07264b27..c2cf0d614eb14a031f8786837d12d5039f34e72a 100644 --- a/src/thread/monitor.rs +++ b/src/thread/monitor.rs @@ -226,7 +226,7 @@ mod tests { let test_handle = thread::spawn(move || { let watch_result = MONITOR.watch(Some(&thread_ids)).unwrap(); - assert_eq!(watch_result.is_empty(), false); + assert!(!watch_result.is_empty()); assert_eq!(watch_result[0].id(), handle.thread().id()); });