Skip to content

Commit

Permalink
fix(api-keys): use rustfmt toml
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Jan 9, 2024
1 parent 188dae5 commit edf9dc6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ pnpm_workspace(
],
visibility = ["PUBLIC"],
)

export_file(
name = "rustfmt.toml",
visibility = ["PUBLIC"],
)
2 changes: 2 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
edition = "2021"
newline_style = "Unix"
2 changes: 2 additions & 0 deletions toolchains/rust/macros.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def rustfmt_check_impl(ctx: AnalysisContext) -> list[[
run_cmd_args = cmd_args(
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
galoy_rust_toolchain.rustfmt_check[DefaultInfo].default_outputs,
"--config-path",
galoy_rust_toolchain.rustfmt_toml[DefaultInfo].default_outputs,
cmd_args(
[crate_ctx.srcs_tree, ctx.label.package, ctx.attrs.crate_root],
delimiter = "/",
Expand Down
5 changes: 5 additions & 0 deletions toolchains/rust/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GaloyRustToolchainInfo = provider(
"clippy_output": typing.Any,
"crate_context": typing.Any,
"rustfmt_check": typing.Any,
"rustfmt_toml": typing.Any
},
)

Expand All @@ -17,12 +18,16 @@ def galoy_rust_toolchain_impl(ctx) -> list[[DefaultInfo, GaloyRustToolchainInfo]
clippy_output = ctx.attrs._clippy_output,
crate_context = ctx.attrs._crate_context,
rustfmt_check = ctx.attrs._rustfmt_check,
rustfmt_toml = ctx.attrs._rustfmt_toml,
),
]

galoy_rust_toolchain = rule(
impl = galoy_rust_toolchain_impl,
attrs = {
"_rustfmt_toml": attrs.dep(
default = "root//:rustfmt.toml"
),
"_clippy_output": attrs.dep(
default = "toolchains//rust:clippy_output.py",
),
Expand Down

0 comments on commit edf9dc6

Please sign in to comment.