Commit 5210310e authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'clippy-fixes'

71310f17 clippy: fix `needless_borrow` lints
7123a735

 clippy: fix `assert_eq!(bool, bool)` lints
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Tested-by: buildbot's avatarbuildbot <buildbot@kitware.com>
Merge-request: !172
parents dfb1ed06 71310f17
Pipeline #243180 passed with stages
in 10 minutes and 40 seconds
......@@ -509,18 +509,18 @@ mod test {
itertools::assert_equal(result.warnings(), no_strings());
itertools::assert_equal(result.alerts(), errors);
itertools::assert_equal(result.errors(), no_strings());
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
fn check_result_ok(result: &CheckResult) {
itertools::assert_equal(result.warnings(), no_strings());
itertools::assert_equal(result.alerts(), no_strings());
itertools::assert_equal(result.errors(), no_strings());
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......
......@@ -187,9 +187,9 @@ mod tests {
assert_eq!(result.warnings().len(), 0);
assert_eq!(result.alerts().len(), 0);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), true);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(result.allowed());
assert!(result.pass());
}
#[test]
......
......@@ -329,9 +329,9 @@ mod tests {
result.errors()[0],
"commit 029a00428913ee915ce5ee7250c023abfbc2aca3 is not allowed because.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -391,8 +391,8 @@ mod tests {
result.errors()[0],
"commit 029a00428913ee915ce5ee7250c023abfbc2aca3 is not allowed because.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
}
......@@ -291,9 +291,9 @@ mod tests {
"commit 029a00428913ee915ce5ee7250c023abfbc2aca3 is a known-bad commit that was \
removed from the server.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -354,8 +354,8 @@ mod tests {
"commit 029a00428913ee915ce5ee7250c023abfbc2aca3 is a known-bad commit that was \
removed from the server.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
}
......@@ -386,7 +386,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, false);
assert!(!check.required);
if let ChangelogStyle::Directory {
path,
extension,
......@@ -426,7 +426,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, true);
assert!(check.required);
if let ChangelogStyle::Directory {
path,
extension,
......@@ -470,7 +470,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, false);
assert!(!check.required);
if let ChangelogStyle::File {
path,
} = &check.style
......@@ -504,7 +504,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, true);
assert!(check.required);
if let ChangelogStyle::File {
path,
} = &check.style
......@@ -547,7 +547,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, false);
assert!(!check.required);
if let ChangelogStyle::Files {
paths,
} = &check.style
......@@ -582,7 +582,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.required, true);
assert!(check.required);
if let ChangelogStyle::Files {
paths,
} = &check.style
......
......@@ -432,8 +432,8 @@ pub(crate) mod config {
assert_eq!(check.min_summary, 8);
assert_eq!(check.max_summary, 78);
assert_eq!(check.check_work_in_progress, true);
assert_eq!(check.check_rebase_commands, true);
assert!(check.check_work_in_progress);
assert!(check.check_rebase_commands);
assert!(check.tolerated_prefixes.is_empty());
itertools::assert_equal(&check.allowed_prefixes, &[] as &[&str]);
itertools::assert_equal(&check.disallowed_prefixes, &[] as &[&str]);
......@@ -475,8 +475,8 @@ pub(crate) mod config {
assert_eq!(check.min_summary, 1);
assert_eq!(check.max_summary, 100);
assert_eq!(check.check_work_in_progress, false);
assert_eq!(check.check_rebase_commands, false);
assert!(!check.check_work_in_progress);
assert!(!check.check_rebase_commands);
itertools::assert_equal(
check.tolerated_prefixes.iter().map(|re| re.as_str()),
&[exp_tprefix],
......
......@@ -208,7 +208,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.branch, exp_branch);
assert_eq!(check.required, false);
assert!(!check.required);
}
#[test]
......@@ -226,7 +226,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.branch, exp_branch);
assert_eq!(check.required, true);
assert!(check.required);
}
}
......
......@@ -982,8 +982,8 @@ mod tests {
"failed to run the formatting check on commit 1b5be48f8ce45b8fec155a1787cabb6995194ce5",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
}
......@@ -78,7 +78,7 @@ impl InvalidPaths {
/// See https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file for rules.
fn is_valid_for_windows(chars: &[u8]) -> bool {
// Check for invalid characters.
!chars.iter().any(|ref c| WINDOWS_FORBIDDEN_ASCII.contains(*c)) &&
!chars.iter().any(|c| WINDOWS_FORBIDDEN_ASCII.contains(c)) &&
// Check component names.
!chars.split(|&b| b == b'/')
.any(|name| {
......@@ -220,8 +220,8 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.invalid_characters, "");
assert_eq!(check.allow_space, false);
assert_eq!(check.enforce_windows_rules, false);
assert!(!check.allow_space);
assert!(!check.enforce_windows_rules);
}
#[test]
......@@ -240,8 +240,8 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.invalid_characters, "abc");
assert_eq!(check.allow_space, true);
assert_eq!(check.enforce_windows_rules, true);
assert!(check.allow_space);
assert!(check.enforce_windows_rules);
}
}
......
......@@ -994,9 +994,9 @@ mod tests {
"commit 96c193edaf748309b7bb5c2e816abda4a06c80c0 not allowed; empty digest for \
notanalgo algorithm in LFS pointer `unknown-digest-empty.lfs`.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -1019,9 +1019,9 @@ mod tests {
result.errors()[0],
"empty digest for notanalgo algorithm in LFS pointer `unknown-digest-empty.lfs`.",
);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......
......@@ -198,7 +198,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.require_base_exist, true);
assert!(check.require_base_exist);
}
#[test]
......@@ -212,7 +212,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.require_base_exist, false);
assert!(!check.require_base_exist);
}
}
......
......@@ -231,7 +231,7 @@ pub(crate) mod config {
check.disallowed_commit,
CommitId::new(exp_disallowed_commit),
);
assert_eq!(check.required, false);
assert!(!check.required);
}
#[test]
......@@ -256,7 +256,7 @@ pub(crate) mod config {
check.disallowed_commit,
CommitId::new(exp_disallowed_commit),
);
assert_eq!(check.required, true);
assert!(check.required);
}
}
......
......@@ -152,7 +152,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.path, exp_restricted_path);
assert_eq!(check.required, true);
assert!(check.required);
}
#[test]
......@@ -170,7 +170,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.path, exp_restricted_path);
assert_eq!(check.required, false);
assert!(!check.required);
}
}
......
......@@ -275,7 +275,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.require_first_parent, false);
assert!(!check.require_first_parent);
}
#[test]
......@@ -289,7 +289,7 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.require_first_parent, true);
assert!(check.require_first_parent);
}
}
......@@ -330,9 +330,9 @@ mod tests {
"submodule at `submodule` is not configured.",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......@@ -395,9 +395,9 @@ mod tests {
available in the https://gitlab.kitware.com/utils/test-repo.git repository on the \
`master` branch first.",
);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -417,9 +417,9 @@ mod tests {
the tracked branch `master`; please make the commit available from the `master` \
branch first."
);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......
......@@ -188,8 +188,8 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.reject_additions, false);
assert_eq!(check.reject_removals, false);
assert!(!check.reject_additions);
assert!(!check.reject_removals);
}
#[test]
......@@ -205,8 +205,8 @@ pub(crate) mod config {
let check = check.into_check();
assert_eq!(check.reject_additions, true);
assert_eq!(check.reject_removals, true);
assert!(check.reject_additions);
assert!(check.reject_removals);
}
}
......@@ -246,9 +246,9 @@ mod tests {
"commit fe90ee22ae3ce4b4dc41f8d0876e59355ff1e21c adds a submodule at `submodule`.",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......@@ -270,9 +270,9 @@ mod tests {
"commit dab435c23d367c6288540cd97017a0dcd3ac042d adds a submodule at `submodule`.",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......@@ -295,9 +295,9 @@ mod tests {
"commit fe90ee22ae3ce4b4dc41f8d0876e59355ff1e21c adds a submodule at `submodule` \
which is not allowed.",
);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -323,9 +323,9 @@ mod tests {
"commit dab435c23d367c6288540cd97017a0dcd3ac042d adds a submodule at `submodule` \
which is not allowed.",
);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
#[test]
......@@ -411,9 +411,9 @@ mod tests {
"commit 336dbaa31d512033fe77eaba7f92ebfecbd17a39 removes the submodule at `submodule`.",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......@@ -435,9 +435,9 @@ mod tests {
"commit 24573935ac8f352893022e454d03a6450a9e5fe5 removes the submodule at `submodule`.",
);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......@@ -503,9 +503,9 @@ mod tests {
);
assert_eq!(result.alerts().len(), 0);
assert_eq!(result.errors().len(), 0);
assert_eq!(result.temporary(), true);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
#[test]
......
......@@ -114,7 +114,7 @@ fn test_check_custom_ident<'a>(
identity: Identity,
) -> CheckResult {
conf.run_topic(
&ctx,
ctx,
test_name,
&CommitId::new(base),
&CommitId::new(topic),
......@@ -192,27 +192,27 @@ pub fn test_result_warnings(result: CheckResult, warnings: &[&str]) {
itertools::assert_equal(result.warnings(), warnings);
itertools::assert_equal(result.alerts(), no_strings());
itertools::assert_equal(result.errors(), no_strings());
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
pub fn test_result_errors(result: CheckResult, errors: &[&str]) {
itertools::assert_equal(result.warnings(), no_strings());
itertools::assert_equal(result.alerts(), no_strings());
itertools::assert_equal(result.errors(), errors);
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), false);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(!result.pass());
}
pub fn test_result_ok(result: CheckResult) {
itertools::assert_equal(result.warnings(), no_strings());
itertools::assert_equal(result.alerts(), no_strings());
itertools::assert_equal(result.errors(), no_strings());
assert_eq!(result.temporary(), false);
assert_eq!(result.allowed(), false);
assert_eq!(result.pass(), true);
assert!(!result.temporary());
assert!(!result.allowed());
assert!(result.pass());
}
pub fn make_check_conf<T>(check: &T) -> GitCheckConfiguration
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment