Skip to content

Commit

Permalink
cargo clippy --fix
Browse files Browse the repository at this point in the history
Signed-off-by: Taiki Ono <taiki@finatext.com>
  • Loading branch information
taiki45 committed May 7, 2024
1 parent ecc0536 commit 2cfb71e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/cli/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct ApplyArgs {
/// Add extra guide message to GitHub format output.
#[arg(short, long, env)]
guide: Option<String>,
/// Do not fail if there are confirmed findings. Fail on errors even if no_fail is true.
/// Do not fail if there are confirmed findings. Fail on errors even if `no_fail` is true.
#[arg(short, long, env)]
no_fail: bool,
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/review.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn print_confirmed_summary(results: &[FilterResult], out: &mut dyn Write) -> any
results_by_rule_id_sorted.sort_by_key(|(_, r)| Reverse(r.confirmed));
for (rule_id, per_result) in &results_by_rule_id_sorted {
builder.push_record([
&rule_id,
rule_id,
&(per_result.confirmed + per_result.allowed).to_string(),
&per_result.allowed.to_string(),
&per_result.confirmed.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ mod tests {
#[test]
fn test_validate_duplication_ok() {
let mut allowlist = test::build_empty_allowlist();
allowlist.id = "another-allowlist".to_owned();
"another-allowlist".clone_into(&mut allowlist.id);
let allowlists = vec![allowlist, test::build_empty_allowlist()];
assert!(validate_duplication(&allowlists).is_ok());
}
Expand Down
18 changes: 9 additions & 9 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ mod tests {
fn test_compute_diff_confimed_diff_before_empty_after() -> Result {
let fingerprint = "fingerprint-a".to_owned();
let mut finding = build_empty_finding();
finding.fingerprint = fingerprint.clone();
finding.fingerprint.clone_from(&fingerprint);
let befores = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![finding],
Expand All @@ -186,7 +186,7 @@ mod tests {
fn test_compute_diff_confimed_diff_before_no_filter_result() -> Result {
let fingerprint = "fingerprint-a".to_owned();
let mut finding = build_empty_finding();
finding.fingerprint = fingerprint.clone();
finding.fingerprint.clone_from(&fingerprint);
let befores = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![finding],
Expand All @@ -206,7 +206,7 @@ mod tests {
fn test_compute_diff_confimed_diff_before_present_after() -> Result {
let fingerprint_before = "fingerprint-before".to_owned();
let mut finding_before = build_empty_finding();
finding_before.fingerprint = fingerprint_before.clone();
finding_before.fingerprint.clone_from(&fingerprint_before);
let befores = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![finding_before],
Expand All @@ -215,7 +215,7 @@ mod tests {

let fingerprint_after = "fingerprint-after".to_owned();
let mut finding_after = build_empty_finding();
finding_after.fingerprint = fingerprint_after.clone();
finding_after.fingerprint.clone_from(&fingerprint_after);
let afters = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![finding_after],
Expand All @@ -235,7 +235,7 @@ mod tests {
fn test_compute_diff_confimed_diff_after() -> Result {
let fingerprint = "fingerprint-a".to_owned();
let mut finding = build_empty_finding();
finding.fingerprint = fingerprint.clone();
finding.fingerprint.clone_from(&fingerprint);
let befores = vec![build_empty_filter_result("repo1")];
let afters = vec![FilterResult {
repo_name: "repo1".to_owned(),
Expand All @@ -255,7 +255,7 @@ mod tests {
fn test_compute_diff_allowed_diff_before() -> Result {
let fingerprint = "fingerprint-a".to_owned();
let mut allowed_finding = build_empty_allowed_finding();
allowed_finding.finding.fingerprint = fingerprint.clone();
allowed_finding.finding.fingerprint.clone_from(&fingerprint);
let befores = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![],
Expand All @@ -279,7 +279,7 @@ mod tests {
fn test_compute_diff_confimed_diff_after_no_filter_result() -> Result {
let fingerprint = "fingerprint-a".to_owned();
let mut finding = build_empty_finding();
finding.fingerprint = fingerprint.clone();
finding.fingerprint.clone_from(&fingerprint);
let befores = vec![];
let afters = vec![FilterResult {
repo_name: "repo1".to_owned(),
Expand All @@ -299,7 +299,7 @@ mod tests {
fn test_compute_diff_confimed_diff_after_present_before() -> Result {
let fingerprint_before = "fingerprint-before".to_owned();
let mut allowed_finding_before = build_empty_allowed_finding();
allowed_finding_before.finding.fingerprint = fingerprint_before.clone();
allowed_finding_before.finding.fingerprint.clone_from(&fingerprint_before);
let befores = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![],
Expand All @@ -308,7 +308,7 @@ mod tests {

let fingerprint_after = "fingerprint-after".to_owned();
let mut allowed_finding_after = build_empty_allowed_finding();
allowed_finding_after.finding.fingerprint = fingerprint_after.clone();
allowed_finding_after.finding.fingerprint.clone_from(&fingerprint_after);
let afters = vec![FilterResult {
repo_name: "repo1".to_owned(),
confirmed: vec![],
Expand Down
20 changes: 10 additions & 10 deletions src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ mod tests {
let mut finding = build_empty_finding();

allowlist.stopwords = Some(vec!["dev".to_owned()]);
finding.secret = "334-dev-kjdlsa93428".to_owned();
"334-dev-kjdlsa93428".clone_into(&mut finding.secret);
assert_allow(&allowlist, &finding)
}

Expand All @@ -219,7 +219,7 @@ mod tests {
let mut finding = build_empty_finding();

set_regex_expr_to_allowlist(&mut allowlist, "^test-secret$")?;
finding.secret = "test-secret".to_owned();
"test-secret".clone_into(&mut finding.secret);
assert_allow(&allowlist, &finding)
}

Expand All @@ -229,7 +229,7 @@ mod tests {
let mut finding = build_empty_finding();

set_regex_expr_to_allowlist(&mut allowlist, "^test$")?;
finding.secret = "test-secret".to_owned();
"test-secret".clone_into(&mut finding.secret);
assert_not_allow(&allowlist, &finding)
}

Expand All @@ -240,8 +240,8 @@ mod tests {

allowlist.regex_target = Some(RegexTarget::Match);
set_regex_expr_to_allowlist(&mut allowlist, "^key = test-secret")?;
finding.secret = "test-secret".to_owned();
finding.matched = "key = test-secret".to_owned();
"test-secret".clone_into(&mut finding.secret);
"key = test-secret".clone_into(&mut finding.matched);
assert_allow(&allowlist, &finding)
}

Expand All @@ -252,8 +252,8 @@ mod tests {

allowlist.regex_target = Some(RegexTarget::Match);
set_regex_expr_to_allowlist(&mut allowlist, "^test-secret$")?;
finding.secret = "test-secret".to_owned();
finding.matched = "key = test-secret".to_owned();
"test-secret".clone_into(&mut finding.secret);
"key = test-secret".clone_into(&mut finding.matched);
assert_not_allow(&allowlist, &finding)
}

Expand All @@ -264,9 +264,9 @@ mod tests {

allowlist.regex_target = Some(RegexTarget::Line);
set_regex_expr_to_allowlist(&mut allowlist, "^book_key = test-secret")?;
finding.secret = "test-secret".to_owned();
finding.matched = "key = test-secret".to_owned();
finding.line = "book_key = test-secret # comment".to_owned();
"test-secret".clone_into(&mut finding.secret);
"key = test-secret".clone_into(&mut finding.matched);
"book_key = test-secret # comment".clone_into(&mut finding.line);
assert_allow(&allowlist, &finding)
}
}

0 comments on commit 2cfb71e

Please sign in to comment.