fix(clippy): fix additional clippy lints in tests (#2813)
This commit is contained in:
parent
09b12a52dd
commit
a78c6692d9
|
@ -503,7 +503,7 @@ mod tests {
|
||||||
rust_config.load_config(&config);
|
rust_config.load_config(&config);
|
||||||
|
|
||||||
assert_eq!(rust_config.symbol, "T ");
|
assert_eq!(rust_config.symbol, "T ");
|
||||||
assert_eq!(rust_config.disabled, true);
|
assert!(rust_config.disabled);
|
||||||
assert_eq!(rust_config.some_array, vec!["A"]);
|
assert_eq!(rust_config.some_array, vec!["A"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_bool() {
|
fn test_from_bool() {
|
||||||
let config = Value::Boolean(true);
|
let config = Value::Boolean(true);
|
||||||
assert_eq!(<bool>::from_config(&config).unwrap(), true);
|
assert!(<bool>::from_config(&config).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -512,58 +512,46 @@ mod tests {
|
||||||
let empty = testdir(&[])?;
|
let empty = testdir(&[])?;
|
||||||
let empty_dc = DirContents::from_path(empty.path())?;
|
let empty_dc = DirContents::from_path(empty.path())?;
|
||||||
|
|
||||||
assert_eq!(
|
assert!(!ScanDir {
|
||||||
ScanDir {
|
|
||||||
dir_contents: &empty_dc,
|
dir_contents: &empty_dc,
|
||||||
files: &["package.json"],
|
files: &["package.json"],
|
||||||
extensions: &["js"],
|
extensions: &["js"],
|
||||||
folders: &["node_modules"],
|
folders: &["node_modules"],
|
||||||
}
|
}
|
||||||
.is_match(),
|
.is_match());
|
||||||
false
|
|
||||||
);
|
|
||||||
empty.close()?;
|
empty.close()?;
|
||||||
|
|
||||||
let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?;
|
let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?;
|
||||||
let rust_dc = DirContents::from_path(rust.path())?;
|
let rust_dc = DirContents::from_path(rust.path())?;
|
||||||
assert_eq!(
|
assert!(!ScanDir {
|
||||||
ScanDir {
|
|
||||||
dir_contents: &rust_dc,
|
dir_contents: &rust_dc,
|
||||||
files: &["package.json"],
|
files: &["package.json"],
|
||||||
extensions: &["js"],
|
extensions: &["js"],
|
||||||
folders: &["node_modules"],
|
folders: &["node_modules"],
|
||||||
}
|
}
|
||||||
.is_match(),
|
.is_match());
|
||||||
false
|
|
||||||
);
|
|
||||||
rust.close()?;
|
rust.close()?;
|
||||||
|
|
||||||
let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?;
|
let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?;
|
||||||
let java_dc = DirContents::from_path(java.path())?;
|
let java_dc = DirContents::from_path(java.path())?;
|
||||||
assert_eq!(
|
assert!(!ScanDir {
|
||||||
ScanDir {
|
|
||||||
dir_contents: &java_dc,
|
dir_contents: &java_dc,
|
||||||
files: &["package.json"],
|
files: &["package.json"],
|
||||||
extensions: &["js"],
|
extensions: &["js"],
|
||||||
folders: &["node_modules"],
|
folders: &["node_modules"],
|
||||||
}
|
}
|
||||||
.is_match(),
|
.is_match());
|
||||||
false
|
|
||||||
);
|
|
||||||
java.close()?;
|
java.close()?;
|
||||||
|
|
||||||
let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?;
|
let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?;
|
||||||
let node_dc = DirContents::from_path(node.path())?;
|
let node_dc = DirContents::from_path(node.path())?;
|
||||||
assert_eq!(
|
assert!(ScanDir {
|
||||||
ScanDir {
|
|
||||||
dir_contents: &node_dc,
|
dir_contents: &node_dc,
|
||||||
files: &["package.json"],
|
files: &["package.json"],
|
||||||
extensions: &["js"],
|
extensions: &["js"],
|
||||||
folders: &["node_modules"],
|
folders: &["node_modules"],
|
||||||
}
|
}
|
||||||
.is_match(),
|
.is_match());
|
||||||
true
|
|
||||||
);
|
|
||||||
node.close()?;
|
node.close()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -85,8 +85,8 @@ mod tests {
|
||||||
.iter()
|
.iter()
|
||||||
.any(|&v| parse_nim_version(v).is_some());
|
.any(|&v| parse_nim_version(v).is_some());
|
||||||
|
|
||||||
assert_eq!(true, all_some);
|
assert!(all_some);
|
||||||
assert_eq!(true, all_none);
|
assert!(all_none);
|
||||||
|
|
||||||
let sample_nimc_output = "Nim Compiler Version 1.2.0 [Linux: amd64]
|
let sample_nimc_output = "Nim Compiler Version 1.2.0 [Linux: amd64]
|
||||||
Compiled at 2020-04-03
|
Compiled at 2020-04-03
|
||||||
|
|
|
@ -419,7 +419,7 @@ mod tests {
|
||||||
let time_end = None;
|
let time_end = None;
|
||||||
let time_now = NaiveTime::from_hms(10, 00, 00);
|
let time_now = NaiveTime::from_hms(10, 00, 00);
|
||||||
|
|
||||||
assert_eq!(is_inside_time_range(time_now, time_start, time_end), true);
|
assert!(is_inside_time_range(time_now, time_start, time_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -428,8 +428,8 @@ mod tests {
|
||||||
let time_now = NaiveTime::from_hms(12, 00, 00);
|
let time_now = NaiveTime::from_hms(12, 00, 00);
|
||||||
let time_now2 = NaiveTime::from_hms(8, 00, 00);
|
let time_now2 = NaiveTime::from_hms(8, 00, 00);
|
||||||
|
|
||||||
assert_eq!(is_inside_time_range(time_now, time_start, None), true);
|
assert!(is_inside_time_range(time_now, time_start, None));
|
||||||
assert_eq!(is_inside_time_range(time_now2, time_start, None), false);
|
assert!(!is_inside_time_range(time_now2, time_start, None));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -438,8 +438,8 @@ mod tests {
|
||||||
let time_now = NaiveTime::from_hms(15, 00, 00);
|
let time_now = NaiveTime::from_hms(15, 00, 00);
|
||||||
let time_now2 = NaiveTime::from_hms(19, 00, 00);
|
let time_now2 = NaiveTime::from_hms(19, 00, 00);
|
||||||
|
|
||||||
assert_eq!(is_inside_time_range(time_now, None, time_end), true);
|
assert!(is_inside_time_range(time_now, None, time_end));
|
||||||
assert_eq!(is_inside_time_range(time_now2, None, time_end), false);
|
assert!(!is_inside_time_range(time_now2, None, time_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -450,9 +450,9 @@ mod tests {
|
||||||
let time_now2 = NaiveTime::from_hms(13, 00, 00);
|
let time_now2 = NaiveTime::from_hms(13, 00, 00);
|
||||||
let time_now3 = NaiveTime::from_hms(20, 00, 00);
|
let time_now3 = NaiveTime::from_hms(20, 00, 00);
|
||||||
|
|
||||||
assert_eq!(is_inside_time_range(time_now, time_start, time_end), false);
|
assert!(!is_inside_time_range(time_now, time_start, time_end));
|
||||||
assert_eq!(is_inside_time_range(time_now2, time_start, time_end), true);
|
assert!(is_inside_time_range(time_now2, time_start, time_end));
|
||||||
assert_eq!(is_inside_time_range(time_now3, time_start, time_end), false);
|
assert!(!is_inside_time_range(time_now3, time_start, time_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -463,9 +463,9 @@ mod tests {
|
||||||
let time_now2 = NaiveTime::from_hms(13, 00, 00);
|
let time_now2 = NaiveTime::from_hms(13, 00, 00);
|
||||||
let time_now3 = NaiveTime::from_hms(20, 00, 00);
|
let time_now3 = NaiveTime::from_hms(20, 00, 00);
|
||||||
|
|
||||||
assert_eq!(is_inside_time_range(time_now, time_start, time_end), true);
|
assert!(is_inside_time_range(time_now, time_start, time_end));
|
||||||
assert_eq!(is_inside_time_range(time_now2, time_start, time_end), false);
|
assert!(!is_inside_time_range(time_now2, time_start, time_end));
|
||||||
assert_eq!(is_inside_time_range(time_now3, time_start, time_end), true);
|
assert!(is_inside_time_range(time_now3, time_start, time_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue