Skip to content

Commit 065470e

Browse files
committed
exclude generated code from rustfmt using attribute
instead of deleting it before running cargo fmt
1 parent 26554a1 commit 065470e

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

.github/workflows/cargo-test.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ jobs:
1919
rustup component add rustfmt --toolchain nightly
2020
2121
- name: Run rustfmt
22-
# Delete the generated code so it doesn't get formatted.
23-
# We'll be re-running the generator later, so this is okay.
2422
run: |
25-
rm -rf src/generated
26-
echo "// empty module for rustfmt" > src/generated.rs
2723
echo "// empty module for rustfmt" > tests/generated.rs
2824
rustup run nightly cargo fmt --check
29-
rm src/generated.rs
3025
rm tests/generated.rs
3126
3227
- name: Set up Python

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ mod client_helpers;
5656
pub mod oauth2;
5757

5858
// You need to run the Stone generator to create this module.
59+
#[rustfmt::skip]
5960
mod generated;
6061
pub use generated::*;
6162

tests/generated_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#![warn(rust_2018_idioms)]
22

3+
#[rustfmt::skip]
34
mod generated; // You need to run the Stone generator to create this module.

0 commit comments

Comments
 (0)