Skip to content

Commit 63de601

Browse files
committed
edits
1 parent c2f513a commit 63de601

3 files changed

Lines changed: 11 additions & 40 deletions

File tree

.github/workflows/format.yml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,15 @@ jobs:
2525
with:
2626
llvm-version: 22
2727

28-
- name: Setup Rust
29-
uses: dtolnay/rust-toolchain@master
30-
with:
31-
toolchain: 1.95.0
32-
components: rustfmt, clippy
33-
34-
- name: Setup nightly Rust for rule-preprocessor clippy
35-
uses: dtolnay/rust-toolchain@master
36-
with:
37-
toolchain: nightly
38-
components: rustfmt, clippy, rustc-dev
28+
- name: Setup Python
29+
run: pip install ruff
3930

40-
- name: Check C++ formatting
41-
run: find cpp2rust tests -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format --dry-run --Werror
31+
- name: Configure
32+
run: cmake -GNinja -B build -S .
4233

43-
- name: Check Rust formatting
44-
run: |
45-
cargo fmt --manifest-path rules/Cargo.toml -- --check
46-
cargo fmt --manifest-path rule-preprocessor/Cargo.toml -- --check
47-
cargo fmt --manifest-path libcc2rs/Cargo.toml -- --check
48-
cargo fmt --manifest-path libcc2rs-macros/Cargo.toml -- --check
49-
find tests -name '*.rs' -print0 | xargs -0 rustfmt --check
34+
- name: Format files
35+
run: ninja format
36+
working-directory: build
5037

51-
- name: Check Rust lints
52-
run: |
53-
cargo clippy --manifest-path rules/Cargo.toml --all-targets --all-features -- -Dwarnings
54-
cargo +nightly clippy --manifest-path rule-preprocessor/Cargo.toml --all-targets --all-features -- -Dwarnings
55-
cargo clippy --manifest-path libcc2rs/Cargo.toml --all-targets --all-features -- -Dwarnings
56-
cargo clippy --manifest-path libcc2rs-macros/Cargo.toml --all-targets --all-features -- -Dwarnings
57-
58-
- name: Check Python (ruff)
59-
uses: astral-sh/ruff-action@v3
60-
with:
61-
args: 'check'
62-
src: tests/lit/lit/formats/Cpp2RustTest.py
63-
- name: Check Python formatting (ruff)
64-
uses: astral-sh/ruff-action@v3
65-
with:
66-
args: 'format --check'
67-
src: tests/lit/lit/formats/Cpp2RustTest.py
38+
- name: Check format
39+
run: git diff --exit-code

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ set(PYTHON_SOURCES ${PROJECT_SOURCE_DIR}/tests/lit/lit/formats/Cpp2RustTest.py)
9191
add_custom_target("format"
9292
COMMAND ${CLANG_FORMAT} -i ${ALL_CXX_SOURCES}
9393
COMMAND cargo +${RUST_STABLE_VERSION} fmt --manifest-path ${PROJECT_SOURCE_DIR}/rules/Cargo.toml
94-
COMMAND cargo +${RUST_STABLE_VERSION} --manifest-path ${PROJECT_SOURCE_DIR}/rule-preprocessor/Cargo.toml
94+
COMMAND cargo +${RUST_STABLE_VERSION} fmt --manifest-path ${PROJECT_SOURCE_DIR}/rule-preprocessor/Cargo.toml
9595
COMMAND cargo +${RUST_STABLE_VERSION} fmt --manifest-path ${PROJECT_SOURCE_DIR}/libcc2rs/Cargo.toml
9696
COMMAND cargo +${RUST_STABLE_VERSION} fmt --manifest-path ${PROJECT_SOURCE_DIR}/libcc2rs-macros/Cargo.toml
9797
COMMAND cargo +${RUST_STABLE_VERSION} clippy --fix --allow-dirty --allow-staged --all-targets --all-features

cpp2rust/converter/mapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,7 @@ std::string normalizeTranslationRule(std::string rule) {
564564

565565
static std::string synthesizeAnonRecordName(const clang::RecordDecl *record) {
566566
std::string parent_name;
567-
if (auto *parent =
568-
clang::dyn_cast<clang::RecordDecl>(record->getDeclContext())) {
567+
if (auto *parent = clang::dyn_cast<clang::RecordDecl>(record->getDeclContext())) {
569568
parent_name = parent->getIdentifier()
570569
? parent->getIdentifier()->getName().str()
571570
: synthesizeAnonRecordName(parent);

0 commit comments

Comments
 (0)