-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support rustfmt on crates with generated sources
- Loading branch information
1 parent
54bef51
commit d653b4e
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# rustfmt options: https://rust-lang.github.io/rustfmt/ | ||
|
||
# Skipping children allows rustfmt to run on crates with | ||
# generated source files. Without this formatting will | ||
# fail with: `failed to resolve mod ${MOD}`. | ||
skip_children = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load(":rustfmt_integration_test_suite.bzl", "rustfmt_integration_test_suite") | ||
|
||
exports_files([ | ||
"test_rustfmt.toml", | ||
]) | ||
|
||
write_file( | ||
name = "srcs/generated/generated", | ||
out = "srcs/generated/generated.rs", | ||
content = """\ | ||
pub fn greeting() { | ||
println!("Guten tag!"); | ||
} | ||
""".splitlines(), | ||
newline = "unix", | ||
) | ||
|
||
rustfmt_integration_test_suite( | ||
name = "rustfmt_integration_test_suite", | ||
) |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod generated; | ||
|
||
pub fn main() { | ||
generated::greeting(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
# rustfmt options: https://rust-lang.github.io/rustfmt/ | ||
|
||
# Skipping children allows rustfmt to run on crates with | ||
# generated source files. Without this formatting will | ||
# fail with: `failed to resolve mod ${MOD}`. | ||
skip_children = true |