Repository navigation
Fix CI: checkin_bom tests use std::slice::from_ref (clippy) - #462
Merged
Merged
Conversation
…t.mjs old mode 100644 new mode 100755 diff --git a/tests/checkin_bom.rs b/tests/checkin_bom.rs index 6d8aafe..7ae5886 100755 --- a/tests/checkin_bom.rs +++ b/tests/checkin_bom.rs @@ -253,11 +253,19 @@ async fn a_checkin_with_the_box_updates_the_bom_from_the_cad_file() { assert_eq!(r.status, StatusCode::OK, "{}", r.text()); let body = r.json(); let result = &body["bom"]; - assert_eq!(strings(&result["added"]), [nut.clone()], "{body}"); - assert_eq!(strings(&result["updated"]), [bolt.clone()], "{body}"); + assert_eq!( + strings(&result["added"]), + std::slice::from_ref(&nut), + "{body}" + ); + assert_eq!( + strings(&result["updated"]), + std::slice::from_ref(&bolt), + "{body}" + ); assert_eq!( strings(&result["kept_not_in_cad"]), - [glue.clone()], + std::slice::from_ref(&glue), "{body}" ); assert_eq!( @@ -292,7 +300,10 @@ async fn a_checkin_with_the_box_updates_the_bom_from_the_cad_file() { let again = r.json(); assert_eq!(again["bom"]["added"], json!([]), "{again}"); assert_eq!(again["bom"]["updated"], json!([]), "{again}"); - assert_eq!(strings(&again["bom"]["kept_not_in_cad"]), [glue.clone()]); + assert_eq!( + strings(&again["bom"]["kept_not_in_cad"]), + std::slice::from_ref(&glue) + ); assert_eq!(bom_audits(&app, rev).await.len(), 1); app.teardown().await; } @@ -325,7 +336,11 @@ async fn an_assumed_quantity_never_overwrites_an_existing_line() { .await; assert_eq!(r.status, StatusCode::OK, "{}", r.text()); let body = r.json(); - assert_eq!(strings(&body["bom"]["added"]), [bolt.clone()], "{body}"); + assert_eq!( + strings(&body["bom"]["added"]), + std::slice::from_ref(&bolt),
clippy refuses [x.clone()] for a one-element array to compare with (cloned_ref_to_slice_refs); seven places in tests/checkin_bom.rs failed the lint job on main (309a06b). Checked locally: clippy --all-targets -D warnings is clean for the server and the desktop app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The lint job (fmt and clippy) on main fails since 309a06b: clippy refuses
[x.clone()]for a one-element array to compare with (cloned_ref_to_slice_refs), seven places intests/checkin_bom.rs(#407). They usestd::slice::from_ref(&x)now.Checked locally this time to the end, not error by error:
cargo clippy --all-targets --locked -- -D warningsis clean for the server and the desktop app,cargo fmtapplied. CHANGELOG entry.🤖 Generated with Claude Code