Skip to content

Commit 6e924a9

Browse files
committed
Use plain rustfmt instead of cargofmt
1 parent 1486b57 commit 6e924a9

File tree

2 files changed

+3
-25
lines changed

2 files changed

+3
-25
lines changed

extras/pre-commit-hooks-extra.nix

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,18 @@
22
imports = [
33
inputs.pre-commit-hooks.flakeModule # Adds perSystem.pre-commit options
44
];
5-
perSystem = { pkgs, lib, config, ... }:
5+
perSystem = { pkgs, ... }:
66
let
7-
inherit (config.pre-commit.settings) rawConfig;
8-
inherit (rawConfig.rust) cargoCratePaths;
9-
rust-bin = pkgs.rust-bin.stable.latest;
7+
rustfmt = pkgs.rust-bin.stable.latest.rustfmt;
108
in
119
{
1210
pre-commit.settings.hooks = {
1311
rustfmt-monorepo =
14-
let
15-
wrapper = pkgs.symlinkJoin {
16-
name = "rustfmt-wrapped";
17-
paths = [ rust-bin.rustfmt ];
18-
nativeBuildInputs = [ pkgs.makeWrapper ];
19-
postBuild = ''
20-
wrapProgram $out/bin/cargo-fmt \
21-
--prefix PATH : ${lib.makeBinPath [ rust-bin.cargo rust-bin.rustfmt ]}
22-
'';
23-
};
24-
in
2512
{
2613
name = "rustfmt";
2714
description = "Format Rust code.";
28-
entry =
29-
builtins.concatStringsSep " && "
30-
(builtins.map
31-
(path:
32-
"${wrapper}/bin/cargo-fmt fmt --manifest-path '${path}/Cargo.toml' -- --color always")
33-
34-
cargoCratePaths);
15+
entry = "${rustfmt}/bin/rustfmt --color always";
3516
files = "\\.rs$";
36-
pass_filenames = false;
3717
};
3818
};
3919
};

pre-commit.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
pre-commit = {
1111
settings = {
12-
rawConfig.rust.cargoCratePaths = [ "runtimes/rust/lbr-prelude" ];
13-
1412
excludes = [
1513
"lambda-buffers-codegen/data/goldens/.*"
1614
"experimental/archive/.*"

0 commit comments

Comments
 (0)