1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-25 03:16:01 +00:00

fix(clippy): fix additional clippy lints in tests (#2813)

This commit is contained in:
David Knaack 2021-06-21 20:13:10 +02:00 committed by GitHub
parent 09b12a52dd
commit a78c6692d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 55 deletions

View File

@ -503,7 +503,7 @@ mod tests {
rust_config.load_config(&config);
assert_eq!(rust_config.symbol, "T ");
assert_eq!(rust_config.disabled, true);
assert!(rust_config.disabled);
assert_eq!(rust_config.some_array, vec!["A"]);
}
@ -631,7 +631,7 @@ mod tests {
#[test]
fn test_from_bool() {
let config = Value::Boolean(true);
assert_eq!(<bool>::from_config(&config).unwrap(), true);
assert!(<bool>::from_config(&config).unwrap());
}
#[test]

View File

@ -512,58 +512,46 @@ mod tests {
let empty = testdir(&[])?;
let empty_dc = DirContents::from_path(empty.path())?;
assert_eq!(
ScanDir {
dir_contents: &empty_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match(),
false
);
assert!(!ScanDir {
dir_contents: &empty_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
empty.close()?;
let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?;
let rust_dc = DirContents::from_path(rust.path())?;
assert_eq!(
ScanDir {
dir_contents: &rust_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match(),
false
);
assert!(!ScanDir {
dir_contents: &rust_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
rust.close()?;
let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?;
let java_dc = DirContents::from_path(java.path())?;
assert_eq!(
ScanDir {
dir_contents: &java_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match(),
false
);
assert!(!ScanDir {
dir_contents: &java_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
java.close()?;
let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?;
let node_dc = DirContents::from_path(node.path())?;
assert_eq!(
ScanDir {
dir_contents: &node_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match(),
true
);
assert!(ScanDir {
dir_contents: &node_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
node.close()?;
Ok(())

View File

@ -85,8 +85,8 @@ mod tests {
.iter()
.any(|&v| parse_nim_version(v).is_some());
assert_eq!(true, all_some);
assert_eq!(true, all_none);
assert!(all_some);
assert!(all_none);
let sample_nimc_output = "Nim Compiler Version 1.2.0 [Linux: amd64]
Compiled at 2020-04-03

View File

@ -419,7 +419,7 @@ mod tests {
let time_end = None;
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]
@ -428,8 +428,8 @@ mod tests {
let time_now = NaiveTime::from_hms(12, 00, 00);
let time_now2 = NaiveTime::from_hms(8, 00, 00);
assert_eq!(is_inside_time_range(time_now, time_start, None), true);
assert_eq!(is_inside_time_range(time_now2, time_start, None), false);
assert!(is_inside_time_range(time_now, time_start, None));
assert!(!is_inside_time_range(time_now2, time_start, None));
}
#[test]
@ -438,8 +438,8 @@ mod tests {
let time_now = NaiveTime::from_hms(15, 00, 00);
let time_now2 = NaiveTime::from_hms(19, 00, 00);
assert_eq!(is_inside_time_range(time_now, None, time_end), true);
assert_eq!(is_inside_time_range(time_now2, None, time_end), false);
assert!(is_inside_time_range(time_now, None, time_end));
assert!(!is_inside_time_range(time_now2, None, time_end));
}
#[test]
@ -450,9 +450,9 @@ mod tests {
let time_now2 = NaiveTime::from_hms(13, 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_eq!(is_inside_time_range(time_now2, time_start, time_end), true);
assert_eq!(is_inside_time_range(time_now3, time_start, time_end), false);
assert!(!is_inside_time_range(time_now, time_start, time_end));
assert!(is_inside_time_range(time_now2, time_start, time_end));
assert!(!is_inside_time_range(time_now3, time_start, time_end));
}
#[test]
@ -463,9 +463,9 @@ mod tests {
let time_now2 = NaiveTime::from_hms(13, 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_eq!(is_inside_time_range(time_now2, time_start, time_end), false);
assert_eq!(is_inside_time_range(time_now3, time_start, time_end), true);
assert!(is_inside_time_range(time_now, time_start, time_end));
assert!(!is_inside_time_range(time_now2, time_start, time_end));
assert!(is_inside_time_range(time_now3, time_start, time_end));
}
#[test]