Format workflow: auto-fix and commit formatting/lint issues; extend coverage to tests/**/*.rs#22
Merged
nunoplopes merged 11 commits intomasterfrom Apr 21, 2026
Conversation
Copilot created this pull request from a session on behalf of
nunoplopes
April 20, 2026 15:47
View session
Agent-Logs-Url: https://github.com/Cpp2Rust/cpp2rust/sessions/0d7756ba-9678-4a15-b2f9-5e6975d34282 Co-authored-by: Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
Agent-Logs-Url: https://github.com/Cpp2Rust/cpp2rust/sessions/0d7756ba-9678-4a15-b2f9-5e6975d34282 Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Cpp2Rust/cpp2rust/sessions/0d7756ba-9678-4a15-b2f9-5e6975d34282 Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
…verage to workflow Agent-Logs-Url: https://github.com/Cpp2Rust/cpp2rust/sessions/010475b0-f8f3-444a-95d3-f622fb2e4daa Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
f72b9fd to
25f62a9
Compare
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 format workflow only reported issues without fixing them, and skipped all
.rsfiles undertests/that aren't part of a Cargo project.Workflow changes
permissions: contents: write+ checkout withref: ${{ github.head_ref || github.ref_name }}so the action can push back to the correct branchclang-format -ifor C++cargo clippy --fix --allow-dirtyfor all three Rust crates (runs beforecargo fmtso clippy's edits are normalized by rustfmt)cargo fmtfor all three Rust cratesrustfmtacrosstests/**/*.rsstefanzweifel/git-auto-commit-action@v5commits any resulting changes back to the branch automaticallyCoverage gap:
tests/**/*.rsThese files are lit-test expected outputs compared byte-for-byte against
cpp2rustoutput. They can't be linted by clippy without a Cargo project context, butrustfmtruns on them directly. Sincecpp2rustalready callsrustfmton its output, keeping the expected files formatted with the same pinned toolchain (1.94.0) keeps them consistent.Auto-fixes applied in this PR
Running the new workflow locally produced these fixes (now committed):
rules/build.rs:collapsible_ifandcollapsible_str_replaceclippy suggestionstests/unit/out/refcount/ub*.rs(22 files): import order normalized to rustfmt 1.94.0tests/unit/out/unsafe/bit_cast.rs: redundant braces removed (use libcc2rs::{prepostfix::*}→use libcc2rs::prepostfix::*)