ci: check formatting of all crates (#598)

Check formatting of all crates to ensure the whole codebase stays
formatted.
This commit is contained in:
George Hopkins
2023-11-20 15:34:04 +01:00
committed by GitHub
parent 0f3b485813
commit 14248f8e17
2 changed files with 12 additions and 12 deletions

View File

@@ -82,7 +82,7 @@ jobs:
path: target/**
key: ${{ runner.os }}-target-${{ github.sha }}
- name: Format
run: cargo fmt --check -p ${{ env.RUNTIME_CRATE }}
run: cargo fmt --check
- name: Lint
run: cargo clippy --release --all-features --no-deps -p ${{ env.RUNTIME_CRATE }}
- name: Test

View File

@@ -13,20 +13,21 @@ fn rewrite(line: &'_ str) -> Option<Cow<'_, str>> {
if cfg!(target_os = "macos") {
if line.starts_with("typedef __builtin_va_list ") {
return None
return None;
}
} else if cfg!(target_os = "windows") {
if line.contains("__gnuc_va_list") ||
line.starts_with("__pragma") ||
line.contains("__attribute__") ||
line.contains("uintptr_t") ||
line.contains("intptr_t") ||
line.contains("size_t") ||
line.contains("ptrdiff_t") {
return None
if line.contains("__gnuc_va_list")
|| line.starts_with("__pragma")
|| line.contains("__attribute__")
|| line.contains("uintptr_t")
|| line.contains("intptr_t")
|| line.contains("size_t")
|| line.contains("ptrdiff_t")
{
return None;
}
return Some(Cow::Owned(line.replace("__attribute__((__cdecl__))", "")))
return Some(Cow::Owned(line.replace("__attribute__((__cdecl__))", "")));
};
Some(Cow::Borrowed(line))
@@ -52,6 +53,5 @@ fn main() {
.collect::<Vec<Cow<'_, str>>>()
.join("\n\n");
std::fs::write("../target/header.h", data).unwrap();
}