File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ functions.
222222<!-- `> bash ./supported-programs.sh` -->
223223
224224<!-- BEGIN mdsh -->
225- ` treefmt-nix ` currently supports 126 formatters:
225+ ` treefmt-nix ` currently supports 128 formatters:
226226
227227* [ actionlint] ( programs/actionlint.nix )
228228* [ aiken] ( programs/aiken.nix )
@@ -238,6 +238,7 @@ functions.
238238* [ cabal-gild] ( programs/cabal-gild.nix )
239239* [ clang-format] ( programs/clang-format.nix )
240240* [ clang-tidy] ( programs/clang-tidy.nix )
241+ * [ clippy] ( programs/clippy.nix )
241242* [ cljfmt] ( programs/cljfmt.nix )
242243* [ cmake-format] ( programs/cmake-format.nix )
243244* [ csharpier] ( programs/csharpier.nix )
Original file line number Diff line number Diff line change 1+ # Example generated by ../examples.sh
2+ [formatter .clippy ]
3+ command = " clippy"
4+ excludes = []
5+ includes = [" *.rs" ]
6+ options = [" --edition" , " 2024" ]
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ config ,
4+ mkFormatterModule ,
5+ ...
6+ } :
7+ let
8+ cfg = config . programs . clippy ;
9+ in
10+ {
11+ meta . maintainers = [
12+ "DigitalBrewStudios/Treefmt-nix"
13+ ] ;
14+
15+ imports = [
16+ ( mkFormatterModule {
17+ name = "clippy" ;
18+ mainProgram = "clippy" ;
19+ includes = [ "*.rs" ] ;
20+ } )
21+ ] ;
22+
23+ options . programs . clippy = {
24+ denyWarnings = lib . mkEnableOption "clippy to denyWarnings" ;
25+ edition = lib . mkOption {
26+ type = lib . types . str ;
27+ default = "2024" ;
28+ description = ''
29+ Rust edition to target when linting
30+ '' ;
31+ } ;
32+ } ;
33+
34+ config = lib . mkIf cfg . enable {
35+ settings . formatter . clippy = {
36+ options = [
37+ "--edition"
38+ cfg . edition
39+ ]
40+ ++ lib . optionals cfg . denyWarnings [
41+ "--deny-warnings"
42+ ] ;
43+ } ;
44+ } ;
45+ }
You can’t perform that action at this time.
0 commit comments