Skip to content

Commit

Permalink
Update clang-format (#2942)
Browse files Browse the repository at this point in the history
It now has a nicer API, so let's use it :)

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2942) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2942)
- [Docs
preview](https://rerun.io/preview/pr%3Aemilk%2Fupdate-clang-format/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aemilk%2Fupdate-clang-format/examples)
  • Loading branch information
emilk authored Aug 9, 2023
1 parent 7a2df8e commit 367499f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/re_types_builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ re_tracing = { workspace = true, features = ["server"] }
anyhow.workspace = true
arrow2.workspace = true
camino.workspace = true
clang-format = "0.1"
clang-format = "0.2"
convert_case = "0.6"
flatbuffers = "23.0"
indent = "0.1"
Expand Down
7 changes: 2 additions & 5 deletions crates/re_types_builder/src/codegen/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ fn string_from_token_stream(token_stream: &TokenStream, source_path: Option<&Utf
);
code.push('\n');

// clang_format has a bit of an ugly API: https://github.com/KDAB/clang-format-rs/issues/3
clang_format::CLANG_FORMAT_STYLE
.set(clang_format::ClangFormatStyle::File)
.ok();
code = clang_format::clang_format(&code).expect("Failed to run clang-format");
code = clang_format::clang_format_with_style(&code, &clang_format::ClangFormatStyle::File)
.expect("Failed to run clang-format");

code
}
Expand Down

0 comments on commit 367499f

Please sign in to comment.