git.delta.rocks / jrsonnet / refs/commits / 75beb619a12f

difftreelog

ci use hercules

qvomslsuLach2026-04-01parent: #4824700.patch.diff
in: master

110 files changed

modified.envrcdiffbeforeafterboth
--- a/.envrc
+++ b/.envrc
@@ -3,6 +3,6 @@
 
 use flake
 
-if ! diff .github/hooks/pre-commit .git/hooks/pre-commit >/dev/null; then
+if ! test -d .jj && ! diff .github/hooks/pre-commit .git/hooks/pre-commit >/dev/null; then
 echo -e "${RED}Hooks are updated, read .github/hooks/pre-commit, and then install it with cp .github/hooks/pre-commit .git/hooks/pre-commit${RESET}"
 fi
deleted.github/workflows/checks.yamldiffbeforeafterboth
--- a/.github/workflows/checks.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Checks
-on: [ pull_request ]
-jobs:
-  tests:
-    name: Tests
-    uses: ./.github/workflows/test.yaml
-  lints:
-    name: Lints
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4.1.4
-      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-      - uses: auguwu/clippy-action@1.3.0
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-    permissions:
-      checks: write
-  formatting:
-    name: Formatting
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4.1.4
-      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-      - uses: actions-rust-lang/rustfmt@v1.1.0
-
deleted.github/workflows/release.yamldiffbeforeafterboth
--- a/.github/workflows/release.yaml
+++ /dev/null
@@ -1,140 +0,0 @@
-name: Release
-on:
-  push:
-    tags: [ 'v*' ]
-jobs:
-  tests:
-    uses: ./.github/workflows/test.yaml
-
-  cargo-release:
-    if: !endsWith(github.ref, '-test')
-    needs: [ tests ]
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4.1.4
-      - name: Install stable toolchain
-        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-        with:
-          toolchain: stable
-      - run: cargo install cargo-release
-      - run: cargo login ${{ secrets.CARGO_TOKEN }}
-      - run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm
-
-  github-release:
-    needs: [ tests ]
-    strategy:
-      matrix:
-        target:
-          # Linux build notes:
-          # While musl targets are not as supported as gnu, those are most relevant to users,
-          # which want to download binaries from github, as glibc has compatibility issues
-          # with older distros
-
-          # Tier 1
-          - i686-pc-windows-msvc
-          - x86_64-apple-darwin
-          - x86_64-pc-windows-msvc
-
-          # Tier 2
-          - aarch64-apple-darwin
-          - aarch64-unknown-linux-musl
-          - i686-unknown-linux-musl
-          - x86_64-unknown-linux-musl
-        include:
-          # Linux
-          - target: aarch64-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-aarch64
-          - target: i686-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-i686
-          - target: x86_64-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-amd64
-
-          # Windows
-          - target: i686-pc-windows-msvc
-            os: windows-latest
-            bin: jrsonnet.exe
-            name: jrsonnet-windows-i686.exe
-          - target: x86_64-pc-windows-msvc
-            os: windows-latest
-            bin: jrsonnet.exe
-            name: jrsonnet-windows-amd64.exe
-
-          # Apple
-          - target: aarch64-apple-darwin
-            os: macOS-latest
-            bin: jrsonnet
-            name: jrsonnet-darwin-aarch64
-          - target: x86_64-apple-darwin
-            os: macOS-latest
-            bin: jrsonnet
-            name: jrsonnet-darwin-amd64
-    runs-on: ${{ matrix.os }}
-    steps:
-      - name: Fetch apt repo updates
-        if: ${{ startsWith(matrix.os, 'ubuntu-') }}
-        run: sudo apt update
-
-      - name: Install stable toolchain
-        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-        with:
-          toolchain: stable
-          target: ${{ matrix.target }}
-
-      - uses: actions/checkout@v4.1.4
-
-      - name: Add experimental flags
-        if: ${{ endsWith(github.ref, '-test' )}}
-        run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV
-
-      - name: Linux x86 cross compiler
-        if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }}
-        run: sudo apt install gcc-multilib
-
-      - name: ARM cross compiler
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        uses: actions-rs/cargo@v1
-        with:
-          command: install
-          args: cross
-
-      - name: ARM gcc
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        run: sudo apt install gcc-aarch64-linux-gnu
-
-      - name: Musl gcc
-        if: ${{ endsWith(matrix.target, '-musl') }}
-        run: sudo apt install musl musl-tools
-
-      - name: Run cross build
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        shell: bash
-        run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
-
-      - name: Run build
-        if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
-
-      - name: Package
-        shell: bash
-        run: |
-          cd target/${{ matrix.target }}/release
-
-          cp ${{ matrix.bin }} ../../../${{ matrix.name }}
-          cd -
-
-      - name: Generate SHA-256
-        run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
-
-      - name: Publish
-        uses: softprops/action-gh-release@v2.0.4
-        with:
-          draft: true
-          files: "jrsonnet*"
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deleted.github/workflows/test.yamldiffbeforeafterboth
--- a/.github/workflows/test.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Test
-on: [ workflow_call ]
-jobs:
-  test:
-    name: Test
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4.1.4
-      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-      - run: cargo test --all
-  test-stable:
-    name: Test on stable
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4.1.4
-      - name: Install the latest stable toolchain
-        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
-        with:
-          toolchain: stable
-      - run: cargo test --all
-
modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9,7 +9,7 @@
 checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
 dependencies = [
  "cfg-if",
- "getrandom",
+ "getrandom 0.3.4",
  "once_cell",
  "version_check",
  "zerocopy",
@@ -38,11 +38,12 @@
 
 [[package]]
 name = "annotate-snippets"
-version = "0.12.11"
+version = "0.12.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16e4850548ff4a25a77ce3bda7241874e17fb702ea551f0cc62a2dbe052f1272"
+checksum = "74fc7650eedcb2fee505aad48491529e408f0e854c2d9f63eb86c1361b9b3f93"
 dependencies = [
  "anstyle",
+ "memchr",
  "unicode-width",
 ]
 
@@ -59,9 +60,9 @@
 
 [[package]]
 name = "anstream"
-version = "0.6.21"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
 dependencies = [
  "anstyle",
  "anstyle-parse",
@@ -74,15 +75,15 @@
 
 [[package]]
 name = "anstyle"
-version = "1.0.13"
+version = "1.0.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
 
 [[package]]
 name = "anstyle-parse"
-version = "0.2.7"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
 dependencies = [
  "utf8parse",
 ]
@@ -109,9 +110,9 @@
 
 [[package]]
 name = "anyhow"
-version = "1.0.101"
+version = "1.0.102"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"
+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
 
 [[package]]
 name = "ar_archive_writer"
@@ -142,9 +143,9 @@
 
 [[package]]
 name = "bitflags"
-version = "2.10.0"
+version = "2.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
+checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
 
 [[package]]
 name = "block-buffer"
@@ -167,18 +168,18 @@
 
 [[package]]
 name = "bumpalo"
-version = "3.19.1"
+version = "3.20.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
+checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
 dependencies = [
  "allocator-api2",
 ]
 
 [[package]]
 name = "cc"
-version = "1.2.55"
+version = "1.2.58"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
+checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1"
 dependencies = [
  "find-msvc-tools",
  "shlex",
@@ -192,9 +193,9 @@
 
 [[package]]
 name = "clap"
-version = "4.5.57"
+version = "4.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a"
+checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351"
 dependencies = [
  "clap_builder",
  "clap_derive",
@@ -202,9 +203,9 @@
 
 [[package]]
 name = "clap_builder"
-version = "4.5.57"
+version = "4.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
 dependencies = [
  "anstream",
  "anstyle",
@@ -214,18 +215,18 @@
 
 [[package]]
 name = "clap_complete"
-version = "4.5.65"
+version = "4.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "430b4dc2b5e3861848de79627b2bedc9f3342c7da5173a14eaa5d0f8dc18ae5d"
+checksum = "19c9f1dde76b736e3681f28cec9d5a61299cbaae0fce80a68e43724ad56031eb"
 dependencies = [
  "clap",
 ]
 
 [[package]]
 name = "clap_derive"
-version = "4.5.55"
+version = "4.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
+checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a"
 dependencies = [
  "heck 0.5.0",
  "proc-macro2",
@@ -235,26 +236,25 @@
 
 [[package]]
 name = "clap_lex"
-version = "0.7.7"
+version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
 
 [[package]]
 name = "colorchoice"
-version = "1.0.4"
+version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
 
 [[package]]
 name = "console"
-version = "0.15.11"
+version = "0.16.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8"
+checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87"
 dependencies = [
  "encode_unicode",
  "libc",
- "once_cell",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -302,7 +302,7 @@
  "bumpalo",
  "hashbrown 0.15.5",
  "indexmap",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "serde",
  "unicode-width",
 ]
@@ -451,12 +451,25 @@
  "cfg-if",
  "js-sys",
  "libc",
- "r-efi",
+ "r-efi 5.3.0",
  "wasip2",
  "wasm-bindgen",
 ]
 
 [[package]]
+name = "getrandom"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+ "wasip2",
+ "wasip3",
+]
+
+[[package]]
 name = "globset"
 version = "0.4.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -538,6 +551,12 @@
 ]
 
 [[package]]
+name = "id-arena"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+
+[[package]]
 name = "indexmap"
 version = "2.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -560,9 +579,9 @@
 
 [[package]]
 name = "insta"
-version = "1.46.3"
+version = "1.47.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4"
+checksum = "7b4a6248eb93a4401ed2f37dfe8ea592d3cf05b7cf4f8efa867b6895af7e094e"
 dependencies = [
  "console",
  "globset",
@@ -589,13 +608,13 @@
 
 [[package]]
 name = "itoa"
-version = "1.0.17"
+version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
 
 [[package]]
 name = "jrsonnet"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "clap",
  "clap_complete",
@@ -612,7 +631,7 @@
 
 [[package]]
 name = "jrsonnet-cli"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "clap",
  "jrsonnet-evaluator",
@@ -623,7 +642,7 @@
 
 [[package]]
 name = "jrsonnet-deps"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "clap",
  "jrsonnet-cli",
@@ -634,7 +653,7 @@
 
 [[package]]
 name = "jrsonnet-evaluator"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "annotate-snippets",
  "anyhow",
@@ -649,7 +668,7 @@
  "jrsonnet-types",
  "num-bigint",
  "pathdiff",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "rustversion",
  "serde",
  "stacker",
@@ -660,7 +679,7 @@
 
 [[package]]
 name = "jrsonnet-fmt"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "clap",
  "hi-doc",
@@ -672,7 +691,7 @@
 
 [[package]]
 name = "jrsonnet-formatter"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "dprint-core",
  "hi-doc",
@@ -704,16 +723,16 @@
 
 [[package]]
 name = "jrsonnet-interner"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "hashbrown 0.16.1",
  "jrsonnet-gcmodule",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
 ]
 
 [[package]]
 name = "jrsonnet-ir"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "insta",
  "jrsonnet-gcmodule",
@@ -724,7 +743,7 @@
 
 [[package]]
 name = "jrsonnet-ir-parser"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "insta",
  "jrsonnet-gcmodule",
@@ -734,14 +753,14 @@
 
 [[package]]
 name = "jrsonnet-lexer"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "logos",
 ]
 
 [[package]]
 name = "jrsonnet-macros"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -751,7 +770,7 @@
 
 [[package]]
 name = "jrsonnet-peg-parser"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "insta",
  "jrsonnet-gcmodule",
@@ -761,7 +780,7 @@
 
 [[package]]
 name = "jrsonnet-rowan-parser"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "anyhow",
  "drop_bomb",
@@ -776,7 +795,7 @@
 
 [[package]]
 name = "jrsonnet-stdlib"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "base64",
  "jrsonnet-evaluator",
@@ -787,7 +806,7 @@
  "md5",
  "num-bigint",
  "regex",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "serde",
  "serde-saphyr",
  "serde_json",
@@ -798,7 +817,7 @@
 
 [[package]]
 name = "jrsonnet-types"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "jrsonnet-gcmodule",
  "peg",
@@ -806,9 +825,9 @@
 
 [[package]]
 name = "js-sys"
-version = "0.3.85"
+version = "0.3.94"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"
+checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9"
 dependencies = [
  "once_cell",
  "wasm-bindgen",
@@ -816,22 +835,28 @@
 
 [[package]]
 name = "keccak"
-version = "0.1.5"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
+checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653"
 dependencies = [
  "cpufeatures",
 ]
 
 [[package]]
+name = "leb128fmt"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+
+[[package]]
 name = "libc"
-version = "0.2.180"
+version = "0.2.184"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
+checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
 
 [[package]]
 name = "libjsonnet"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 dependencies = [
  "jrsonnet-evaluator",
  "jrsonnet-gcmodule",
@@ -842,9 +867,9 @@
 
 [[package]]
 name = "linux-raw-sys"
-version = "0.11.0"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
 
 [[package]]
 name = "log"
@@ -970,9 +995,9 @@
 
 [[package]]
 name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
 
 [[package]]
 name = "once_cell_polyfill"
@@ -1047,6 +1072,16 @@
 ]
 
 [[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
 name = "proc-macro2"
 version = "1.0.106"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1080,9 +1115,9 @@
 
 [[package]]
 name = "quote"
-version = "1.0.44"
+version = "1.0.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
 dependencies = [
  "proc-macro2",
 ]
@@ -1094,6 +1129,12 @@
 checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
 
 [[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
 name = "rand"
 version = "0.9.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1119,7 +1160,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
 dependencies = [
- "getrandom",
+ "getrandom 0.3.4",
 ]
 
 [[package]]
@@ -1165,9 +1206,9 @@
 
 [[package]]
 name = "regex-syntax"
-version = "0.8.9"
+version = "0.8.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
 
 [[package]]
 name = "rowan"
@@ -1189,15 +1230,15 @@
 
 [[package]]
 name = "rustc-hash"
-version = "2.1.1"
+version = "2.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
 
 [[package]]
 name = "rustix"
-version = "1.1.3"
+version = "1.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
 dependencies = [
  "bitflags",
  "errno",
@@ -1233,6 +1274,12 @@
 ]
 
 [[package]]
+name = "semver"
+version = "1.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+
+[[package]]
 name = "serde"
 version = "1.0.228"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1252,7 +1299,7 @@
  "annotate-snippets",
  "base64",
  "encoding_rs_io",
- "getrandom",
+ "getrandom 0.3.4",
  "nohash-hasher",
  "num-traits",
  "regex",
@@ -1401,9 +1448,9 @@
 
 [[package]]
 name = "syn"
-version = "2.0.114"
+version = "2.0.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1423,12 +1470,12 @@
 
 [[package]]
 name = "tempfile"
-version = "3.24.0"
+version = "3.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
 dependencies = [
  "fastrand",
- "getrandom",
+ "getrandom 0.4.2",
  "once_cell",
  "rustix",
  "windows-sys 0.61.2",
@@ -1474,9 +1521,9 @@
 
 [[package]]
 name = "tree-sitter"
-version = "0.26.5"
+version = "0.26.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12987371f54efc9b9306a20dc87ed5aaee9f320c8a8b115e28515c412b2efe39"
+checksum = "887bd495d0582c5e3e0d8ece2233666169fa56a9644d172fc22ad179ab2d0538"
 dependencies = [
  "cc",
  "regex",
@@ -1488,9 +1535,9 @@
 
 [[package]]
 name = "tree-sitter-highlight"
-version = "0.26.5"
+version = "0.26.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b688407049ea1b55a7e872f138947d22389118b9c4d09b459cb34ca205e41c0"
+checksum = "ccde2b54a34b58313e69c02496a2a9ad38d59af79b196b5e1df063431752a7e0"
 dependencies = [
  "regex",
  "streaming-iterator",
@@ -1524,9 +1571,9 @@
 
 [[package]]
 name = "unicode-ident"
-version = "1.0.22"
+version = "1.0.24"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
 
 [[package]]
 name = "unicode-width"
@@ -1535,6 +1582,12 @@
 checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
 
 [[package]]
+name = "unicode-xid"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
+[[package]]
 name = "utf8parse"
 version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1575,10 +1628,19 @@
 ]
 
 [[package]]
+name = "wasip3"
+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
+dependencies = [
+ "wit-bindgen",
+]
+
+[[package]]
 name = "wasm-bindgen"
-version = "0.2.108"
+version = "0.2.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
+checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0"
 dependencies = [
  "cfg-if",
  "once_cell",
@@ -1589,9 +1651,9 @@
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.108"
+version = "0.2.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"
+checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be"
 dependencies = [
  "quote",
  "wasm-bindgen-macro-support",
@@ -1599,9 +1661,9 @@
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.108"
+version = "0.2.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"
+checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2"
 dependencies = [
  "bumpalo",
  "proc-macro2",
@@ -1612,14 +1674,48 @@
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.108"
+version = "0.2.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"
+checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b"
 dependencies = [
  "unicode-ident",
 ]
 
 [[package]]
+name = "wasm-encoder"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
+dependencies = [
+ "leb128fmt",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasm-metadata"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
+dependencies = [
+ "anyhow",
+ "indexmap",
+ "wasm-encoder",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
+dependencies = [
+ "bitflags",
+ "hashbrown 0.15.5",
+ "indexmap",
+ "semver",
+]
+
+[[package]]
 name = "winapi-util"
 version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1721,6 +1817,88 @@
 version = "0.51.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
+dependencies = [
+ "wit-bindgen-rust-macro",
+]
+
+[[package]]
+name = "wit-bindgen-core"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
+dependencies = [
+ "anyhow",
+ "heck 0.5.0",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-bindgen-rust"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
+dependencies = [
+ "anyhow",
+ "heck 0.5.0",
+ "indexmap",
+ "prettyplease",
+ "syn",
+ "wasm-metadata",
+ "wit-bindgen-core",
+ "wit-component",
+]
+
+[[package]]
+name = "wit-bindgen-rust-macro"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
+dependencies = [
+ "anyhow",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wit-bindgen-core",
+ "wit-bindgen-rust",
+]
+
+[[package]]
+name = "wit-component"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
+dependencies = [
+ "anyhow",
+ "bitflags",
+ "indexmap",
+ "log",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-parser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
+dependencies = [
+ "anyhow",
+ "id-arena",
+ "indexmap",
+ "log",
+ "semver",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "unicode-xid",
+ "wasmparser",
+]
 
 [[package]]
 name = "xshell"
@@ -1759,18 +1937,18 @@
 
 [[package]]
 name = "zerocopy"
-version = "0.8.39"
+version = "0.8.48"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
+checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
 dependencies = [
  "zerocopy-derive",
 ]
 
 [[package]]
 name = "zerocopy-derive"
-version = "0.8.39"
+version = "0.8.48"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
+checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1779,6 +1957,6 @@
 
 [[package]]
 name = "zmij"
-version = "1.0.19"
+version = "1.0.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"
+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,20 +8,20 @@
 edition = "2021"
 license = "MIT"
 repository = "https://github.com/CertainLach/jrsonnet"
-version = "0.5.0-pre97"
+version = "0.5.0-pre98"
 
 [workspace.dependencies]
-jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0-pre97" }
-jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0-pre97" }
-jrsonnet-ir = { path = "./crates/jrsonnet-ir", version = "0.5.0-pre97" }
-jrsonnet-ir-parser = { path = "./crates/jrsonnet-ir-parser", version = "0.5.0-pre97" }
-jrsonnet-peg-parser = { path = "./crates/jrsonnet-peg-parser", version = "0.5.0-pre97" }
-jrsonnet-rowan-parser = { path = "./crates/jrsonnet-rowan-parser", version = "0.5.0-pre97" }
-jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0-pre97" }
-jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre97" }
-jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre97" }
-jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre97" }
-jrsonnet-formatter = { path = "./crates/jrsonnet-formatter", version = "0.5.0-pre97" }
+jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0-pre98" }
+jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0-pre98" }
+jrsonnet-ir = { path = "./crates/jrsonnet-ir", version = "0.5.0-pre98" }
+jrsonnet-ir-parser = { path = "./crates/jrsonnet-ir-parser", version = "0.5.0-pre98" }
+jrsonnet-peg-parser = { path = "./crates/jrsonnet-peg-parser", version = "0.5.0-pre98" }
+jrsonnet-rowan-parser = { path = "./crates/jrsonnet-rowan-parser", version = "0.5.0-pre98" }
+jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0-pre98" }
+jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre98" }
+jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre98" }
+jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre98" }
+jrsonnet-formatter = { path = "./crates/jrsonnet-formatter", version = "0.5.0-pre98" }
 jrsonnet-gcmodule = { version = "0.4.2" }
 # Diagnostics.
 # hi-doc is my library, which handles text formatting very well, but isn't polished enough yet
modifiedbindings/jsonnet/Cargo.tomldiffbeforeafterboth
--- a/bindings/jsonnet/Cargo.toml
+++ b/bindings/jsonnet/Cargo.toml
@@ -39,5 +39,8 @@
 interop-threading = []
 
 experimental = ["exp-preserve-order", "exp-destruct"]
-exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order", "jrsonnet-stdlib/exp-preserve-order"]
+exp-preserve-order = [
+  "jrsonnet-evaluator/exp-preserve-order",
+  "jrsonnet-stdlib/exp-preserve-order",
+]
 exp-destruct = ["jrsonnet-evaluator/exp-destruct"]
modifiedbindings/jsonnet/src/import.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/import.rs
+++ b/bindings/jsonnet/src/import.rs
@@ -5,16 +5,15 @@
 	cell::RefCell,
 	collections::HashMap,
 	env::current_dir,
-	ffi::{c_void, CStr, CString},
+	ffi::{CStr, CString, c_void},
 	os::raw::{c_char, c_int},
 	path::PathBuf,
 	ptr::null_mut,
 };
 
 use jrsonnet_evaluator::{
-	bail,
+	AsPathLike, ImportResolver, ResolvePath, bail,
 	error::{ErrorKind::*, Result},
-	AsPathLike, ImportResolver, ResolvePath,
 };
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_ir::{SourceDirectory, SourceFile, SourcePath};
modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/lib.rs
+++ b/bindings/jsonnet/src/lib.rs
@@ -21,14 +21,13 @@
 };
 
 use jrsonnet_evaluator::{
-	apply_tla, bail,
+	AsPathLike, FileImportResolver, IStr, ImportResolver, Result, State, Val, apply_tla, bail,
 	gc::WithCapacityExt as _,
 	manifest::{JsonFormat, ManifestFormat, ToStringFormat},
 	rustc_hash::FxHashMap,
 	stack::set_stack_depth_limit,
 	tla::TlaArg,
 	trace::{CompactFormat, PathResolver, TraceFormat},
-	AsPathLike, FileImportResolver, IStr, ImportResolver, Result, State, Val,
 };
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_ir::SourcePath;
modifiedbindings/jsonnet/src/native.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/native.rs
+++ b/bindings/jsonnet/src/native.rs
@@ -1,13 +1,13 @@
 use std::{
-	ffi::{c_void, CStr},
+	ffi::{CStr, c_void},
 	os::raw::{c_char, c_int},
 };
 
 use jrsonnet_evaluator::{
+	IStr, Val,
 	error::{Error, ErrorKind},
 	function::builtin::{NativeCallback, NativeCallbackHandler},
 	typed::FromUntyped as _,
-	IStr, Val,
 };
 
 use crate::VM;
modifiedbindings/jsonnet/src/val_make.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/val_make.rs
+++ b/bindings/jsonnet/src/val_make.rs
@@ -6,8 +6,8 @@
 };
 
 use jrsonnet_evaluator::{
+	ObjValue, Val,
 	val::{ArrValue, NumValue},
-	ObjValue, Val,
 };
 
 use crate::VM;
modifiedbindings/jsonnet/src/val_modify.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/val_modify.rs
+++ b/bindings/jsonnet/src/val_modify.rs
@@ -4,7 +4,7 @@
 
 use std::{ffi::CStr, os::raw::c_char};
 
-use jrsonnet_evaluator::{val::ArrValue, Thunk, Val};
+use jrsonnet_evaluator::{Thunk, Val, val::ArrValue};
 
 use crate::VM;
 
modifiedbindings/jsonnet/src/vars_tlas.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/vars_tlas.rs
+++ b/bindings/jsonnet/src/vars_tlas.rs
@@ -2,8 +2,7 @@
 
 use std::{ffi::CStr, os::raw::c_char};
 
-use jrsonnet_evaluator::tla::TlaArg;
-use jrsonnet_evaluator::IStr;
+use jrsonnet_evaluator::{IStr, tla::TlaArg};
 
 use crate::VM;
 
modifiedcmds/jrsonnet-deps/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet-deps/src/main.rs
+++ b/cmds/jrsonnet-deps/src/main.rs
@@ -1,12 +1,10 @@
-use std::collections::BTreeSet;
-use std::process::exit;
+use std::{collections::BTreeSet, process::exit};
 
 use clap::Parser;
+use jrsonnet_cli::MiscOpts;
 use jrsonnet_evaluator::{FileImportResolver, ImportResolver};
-use jrsonnet_ir::{visit::Visitor, IStr, Source, SourcePath};
+use jrsonnet_ir::{IStr, Source, SourcePath, visit::Visitor};
 use jrsonnet_ir_parser::ParserSettings;
-
-use jrsonnet_cli::MiscOpts;
 
 #[derive(Parser)]
 struct Opts {
modifiedcmds/jrsonnet-fmt/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet-fmt/src/main.rs
+++ b/cmds/jrsonnet-fmt/src/main.rs
@@ -6,7 +6,7 @@
 };
 
 use clap::Parser;
-use jrsonnet_formatter::{format, FormatOptions};
+use jrsonnet_formatter::{FormatOptions, format};
 
 #[derive(Parser)]
 #[allow(clippy::struct_excessive_bools)]
@@ -51,8 +51,12 @@
 }
 
 fn main_result() -> Result<(), Error> {
-	eprintln!("jrsonnet-fmt is a prototype of a jsonnet code formatter, do not expect it to produce meaningful results right now.");
-	eprintln!("It is not expected for its output to match other implementations, it will be completly separate implementation with maybe different name.");
+	eprintln!(
+		"jrsonnet-fmt is a prototype of a jsonnet code formatter, do not expect it to produce meaningful results right now."
+	);
+	eprintln!(
+		"It is not expected for its output to match other implementations, it will be completly separate implementation with maybe different name."
+	);
 	let mut opts = Opts::parse();
 	let input = if opts.exec {
 		if opts.in_place {
modifiedcmds/jrsonnet/Cargo.tomldiffbeforeafterboth
--- a/cmds/jrsonnet/Cargo.toml
+++ b/cmds/jrsonnet/Cargo.toml
@@ -12,19 +12,19 @@
 
 [features]
 experimental = [
-    "exp-preserve-order",
-    "exp-destruct",
-    "exp-null-coaelse",
-    "exp-object-iteration",
-    "exp-bigint",
-    "exp-apply",
+  "exp-preserve-order",
+  "exp-destruct",
+  "exp-null-coaelse",
+  "exp-object-iteration",
+  "exp-bigint",
+  "exp-apply",
 ]
 # Use mimalloc as allocator
 mimalloc = ["mimallocator"]
 # Experimental feature, which allows to preserve order of object fields
 exp-preserve-order = [
-    "jrsonnet-evaluator/exp-preserve-order",
-    "jrsonnet-cli/exp-preserve-order",
+  "jrsonnet-evaluator/exp-preserve-order",
+  "jrsonnet-cli/exp-preserve-order",
 ]
 # Destructuring of locals
 exp-destruct = ["jrsonnet-evaluator/exp-destruct"]
@@ -36,9 +36,9 @@
 exp-regex = ["jrsonnet-cli/exp-regex"]
 # obj?.field, obj?.['field']
 exp-null-coaelse = [
-    "jrsonnet-evaluator/exp-null-coaelse",
-    "jrsonnet-ir/exp-null-coaelse",
-    "jrsonnet-cli/exp-null-coaelse",
+  "jrsonnet-evaluator/exp-null-coaelse",
+  "jrsonnet-ir/exp-null-coaelse",
+  "jrsonnet-cli/exp-null-coaelse",
 ]
 # --exp-apply
 exp-apply = []
modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -1,5 +1,5 @@
 use std::{
-	fs::{create_dir_all, File},
+	fs::{File, create_dir_all},
 	io::{Read, Write},
 };
 
@@ -7,9 +7,8 @@
 use clap_complete::Shell;
 use jrsonnet_cli::{GcOpts, ManifestOpts, MiscOpts, OutputOpts, StdOpts, TlaOpts, TraceOpts};
 use jrsonnet_evaluator::{
-	apply_tla, bail,
+	ResultExt, State, Val, apply_tla, bail,
 	error::{Error as JrError, ErrorKind},
-	ResultExt, State, Val,
 };
 use jrsonnet_ir::{SourceDefaultIgnoreJpath, SourcePath};
 
modifiedcrates/jrsonnet-cli/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-cli/Cargo.toml
+++ b/crates/jrsonnet-cli/Cargo.toml
@@ -12,20 +12,15 @@
 
 [features]
 exp-preserve-order = [
-    "jrsonnet-evaluator/exp-preserve-order",
-    "jrsonnet-stdlib/exp-preserve-order",
-]
-exp-bigint = [
-    "jrsonnet-evaluator/exp-bigint",
-    "jrsonnet-stdlib/exp-bigint",
+  "jrsonnet-evaluator/exp-preserve-order",
+  "jrsonnet-stdlib/exp-preserve-order",
 ]
+exp-bigint = ["jrsonnet-evaluator/exp-bigint", "jrsonnet-stdlib/exp-bigint"]
 exp-null-coaelse = [
-    "jrsonnet-evaluator/exp-null-coaelse",
-    "jrsonnet-stdlib/exp-null-coaelse",
+  "jrsonnet-evaluator/exp-null-coaelse",
+  "jrsonnet-stdlib/exp-null-coaelse",
 ]
-exp-regex = [
-    "jrsonnet-stdlib/exp-regex",
-]
+exp-regex = ["jrsonnet-stdlib/exp-regex"]
 
 [dependencies]
 jrsonnet-evaluator = { workspace = true, features = ["explaining-traces"] }
modifiedcrates/jrsonnet-cli/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/lib.rs
+++ b/crates/jrsonnet-cli/src/lib.rs
@@ -7,10 +7,10 @@
 
 use clap::Parser;
 use jrsonnet_evaluator::{
-	stack::{limit_stack_depth, StackDepthLimitOverrideGuard},
 	FileImportResolver,
+	stack::{StackDepthLimitOverrideGuard, limit_stack_depth},
 };
-use jrsonnet_gcmodule::{with_thread_object_space, ObjectSpace};
+use jrsonnet_gcmodule::{ObjectSpace, with_thread_object_space};
 pub use manifest::*;
 pub use stdlib::*;
 pub use tla::*;
modifiedcrates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/stdlib.rs
+++ b/crates/jrsonnet-cli/src/stdlib.rs
@@ -1,8 +1,7 @@
 use std::str::FromStr;
 
 use clap::Parser;
-use jrsonnet_evaluator::tla::TlaArg;
-use jrsonnet_evaluator::{trace::PathResolver, Result};
+use jrsonnet_evaluator::{Result, tla::TlaArg, trace::PathResolver};
 use jrsonnet_stdlib::ContextInitializer;
 
 #[derive(Clone)]
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -1,6 +1,7 @@
 use clap::Parser;
-use jrsonnet_evaluator::tla::TlaArg;
-use jrsonnet_evaluator::{error::Result, gc::WithCapacityExt as _, rustc_hash::FxHashMap, IStr};
+use jrsonnet_evaluator::{
+	IStr, error::Result, gc::WithCapacityExt as _, rustc_hash::FxHashMap, tla::TlaArg,
+};
 
 use crate::{ExtFile, ExtStr};
 
modifiedcrates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/Cargo.toml
+++ b/crates/jrsonnet-evaluator/Cargo.toml
@@ -26,13 +26,19 @@
 # Allows to preserve field order in objects
 exp-preserve-order = []
 # Implements field destructuring
-exp-destruct = ["jrsonnet-peg-parser?/exp-destruct", "jrsonnet-ir-parser?/exp-destruct"]
+exp-destruct = [
+  "jrsonnet-peg-parser?/exp-destruct",
+  "jrsonnet-ir-parser?/exp-destruct",
+]
 # Iteration over objects yields [key, value] elements
 exp-object-iteration = []
 # Bigint type
 exp-bigint = ["num-bigint", "jrsonnet-types/exp-bigint"]
 # obj?.field, obj?.['field']
-exp-null-coaelse = ["jrsonnet-peg-parser?/exp-null-coaelse", "jrsonnet-ir-parser?/exp-null-coaelse"]
+exp-null-coaelse = [
+  "jrsonnet-peg-parser?/exp-null-coaelse",
+  "jrsonnet-ir-parser?/exp-null-coaelse",
+]
 
 [dependencies]
 jrsonnet-interner.workspace = true
@@ -63,7 +69,13 @@
 num-bigint = { workspace = true, features = ["serde"], optional = true }
 
 stacker = "0.1.23"
-educe = { version = "0.6.0", default-features = false, features = ["Clone", "Debug", "Eq", "Hash", "PartialEq"] }
+educe = { version = "0.6.0", default-features = false, features = [
+  "Clone",
+  "Debug",
+  "Eq",
+  "Hash",
+  "PartialEq",
+] }
 
 [build-dependencies]
 rustversion = "1.0.22"
modifiedcrates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/arr/mod.rs
+++ b/crates/jrsonnet-evaluator/src/arr/mod.rs
@@ -5,11 +5,11 @@
 	rc::Rc,
 };
 
-use jrsonnet_gcmodule::{cc_dyn, Cc};
+use jrsonnet_gcmodule::{Cc, cc_dyn};
 use jrsonnet_interner::IBytes;
 use jrsonnet_ir::Expr;
 
-use crate::{function::NativeFn, typed::IntoUntyped, Context, Result, Thunk, Val};
+use crate::{Context, Result, Thunk, Val, function::NativeFn, typed::IntoUntyped};
 
 mod spec;
 pub use spec::{ArrayLike, *};
modifiedcrates/jrsonnet-evaluator/src/arr/spec.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/arr/spec.rs
+++ b/crates/jrsonnet-evaluator/src/arr/spec.rs
@@ -1,18 +1,17 @@
-use std::rc::Rc;
-use std::{any::Any, cell::RefCell, fmt::Debug, mem::replace};
+use std::{any::Any, cell::RefCell, fmt::Debug, mem::replace, rc::Rc};
 
 use jrsonnet_gcmodule::{Cc, Trace};
 use jrsonnet_interner::{IBytes, IStr};
 use jrsonnet_ir::Expr;
 
 use super::ArrValue;
-use crate::function::NativeFn;
 use crate::{
+	Context, Error, ObjValue, Result, Thunk, Val,
 	error::ErrorKind::InfiniteRecursionDetected,
 	evaluate,
+	function::NativeFn,
 	typed::{IntoUntyped, Typed},
 	val::ThunkValue,
-	Context, Error, ObjValue, Result, Thunk, Val,
 };
 
 pub trait ArrayLike: Any + Trace + Debug {
modifiedcrates/jrsonnet-evaluator/src/async_import.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/async_import.rs
+++ b/crates/jrsonnet-evaluator/src/async_import.rs
@@ -1,9 +1,7 @@
-use std::rc::Rc;
-use std::{any::Any, cell::RefCell, future::Future};
+use std::{any::Any, cell::RefCell, future::Future, rc::Rc};
 
 use jrsonnet_gcmodule::Acyclic;
-use jrsonnet_ir::visit::Visitor;
-use jrsonnet_ir::{IStr, Source, SourcePath};
+use jrsonnet_ir::{IStr, Source, SourcePath, visit::Visitor};
 use rustc_hash::FxHashMap;
 
 use crate::{AsPathLike, FileData, ImportResolver, ResolvePathOwned, State};
modifiedcrates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/ctx.rs
+++ b/crates/jrsonnet-evaluator/src/ctx.rs
@@ -6,8 +6,8 @@
 use rustc_hash::FxHashMap;
 
 use crate::{
-	error::ErrorKind::*, gc::WithCapacityExt as _, map::LayeredHashMap, ObjValue, Pending, Result,
-	SupThis, Thunk, Val,
+	ObjValue, Pending, Result, SupThis, Thunk, Val, error::ErrorKind::*, gc::WithCapacityExt as _,
+	map::LayeredHashMap,
 };
 /// Context keeps information about current lexical code location
 ///
modifiedcrates/jrsonnet-evaluator/src/dynamic.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/dynamic.rs
+++ b/crates/jrsonnet-evaluator/src/dynamic.rs
@@ -3,7 +3,7 @@
 use educe::Educe;
 use jrsonnet_gcmodule::{Cc, Trace};
 
-use crate::{bail, error::ErrorKind::InfiniteRecursionDetected, val::ThunkValue, Result};
+use crate::{Result, bail, error::ErrorKind::InfiniteRecursionDetected, val::ThunkValue};
 
 #[derive(Trace, Educe)]
 #[educe(Clone)]
modifiedcrates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -7,11 +7,11 @@
 use thiserror::Error;
 
 use crate::{
+	ObjValue, ResolvePathOwned,
 	function::{CallLocation, FunctionSignature, ParamName},
 	stdlib::format::FormatError,
 	typed::TypeLocError,
 	val::ConvertNumValueError,
-	ObjValue, ResolvePathOwned,
 };
 
 #[derive(Debug, Clone)]
@@ -78,7 +78,10 @@
 		if conf < 0.8 {
 			continue;
 		}
-		assert!(field.as_str() != key.as_str(), "looks like string pooling failure, please write any info regarding this crash to https://github.com/CertainLach/jrsonnet/issues/113, thanks!");
+		assert!(
+			field.as_str() != key.as_str(),
+			"looks like string pooling failure, please write any info regarding this crash to https://github.com/CertainLach/jrsonnet/issues/113, thanks!"
+		);
 
 		heap.push((conf, field));
 	}
@@ -271,11 +274,11 @@
 }
 impl fmt::Display for Error {
 	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-		writeln!(f, "{}", self.0 .0)?;
-		for el in &self.0 .1 .0 {
+		writeln!(f, "{}", self.0.0)?;
+		for el in &self.0.1.0 {
 			write!(f, "\t{}", el.desc)?;
 			if let Some(loc) = &el.location {
-				write!(f, "at {}", loc.0 .0 .0)?;
+				write!(f, "at {}", loc.0.0.0)?;
 				loc.0.map_source_locations(&[loc.1, loc.2]);
 			}
 			writeln!(f)?;
modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -3,15 +3,14 @@
 use jrsonnet_interner::IStr;
 use jrsonnet_ir::{BindSpec, Destruct};
 
+#[cfg(feature = "exp-preserve-order")]
+use crate::evaluate;
 use crate::{
-	bail,
+	Context, Pending, Thunk, Val, bail,
 	error::{ErrorKind::*, Result},
-	evaluate_method, evaluate_named_param, Context, Pending, Thunk, Val,
+	evaluate_method, evaluate_named_param,
 };
 
-#[cfg(feature = "exp-preserve-order")]
-use crate::evaluate;
-
 #[allow(clippy::too_many_lines)]
 #[allow(unused_variables)]
 pub fn destruct<H: BuildHasher>(
@@ -107,10 +106,11 @@
 		}
 		#[cfg(feature = "exp-destruct")]
 		Destruct::Object { fields, rest } => {
-			use crate::ObjValueBuilder;
 			use jrsonnet_ir::DestructRest;
 			use rustc_hash::FxHashSet;
 
+			use crate::ObjValueBuilder;
+
 			let captured_fields: FxHashSet<_> = fields.iter().map(|f| f.0.clone()).collect();
 			let field_names: Vec<_> = fields
 				.iter()
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -3,27 +3,28 @@
 use jrsonnet_gcmodule::{Cc, Trace};
 use jrsonnet_interner::IStr;
 use jrsonnet_ir::{
-	function::ParamName, ArgsDesc, AssertStmt, BinaryOpType, BindSpec, CompSpec, Expr, ExprParams,
-	FieldMember, FieldName, ForSpecData, IfSpecData, ImportKind, LiteralType, ObjBody, ObjMembers,
-	Spanned,
+	ArgsDesc, AssertStmt, BinaryOpType, BindSpec, CompSpec, Expr, ExprParams, FieldMember,
+	FieldName, ForSpecData, IfSpecData, ImportKind, LiteralType, ObjBody, ObjMembers, Spanned,
+	function::ParamName,
 };
 use jrsonnet_types::ValType;
 use rustc_hash::FxHashMap;
 
 use self::destructure::destruct;
 use crate::{
+	Context, Error, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result, ResultExt,
+	SupThis, Unbound, Val,
 	arr::ArrValue,
 	bail,
 	destructure::evaluate_dest,
-	error::{suggest_object_fields, ErrorKind::*},
+	error::{ErrorKind::*, suggest_object_fields},
 	evaluate::operator::{evaluate_binary_op_special, evaluate_unary_op},
 	function::{CallLocation, FuncDesc, FuncVal},
 	gc::WithCapacityExt as _,
 	in_frame,
 	typed::{FromUntyped, IntoUntyped as _, Typed},
 	val::{CachedUnbound, IndexableVal, NumValue, StrValue, Thunk},
-	with_state, Context, Error, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result,
-	ResultExt, SupThis, Unbound, Val,
+	with_state,
 };
 pub mod destructure;
 pub mod operator;
modifiedcrates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs
@@ -3,14 +3,14 @@
 use jrsonnet_ir::{BinaryOpType, Expr, UnaryOpType};
 
 use crate::{
+	Context, Result, Val,
 	arr::ArrValue,
 	bail,
 	error::ErrorKind::*,
 	evaluate,
 	stdlib::std_format,
 	typed::IntoUntyped as _,
-	val::{equals, StrValue},
-	Context, Result, Val,
+	val::{StrValue, equals},
 };
 
 pub fn evaluate_unary_op(op: UnaryOpType, b: &Val) -> Result<Val> {
modifiedcrates/jrsonnet-evaluator/src/function/builtin.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/builtin.rs
+++ b/crates/jrsonnet-evaluator/src/function/builtin.rs
@@ -1,6 +1,6 @@
 use std::any::Any;
 
-use jrsonnet_gcmodule::{cc_dyn, Trace, TraceBox};
+use jrsonnet_gcmodule::{Trace, TraceBox, cc_dyn};
 use jrsonnet_ir::function::{FunctionSignature, ParamDefault, ParamName, ParamParse};
 
 use super::CallLocation;
modifiedcrates/jrsonnet-evaluator/src/function/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/mod.rs
+++ b/crates/jrsonnet-evaluator/src/function/mod.rs
@@ -9,11 +9,11 @@
 use self::{
 	builtin::{Builtin, StaticBuiltin},
 	parse::{parse_builtin_call, parse_default_function_call, parse_function_call},
-	prepared::{parse_prepared_builtin_call, parse_prepared_function_call, PreparedCall},
+	prepared::{PreparedCall, parse_prepared_builtin_call, parse_prepared_function_call},
 };
 use crate::{
-	bail, error::ErrorKind::*, evaluate, evaluate_trivial, function::builtin::BuiltinFunc, Context,
-	Result, Thunk, Val,
+	Context, Result, Thunk, Val, bail, error::ErrorKind::*, evaluate, evaluate_trivial,
+	function::builtin::BuiltinFunc,
 };
 
 pub mod builtin;
@@ -21,10 +21,9 @@
 mod parse;
 mod prepared;
 
+pub use jrsonnet_ir::function::*;
 pub use native::NativeFn;
 pub use prepared::PreparedFuncVal;
-
-pub use jrsonnet_ir::function::*;
 
 /// Function callsite location.
 /// Either from other jsonnet code, specified by expression location, or from native (without location).
modifiedcrates/jrsonnet-evaluator/src/function/native.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/native.rs
+++ b/crates/jrsonnet-evaluator/src/function/native.rs
@@ -1,14 +1,14 @@
 use std::marker::PhantomData;
 
 use jrsonnet_gcmodule::Trace;
+use jrsonnet_types::{ComplexValType, ValType};
 
 use super::PreparedFuncVal;
 use crate::{
+	CallLocation, Result, Val,
 	function::FuncVal,
 	typed::{FromUntyped, IntoUntyped, Typed},
-	CallLocation, Result, Val,
 };
-use jrsonnet_types::{ComplexValType, ValType};
 
 #[derive(Debug, Trace, Clone)]
 pub struct NativeFn<D: 'static>(pub(crate) PreparedFuncVal, PhantomData<D>);
modifiedcrates/jrsonnet-evaluator/src/function/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/parse.rs
+++ b/crates/jrsonnet-evaluator/src/function/parse.rs
@@ -1,18 +1,17 @@
 use std::rc::Rc;
 
 use jrsonnet_ir::{
+	ArgsDesc, Expr, ExprParams,
 	function::{FunctionSignature, ParamName},
-	ArgsDesc, Expr, ExprParams,
 };
 use rustc_hash::FxHashMap;
 
 use crate::{
-	bail,
+	Context, Pending, Thunk, Val, bail,
 	destructure::destruct,
 	error::{ErrorKind::*, Result},
 	evaluate, evaluate_named_param,
 	gc::WithCapacityExt as _,
-	Context, Pending, Thunk, Val,
 };
 
 fn eval_arg(ctx: Context, arg: &Rc<Expr>, tailstrict: bool) -> Result<Thunk<Val>> {
modifiedcrates/jrsonnet-evaluator/src/function/prepared.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/prepared.rs
+++ b/crates/jrsonnet-evaluator/src/function/prepared.rs
@@ -1,16 +1,14 @@
 use std::rc::Rc;
 
 use jrsonnet_gcmodule::{Acyclic, Trace};
-use jrsonnet_ir::function::FunctionSignature;
-use jrsonnet_ir::{ExprParams, IStr};
+use jrsonnet_ir::{ExprParams, IStr, function::FunctionSignature};
 use rustc_hash::{FxHashMap, FxHashSet};
-
-use crate::destructure::destruct;
-use crate::gc::WithCapacityExt;
-use crate::{bail, error::ErrorKind::*, Result};
-use crate::{evaluate_named_param, Context, ContextBuilder, Pending, Thunk, Val};
 
 use super::{CallLocation, FuncVal};
+use crate::{
+	Context, ContextBuilder, Pending, Result, Thunk, Val, bail, destructure::destruct,
+	error::ErrorKind::*, evaluate_named_param, gc::WithCapacityExt,
+};
 
 #[derive(Debug, Trace, Clone)]
 pub struct PreparedFuncVal {
modifiedcrates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -2,17 +2,17 @@
 
 use jrsonnet_interner::IStr;
 use serde::{
+	Deserialize, Serialize, Serializer,
 	de::{self, Visitor},
 	ser::{
 		Error, SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant, SerializeTuple,
 		SerializeTupleStruct, SerializeTupleVariant,
 	},
-	Deserialize, Serialize, Serializer,
 };
 
 use crate::{
-	arr::ArrValue, in_description_frame, runtime_error, val::NumValue, Error as JrError, ObjValue,
-	ObjValueBuilder, Result, Val,
+	Error as JrError, ObjValue, ObjValueBuilder, Result, Val, arr::ArrValue, in_description_frame,
+	runtime_error, val::NumValue,
 };
 
 impl<'de> Deserialize<'de> for Val {
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -40,7 +40,7 @@
 pub use evaluate::*;
 use function::CallLocation;
 pub use import::*;
-use jrsonnet_gcmodule::{cc_dyn, Cc, Trace};
+use jrsonnet_gcmodule::{Cc, Trace, cc_dyn};
 pub use jrsonnet_interner::{IBytes, IStr};
 pub use jrsonnet_ir as parser;
 use jrsonnet_ir::{Expr, Source, SourcePath};
modifiedcrates/jrsonnet-evaluator/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/manifest.rs
@@ -1,6 +1,6 @@
 use std::{borrow::Cow, fmt::Write, ptr};
 
-use crate::{bail, in_description_frame, Result, ResultExt, Val};
+use crate::{Result, ResultExt, Val, bail, in_description_frame};
 
 pub trait ManifestFormat {
 	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()>;
modifiedcrates/jrsonnet-evaluator/src/map.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/map.rs
+++ b/crates/jrsonnet-evaluator/src/map.rs
@@ -2,7 +2,7 @@
 use jrsonnet_interner::IStr;
 use rustc_hash::FxHashMap;
 
-use crate::{gc::WithCapacityExt as _, Thunk, Val};
+use crate::{Thunk, Val, gc::WithCapacityExt as _};
 
 #[derive(Trace, Debug)]
 #[trace(tracking(force))]
modifiedcrates/jrsonnet-evaluator/src/obj/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/mod.rs
+++ b/crates/jrsonnet-evaluator/src/obj/mod.rs
@@ -11,7 +11,7 @@
 };
 
 use educe::Educe;
-use jrsonnet_gcmodule::{cc_dyn, Acyclic, Cc, Trace, Weak};
+use jrsonnet_gcmodule::{Acyclic, Cc, Trace, Weak, cc_dyn};
 use jrsonnet_interner::IStr;
 use jrsonnet_ir::Span;
 use rustc_hash::{FxHashMap, FxHashSet};
@@ -22,13 +22,13 @@
 pub use oop::ObjValueBuilder;
 
 use crate::{
+	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val,
 	arr::{PickObjectKeyValues, PickObjectValues},
 	bail,
-	error::{suggest_object_fields, ErrorKind::*},
+	error::{ErrorKind::*, suggest_object_fields},
 	identity_hash,
 	operator::evaluate_add_op,
 	val::{ArrValue, ThunkValue},
-	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val,
 };
 
 #[cfg(not(feature = "exp-preserve-order"))]
modifiedcrates/jrsonnet-evaluator/src/obj/oop.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/oop.rs
+++ b/crates/jrsonnet-evaluator/src/obj/oop.rs
@@ -1,21 +1,25 @@
-use std::cell::{Cell, RefCell};
-use std::ops::ControlFlow;
-use std::{fmt, mem};
+use std::{
+	cell::{Cell, RefCell},
+	fmt, mem,
+	ops::ControlFlow,
+};
 
-use crate::function::{CallLocation, FuncVal};
-use crate::gc::WithCapacityExt as _;
-use crate::{
-	bail, error::ErrorKind::*, in_frame, CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val,
-};
 use jrsonnet_gcmodule::{Cc, Trace};
 use jrsonnet_ir::IStr;
 use rustc_hash::{FxHashMap, FxHashSet};
 
-use super::ordering::{FieldIndex, SuperDepth};
 use super::{
 	CcObjectAssertion, CcObjectCore, EnumFields, EnumFieldsHandler, FieldVisibility, GetFor,
 	HasFieldIncludeHidden, ObjMember, ObjMemberBuilder, ObjValue, ObjValueInner, ObjectAssertion,
 	ObjectCore, OmitFieldsCore, SupThis,
+	ordering::{FieldIndex, SuperDepth},
+};
+use crate::{
+	CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val, bail,
+	error::ErrorKind::*,
+	function::{CallLocation, FuncVal},
+	gc::WithCapacityExt as _,
+	in_frame,
 };
 
 #[allow(clippy::module_name_repetitions)]
modifiedcrates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/stdlib/format.rs
1//! faster std.format impl2#![allow(clippy::too_many_arguments)]34use jrsonnet_gcmodule::Trace;5use jrsonnet_interner::IStr;6use jrsonnet_types::ValType;7use thiserror::Error;89use crate::{10	bail,11	error::{format_found, suggest_object_fields, ErrorKind::*},12	typed::FromUntyped,13	Error, ObjValue, Result, Val,14};1516#[derive(Debug, Clone, Error, Trace)]17pub enum FormatError {18	#[error("truncated format code")]19	TruncatedFormatCode,20	#[error("unrecognized conversion type: {0}")]21	UnrecognizedConversionType(char),2223	#[error("not enough values")]24	NotEnoughValues,2526	#[error("cannot use * width with object")]27	CannotUseStarWidthWithObject,28	#[error("mapping keys required")]29	MappingKeysRequired,30	#[error("no such format field: {0}")]31	NoSuchFormatField(IStr),3233	#[error("expected subfield <{0}> to be an object, got {1} instead")]34	SubfieldDidntYieldAnObject(IStr, ValType),35	#[error("subfield not found: <[{full}]{current}>{}", format_found(.found, "subfield"))]36	SubfieldNotFound {37		current: IStr,38		full: IStr,39		found: Box<Vec<IStr>>,40	},41}4243impl From<FormatError> for Error {44	fn from(e: FormatError) -> Self {45		Self::new(Format(e))46	}47}4849use FormatError::*;5051type ParseResult<'t, T> = std::result::Result<(T, &'t str), FormatError>;5253pub fn try_parse_mapping_key(str: &str) -> ParseResult<'_, &str> {54	if str.is_empty() {55		return Err(TruncatedFormatCode);56	}57	let bytes = str.as_bytes();58	if bytes[0] == b'(' {59		let mut i = 1;60		while i < bytes.len() {61			if bytes[i] == b')' {62				return Ok((&str[1..i], &str[i + 1..]));63			}64			i += 1;65		}66		Err(TruncatedFormatCode)67	} else {68		Ok(("", str))69	}70}7172#[cfg(test)]73pub mod tests_key {74	use super::*;7576	#[test]77	fn parse_key() {78		assert_eq!(79			try_parse_mapping_key("(hello ) world").unwrap(),80			("hello ", " world")81		);82		assert_eq!(try_parse_mapping_key("() world").unwrap(), ("", " world"));83		assert_eq!(try_parse_mapping_key(" world").unwrap(), ("", " world"));84		assert_eq!(85			try_parse_mapping_key(" () world").unwrap(),86			("", " () world")87		);88	}8990	#[test]91	#[should_panic = "TruncatedFormatCode"]92	fn parse_key_missing_start() {93		try_parse_mapping_key("").unwrap();94	}9596	#[test]97	#[should_panic = "TruncatedFormatCode"]98	fn parse_key_missing_end() {99		try_parse_mapping_key("(   ").unwrap();100	}101}102103#[allow(clippy::struct_excessive_bools)]104#[derive(Default, Debug)]105pub struct CFlags {106	pub alt: bool,107	pub zero: bool,108	pub left: bool,109	pub blank: bool,110	pub sign: bool,111}112113pub fn try_parse_cflags(str: &str) -> ParseResult<'_, CFlags> {114	if str.is_empty() {115		return Err(TruncatedFormatCode);116	}117	let bytes = str.as_bytes();118	let mut i = 0;119	let mut out = CFlags::default();120	loop {121		if bytes.len() == i {122			return Err(TruncatedFormatCode);123		}124		match bytes[i] {125			b'#' => out.alt = true,126			b'0' => out.zero = true,127			b'-' => out.left = true,128			b' ' => out.blank = true,129			b'+' => out.sign = true,130			_ => break,131		}132		i += 1;133	}134	Ok((out, &str[i..]))135}136137#[derive(Debug, PartialEq, Eq)]138pub enum Width {139	Star,140	Fixed(u16),141}142pub fn try_parse_field_width(str: &str) -> ParseResult<'_, Width> {143	if str.is_empty() {144		return Err(TruncatedFormatCode);145	}146	let bytes = str.as_bytes();147	if bytes[0] == b'*' {148		return Ok((Width::Star, &str[1..]));149	}150	let mut out: u16 = 0;151	let mut digits = 0;152	while let Some(digit) = (bytes[digits] as char).to_digit(10) {153		out *= 10;154		out += digit as u16;155		digits += 1;156		if digits == bytes.len() {157			return Err(TruncatedFormatCode);158		}159	}160	Ok((Width::Fixed(out), &str[digits..]))161}162163pub fn try_parse_precision(str: &str) -> ParseResult<'_, Option<Width>> {164	if str.is_empty() {165		return Err(TruncatedFormatCode);166	}167	let bytes = str.as_bytes();168	if bytes[0] == b'.' {169		try_parse_field_width(&str[1..]).map(|(r, s)| (Some(r), s))170	} else {171		Ok((None, str))172	}173}174175// Only skips176pub fn try_parse_length_modifier(str: &str) -> ParseResult<'_, ()> {177	if str.is_empty() {178		return Err(TruncatedFormatCode);179	}180	let bytes = str.as_bytes();181	let mut idx = 0;182	while bytes[idx] == b'h' || bytes[idx] == b'l' || bytes[idx] == b'L' {183		idx += 1;184		if bytes.len() == idx {185			return Err(TruncatedFormatCode);186		}187	}188	Ok(((), &str[idx..]))189}190191#[derive(Debug, PartialEq, Eq)]192pub enum ConvTypeV {193	Decimal,194	Octal,195	Hexadecimal,196	Scientific,197	Float,198	Shorter,199	Char,200	String,201	Percent,202}203pub struct ConvType {204	v: ConvTypeV,205	caps: bool,206}207208pub fn parse_conversion_type(str: &str) -> ParseResult<'_, ConvType> {209	if str.is_empty() {210		return Err(TruncatedFormatCode);211	}212213	let code = str.as_bytes()[0];214	let v: (ConvTypeV, bool) = match code {215		b'd' | b'i' | b'u' => (ConvTypeV::Decimal, false),216		b'o' => (ConvTypeV::Octal, false),217		b'x' => (ConvTypeV::Hexadecimal, false),218		b'X' => (ConvTypeV::Hexadecimal, true),219		b'e' => (ConvTypeV::Scientific, false),220		b'E' => (ConvTypeV::Scientific, true),221		b'f' => (ConvTypeV::Float, false),222		b'F' => (ConvTypeV::Float, true),223		b'g' => (ConvTypeV::Shorter, false),224		b'G' => (ConvTypeV::Shorter, true),225		b'c' => (ConvTypeV::Char, false),226		b's' => (ConvTypeV::String, false),227		b'%' => (ConvTypeV::Percent, false),228		c => return Err(UnrecognizedConversionType(c as char)),229	};230231	Ok((ConvType { v: v.0, caps: v.1 }, &str[1..]))232}233234#[derive(Debug)]235pub struct Code<'s> {236	mkey: &'s str,237	cflags: CFlags,238	width: Width,239	precision: Option<Width>,240	convtype: ConvTypeV,241	caps: bool,242}243pub fn parse_code(str: &str) -> ParseResult<'_, Code<'_>> {244	if str.is_empty() {245		return Err(TruncatedFormatCode);246	}247	let (mkey, str) = try_parse_mapping_key(str)?;248	let (cflags, str) = try_parse_cflags(str)?;249	let (width, str) = try_parse_field_width(str)?;250	let (precision, str) = try_parse_precision(str)?;251	let ((), str) = try_parse_length_modifier(str)?;252	let (convtype, str) = parse_conversion_type(str)?;253254	Ok((255		Code {256			mkey,257			cflags,258			width,259			precision,260			convtype: convtype.v,261			caps: convtype.caps,262		},263		str,264	))265}266267#[derive(Debug)]268pub enum Element<'s> {269	String(&'s str),270	Code(Code<'s>),271}272pub fn parse_codes(mut str: &str) -> Result<Vec<Element<'_>>> {273	let mut bytes = str.as_bytes();274	let mut out = vec![];275	let mut offset = 0;276277	loop {278		while offset != bytes.len() && bytes[offset] != b'%' {279			offset += 1;280		}281		if offset != 0 {282			out.push(Element::String(&str[0..offset]));283		}284		if offset == bytes.len() {285			return Ok(out);286		}287		str = &str[offset + 1..];288		let code;289		(code, str) = parse_code(str)?;290		bytes = str.as_bytes();291		offset = 0;292293		out.push(Element::Code(code));294	}295}296297const NUMBERS: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyz";298299#[inline]300#[allow(clippy::fn_params_excessive_bools)]301pub fn render_integer(302	out: &mut String,303	neg: bool,304	iv: f64,305	padding: u16,306	precision: u16,307	blank: bool,308	sign: bool,309	radix: i64,310	zero_prefix: &str,311	prefix_in_padding: bool,312	caps: bool,313) {314	debug_assert!(iv >= 0.0, "render_integer receives sign using arg");315	let iv = iv.floor() as i64;316	// Digit char indexes in reverse order, i.e317	// for radix = 16 and n = 12f: [15, 2, 1]318	let digits = if iv == 0 {319		vec![0u8]320	} else {321		let mut v = iv.abs();322		let mut nums = Vec::with_capacity(1);323		while v != 0 {324			nums.push((v % radix) as u8);325			v /= radix;326		}327		nums328	};329	#[allow(clippy::bool_to_int_with_if)]330	let zp = padding.saturating_sub(if neg || blank || sign { 1 } else { 0 });331332	let pref_len = zero_prefix.len() as u16;333	let zp2 = zp334		.saturating_sub(if prefix_in_padding { 0 } else { pref_len })335		.max(precision)336		.saturating_sub(if prefix_in_padding { pref_len } else { 0 } + digits.len() as u16);337338	if neg {339		out.push('-');340	} else if sign {341		out.push('+');342	} else if blank {343		out.push(' ');344	}345346	out.reserve(zp2 as usize);347	if iv != 0 {348		out.push_str(zero_prefix);349	}350	for _ in 0..zp2 {351		out.push('0');352	}353354	for digit in digits.into_iter().rev() {355		let ch = NUMBERS[digit as usize] as char;356		out.push(if caps { ch.to_ascii_uppercase() } else { ch });357	}358}359360pub fn render_decimal(361	out: &mut String,362	neg: bool,363	iv: f64,364	padding: u16,365	precision: u16,366	blank: bool,367	sign: bool,368) {369	render_integer(370		out, neg, iv, padding, precision, blank, sign, 10, "", false, false,371	);372}373#[allow(clippy::fn_params_excessive_bools)]374pub fn render_octal(375	out: &mut String,376	neg: bool,377	iv: f64,378	padding: u16,379	precision: u16,380	alt: bool,381	blank: bool,382	sign: bool,383) {384	render_integer(385		out,386		neg,387		iv,388		padding,389		precision,390		blank,391		sign,392		8,393		if alt && iv != 0.0 { "0" } else { "" },394		true,395		false,396	);397}398399#[allow(clippy::fn_params_excessive_bools)]400pub fn render_hexadecimal(401	out: &mut String,402	iv: f64,403	padding: u16,404	precision: u16,405	alt: bool,406	blank: bool,407	sign: bool,408	caps: bool,409) {410	render_integer(411		out,412		iv < 0.0,413		iv.abs(),414		padding,415		precision,416		blank,417		sign,418		16,419		match (alt, caps) {420			(true, true) => "0X",421			(true, false) => "0x",422			(false, _) => "",423		},424		false,425		caps,426	);427}428429#[allow(clippy::fn_params_excessive_bools)]430pub fn render_float(431	out: &mut String,432	n: f64,433	mut padding: u16,434	precision: u16,435	blank: bool,436	sign: bool,437	ensure_pt: bool,438	trailing: bool,439) {440	// Represent the rounded number as an integer * 1/10**prec.441	// Note that it can also be equal to 10**prec and we'll need to carry442	// over to the wholes.  We operate on the absolute numbers, so that we443	// don't have trouble with the rounding direction.444	let denominator = 10.0f64.powi(i32::from(precision));445	let numerator = n.abs().mul_add(denominator, 0.5);446	let whole = (numerator / denominator).floor();447	let frac = numerator.floor() % denominator;448449	#[allow(clippy::bool_to_int_with_if)]450	let dot_size = if precision == 0 && !ensure_pt { 0 } else { 1 };451	padding = padding.saturating_sub(dot_size + precision);452	render_decimal(out, n < 0.0, whole, padding, 0, blank, sign);453	if precision == 0 {454		if ensure_pt {455			out.push('.');456		}457		return;458	}459	if trailing || frac > 0.0 {460		out.push('.');461		let mut frac_str = String::new();462		render_decimal(&mut frac_str, false, frac, precision, 0, false, false);463		let mut trim = frac_str.len();464		if !trailing {465			for b in frac_str.as_bytes().iter().rev() {466				if *b == b'0' {467					trim -= 1;468				} else {469					break;470				}471			}472		}473		out.push_str(&frac_str[..trim]);474	} else if ensure_pt {475		out.push('.');476	}477}478479#[allow(clippy::fn_params_excessive_bools)]480pub fn render_float_sci(481	out: &mut String,482	n: f64,483	mut padding: u16,484	precision: u16,485	blank: bool,486	sign: bool,487	ensure_pt: bool,488	trailing: bool,489	caps: bool,490) {491	let exponent = if n == 0.0 {492		0.0493	} else {494		n.abs().log10().floor()495	};496497	let mantissa = if exponent as i16 == -324 {498		n * 10.0 / 10.0_f64.powf(exponent + 1.0)499	} else {500		n / 10.0_f64.powf(exponent)501	};502	let mut exponent_str = String::new();503	render_decimal(504		&mut exponent_str,505		exponent < 0.0,506		exponent.abs(),507		3,508		0,509		false,510		true,511	);512513	// +1 for e514	padding = padding.saturating_sub(exponent_str.len() as u16 + 1);515516	render_float(517		out, mantissa, padding, precision, blank, sign, ensure_pt, trailing,518	);519	out.push(if caps { 'E' } else { 'e' });520	out.push_str(&exponent_str);521}522523#[allow(clippy::too_many_lines)]524pub fn format_code(525	out: &mut String,526	value: &Val,527	code: &Code<'_>,528	width: u16,529	precision: Option<u16>,530) -> Result<()> {531	let clfags = &code.cflags;532	let (fpprec, iprec) = precision.map_or((6, 0), |v| (v, v));533	let padding = if clfags.zero && !clfags.left {534		width535	} else {536		0537	};538539	// TODO: If left padded, can optimize by writing directly to out540	let mut tmp_out = String::new();541542	match code.convtype {543		ConvTypeV::String => tmp_out.push_str(&value.clone().to_string()?),544		ConvTypeV::Decimal => {545			let value = f64::from_untyped(value.clone())?;546			render_decimal(547				&mut tmp_out,548				value <= -1.0,549				value.abs(),550				padding,551				iprec,552				clfags.blank,553				clfags.sign,554			);555		}556		ConvTypeV::Octal => {557			let value = f64::from_untyped(value.clone())?;558			render_octal(559				&mut tmp_out,560				value <= -1.0,561				value.abs(),562				padding,563				iprec,564				clfags.alt,565				clfags.blank,566				clfags.sign,567			);568		}569		ConvTypeV::Hexadecimal => {570			let value = f64::from_untyped(value.clone())?;571			render_hexadecimal(572				&mut tmp_out,573				value,574				padding,575				iprec,576				clfags.alt,577				clfags.blank,578				clfags.sign,579				code.caps,580			);581		}582		ConvTypeV::Scientific => {583			let value = f64::from_untyped(value.clone())?;584			render_float_sci(585				&mut tmp_out,586				value,587				padding,588				fpprec,589				clfags.blank,590				clfags.sign,591				clfags.alt,592				true,593				code.caps,594			);595		}596		ConvTypeV::Float => {597			let value = f64::from_untyped(value.clone())?;598			render_float(599				&mut tmp_out,600				value,601				padding,602				fpprec,603				clfags.blank,604				clfags.sign,605				clfags.alt,606				true,607			);608		}609		ConvTypeV::Shorter => {610			let value = f64::from_untyped(value.clone())?;611			let exponent = if value == 0.0 {612				0.0613			} else {614				value.abs().log10().floor()615			};616			if exponent < -4.0 || exponent >= f64::from(fpprec) {617				render_float_sci(618					&mut tmp_out,619					value,620					padding,621					fpprec - 1,622					clfags.blank,623					clfags.sign,624					clfags.alt,625					clfags.alt,626					code.caps,627				);628			} else {629				let digits_before_pt = 1.max(exponent as u16 + 1);630				render_float(631					&mut tmp_out,632					value,633					padding,634					fpprec - digits_before_pt,635					clfags.blank,636					clfags.sign,637					clfags.alt,638					clfags.alt,639				);640			}641		}642		ConvTypeV::Char => match value.clone() {643			Val::Num(n) => {644				let n = n.get();645				tmp_out.push(646					std::char::from_u32(n as u32)647						.ok_or_else(|| InvalidUnicodeCodepointGot(n as u32))?,648				);649			}650			Val::Str(s) => {651				let s = s.into_flat();652				if s.chars().count() != 1 {653					bail!("%c expected 1 char string, got {}", s.chars().count());654				}655				tmp_out.push_str(&s);656			}657			_ => {658				bail!(TypeMismatch(659					"%c requires number/string",660					vec![ValType::Num, ValType::Str],661					value.value_type(),662				));663			}664		},665		ConvTypeV::Percent => tmp_out.push('%'),666	}667668	let padding = width.saturating_sub(tmp_out.len() as u16);669670	if !clfags.left {671		for _ in 0..padding {672			out.push(' ');673		}674	}675	out.push_str(&tmp_out);676	if clfags.left {677		for _ in 0..padding {678			out.push(' ');679		}680	}681682	Ok(())683}684685pub fn format_arr(str: &str, mut values: &[Val]) -> Result<String> {686	let codes = parse_codes(str)?;687	let mut out = String::new();688	let value_count = values.len();689690	for code in codes {691		match code {692			Element::String(s) => {693				out.push_str(s);694			}695			Element::Code(c) => {696				let width = match c.width {697					Width::Star => {698						if values.is_empty() {699							bail!(NotEnoughValues);700						}701						let value = &values[0];702						values = &values[1..];703						u16::from_untyped(value.clone())?704					}705					Width::Fixed(n) => n,706				};707				let precision = match c.precision {708					Some(Width::Star) => {709						if values.is_empty() {710							bail!(NotEnoughValues);711						}712						let value = &values[0];713						values = &values[1..];714						Some(u16::from_untyped(value.clone())?)715					}716					Some(Width::Fixed(n)) => Some(n),717					None => None,718				};719720				// %% should not consume a value721				let value = if c.convtype == ConvTypeV::Percent {722					&Val::Null723				} else {724					if values.is_empty() {725						bail!(NotEnoughValues);726					}727					let value = &values[0];728					values = &values[1..];729					value730				};731732				format_code(&mut out, value, &c, width, precision)?;733			}734		}735	}736737	if !values.is_empty() {738		bail!(739			"too many values to format, expected {value_count}, got {}",740			value_count + values.len()741		)742	}743744	Ok(out)745}746747fn get_dotted_field(obj: ObjValue, field: &str) -> Result<Val> {748	let mut current = Val::Obj(obj);749	let mut name_offset = 0;750	for component in field.split('.') {751		let end_offset = name_offset + component.len();752		current = if let Val::Obj(obj) = current {753			if let Some(value) = obj.get(component.into())? {754				value755			} else {756				let current = &field[name_offset..end_offset];757				let full = &field[..name_offset];758				let found = Box::new(suggest_object_fields(&obj, current.into()));759				bail!(SubfieldNotFound {760					current: current.into(),761					full: full.into(),762					found,763				})764			}765		} else {766			// No underflow may happen, initially we always start with an object767			let subfield = &field[..name_offset - 1];768			bail!(SubfieldDidntYieldAnObject(769				subfield.into(),770				current.value_type()771			));772		};773		name_offset = end_offset + 1;774	}775	Ok(current)776}777778pub fn format_obj(str: &str, values: &ObjValue) -> Result<String> {779	let codes = parse_codes(str)?;780	let mut out = String::new();781782	for code in codes {783		match code {784			Element::String(s) => {785				out.push_str(s);786			}787			Element::Code(c) => {788				// TODO: Operate on ref789				let f: IStr = c.mkey.into();790				let width = match c.width {791					Width::Star => {792						bail!(CannotUseStarWidthWithObject);793					}794					Width::Fixed(n) => n,795				};796				let precision = match c.precision {797					Some(Width::Star) => {798						bail!(CannotUseStarWidthWithObject);799					}800					Some(Width::Fixed(n)) => Some(n),801					None => None,802				};803804				let value = if c.convtype == ConvTypeV::Percent {805					Val::Null806				} else {807					if f.is_empty() {808						bail!(MappingKeysRequired);809					}810					if let Some(v) = values.get(f.clone())? {811						v812					} else {813						get_dotted_field(values.clone(), &f)?814					}815				};816817				format_code(&mut out, &value, &c, width, precision)?;818			}819		}820	}821822	Ok(out)823}824825#[cfg(test)]826pub mod test_format {827	use super::*;828	use crate::val::NumValue;829830	#[test]831	fn parse() {832		assert_eq!(833			parse_codes(834				"How much error budget is left looking at our %.3f%% availability gurantees?"835			)836			.unwrap()837			.len(),838			4839		);840	}841842	fn num(v: f64) -> Val {843		Val::Num(NumValue::new(v).expect("finite"))844	}845846	#[test]847	fn octals() {848		assert_eq!(format_arr("%#o", &[num(8.0)]).unwrap(), "010");849		assert_eq!(format_arr("%#4o", &[num(8.0)]).unwrap(), " 010");850		assert_eq!(format_arr("%4o", &[num(8.0)]).unwrap(), "  10");851		assert_eq!(format_arr("%04o", &[num(8.0)]).unwrap(), "0010");852		assert_eq!(format_arr("%+4o", &[num(8.0)]).unwrap(), " +10");853		assert_eq!(format_arr("%+04o", &[num(8.0)]).unwrap(), "+010");854		assert_eq!(format_arr("%-4o", &[num(8.0)]).unwrap(), "10  ");855		assert_eq!(format_arr("%+-4o", &[num(8.0)]).unwrap(), "+10 ");856		assert_eq!(format_arr("%+-04o", &[num(8.0)]).unwrap(), "+10 ");857	}858859	#[test]860	fn percent_doesnt_consumes_values() {861		assert_eq!(862			format_arr(863				"How much error budget is left looking at our %.3f%% availability gurantees?",864				&[num(4.0)]865			)866			.unwrap(),867			"How much error budget is left looking at our 4.000% availability gurantees?"868		);869	}870}
after · crates/jrsonnet-evaluator/src/stdlib/format.rs
1//! faster std.format impl2#![allow(clippy::too_many_arguments)]34use jrsonnet_gcmodule::Trace;5use jrsonnet_interner::IStr;6use jrsonnet_types::ValType;7use thiserror::Error;89use crate::{10	Error, ObjValue, Result, Val, bail,11	error::{ErrorKind::*, format_found, suggest_object_fields},12	typed::FromUntyped,13};1415#[derive(Debug, Clone, Error, Trace)]16pub enum FormatError {17	#[error("truncated format code")]18	TruncatedFormatCode,19	#[error("unrecognized conversion type: {0}")]20	UnrecognizedConversionType(char),2122	#[error("not enough values")]23	NotEnoughValues,2425	#[error("cannot use * width with object")]26	CannotUseStarWidthWithObject,27	#[error("mapping keys required")]28	MappingKeysRequired,29	#[error("no such format field: {0}")]30	NoSuchFormatField(IStr),3132	#[error("expected subfield <{0}> to be an object, got {1} instead")]33	SubfieldDidntYieldAnObject(IStr, ValType),34	#[error("subfield not found: <[{full}]{current}>{}", format_found(.found, "subfield"))]35	SubfieldNotFound {36		current: IStr,37		full: IStr,38		found: Box<Vec<IStr>>,39	},40}4142impl From<FormatError> for Error {43	fn from(e: FormatError) -> Self {44		Self::new(Format(e))45	}46}4748use FormatError::*;4950type ParseResult<'t, T> = std::result::Result<(T, &'t str), FormatError>;5152pub fn try_parse_mapping_key(str: &str) -> ParseResult<'_, &str> {53	if str.is_empty() {54		return Err(TruncatedFormatCode);55	}56	let bytes = str.as_bytes();57	if bytes[0] == b'(' {58		let mut i = 1;59		while i < bytes.len() {60			if bytes[i] == b')' {61				return Ok((&str[1..i], &str[i + 1..]));62			}63			i += 1;64		}65		Err(TruncatedFormatCode)66	} else {67		Ok(("", str))68	}69}7071#[cfg(test)]72pub mod tests_key {73	use super::*;7475	#[test]76	fn parse_key() {77		assert_eq!(78			try_parse_mapping_key("(hello ) world").unwrap(),79			("hello ", " world")80		);81		assert_eq!(try_parse_mapping_key("() world").unwrap(), ("", " world"));82		assert_eq!(try_parse_mapping_key(" world").unwrap(), ("", " world"));83		assert_eq!(84			try_parse_mapping_key(" () world").unwrap(),85			("", " () world")86		);87	}8889	#[test]90	#[should_panic = "TruncatedFormatCode"]91	fn parse_key_missing_start() {92		try_parse_mapping_key("").unwrap();93	}9495	#[test]96	#[should_panic = "TruncatedFormatCode"]97	fn parse_key_missing_end() {98		try_parse_mapping_key("(   ").unwrap();99	}100}101102#[allow(clippy::struct_excessive_bools)]103#[derive(Default, Debug)]104pub struct CFlags {105	pub alt: bool,106	pub zero: bool,107	pub left: bool,108	pub blank: bool,109	pub sign: bool,110}111112pub fn try_parse_cflags(str: &str) -> ParseResult<'_, CFlags> {113	if str.is_empty() {114		return Err(TruncatedFormatCode);115	}116	let bytes = str.as_bytes();117	let mut i = 0;118	let mut out = CFlags::default();119	loop {120		if bytes.len() == i {121			return Err(TruncatedFormatCode);122		}123		match bytes[i] {124			b'#' => out.alt = true,125			b'0' => out.zero = true,126			b'-' => out.left = true,127			b' ' => out.blank = true,128			b'+' => out.sign = true,129			_ => break,130		}131		i += 1;132	}133	Ok((out, &str[i..]))134}135136#[derive(Debug, PartialEq, Eq)]137pub enum Width {138	Star,139	Fixed(u16),140}141pub fn try_parse_field_width(str: &str) -> ParseResult<'_, Width> {142	if str.is_empty() {143		return Err(TruncatedFormatCode);144	}145	let bytes = str.as_bytes();146	if bytes[0] == b'*' {147		return Ok((Width::Star, &str[1..]));148	}149	let mut out: u16 = 0;150	let mut digits = 0;151	while let Some(digit) = (bytes[digits] as char).to_digit(10) {152		out *= 10;153		out += digit as u16;154		digits += 1;155		if digits == bytes.len() {156			return Err(TruncatedFormatCode);157		}158	}159	Ok((Width::Fixed(out), &str[digits..]))160}161162pub fn try_parse_precision(str: &str) -> ParseResult<'_, Option<Width>> {163	if str.is_empty() {164		return Err(TruncatedFormatCode);165	}166	let bytes = str.as_bytes();167	if bytes[0] == b'.' {168		try_parse_field_width(&str[1..]).map(|(r, s)| (Some(r), s))169	} else {170		Ok((None, str))171	}172}173174// Only skips175pub fn try_parse_length_modifier(str: &str) -> ParseResult<'_, ()> {176	if str.is_empty() {177		return Err(TruncatedFormatCode);178	}179	let bytes = str.as_bytes();180	let mut idx = 0;181	while bytes[idx] == b'h' || bytes[idx] == b'l' || bytes[idx] == b'L' {182		idx += 1;183		if bytes.len() == idx {184			return Err(TruncatedFormatCode);185		}186	}187	Ok(((), &str[idx..]))188}189190#[derive(Debug, PartialEq, Eq)]191pub enum ConvTypeV {192	Decimal,193	Octal,194	Hexadecimal,195	Scientific,196	Float,197	Shorter,198	Char,199	String,200	Percent,201}202pub struct ConvType {203	v: ConvTypeV,204	caps: bool,205}206207pub fn parse_conversion_type(str: &str) -> ParseResult<'_, ConvType> {208	if str.is_empty() {209		return Err(TruncatedFormatCode);210	}211212	let code = str.as_bytes()[0];213	let v: (ConvTypeV, bool) = match code {214		b'd' | b'i' | b'u' => (ConvTypeV::Decimal, false),215		b'o' => (ConvTypeV::Octal, false),216		b'x' => (ConvTypeV::Hexadecimal, false),217		b'X' => (ConvTypeV::Hexadecimal, true),218		b'e' => (ConvTypeV::Scientific, false),219		b'E' => (ConvTypeV::Scientific, true),220		b'f' => (ConvTypeV::Float, false),221		b'F' => (ConvTypeV::Float, true),222		b'g' => (ConvTypeV::Shorter, false),223		b'G' => (ConvTypeV::Shorter, true),224		b'c' => (ConvTypeV::Char, false),225		b's' => (ConvTypeV::String, false),226		b'%' => (ConvTypeV::Percent, false),227		c => return Err(UnrecognizedConversionType(c as char)),228	};229230	Ok((ConvType { v: v.0, caps: v.1 }, &str[1..]))231}232233#[derive(Debug)]234pub struct Code<'s> {235	mkey: &'s str,236	cflags: CFlags,237	width: Width,238	precision: Option<Width>,239	convtype: ConvTypeV,240	caps: bool,241}242pub fn parse_code(str: &str) -> ParseResult<'_, Code<'_>> {243	if str.is_empty() {244		return Err(TruncatedFormatCode);245	}246	let (mkey, str) = try_parse_mapping_key(str)?;247	let (cflags, str) = try_parse_cflags(str)?;248	let (width, str) = try_parse_field_width(str)?;249	let (precision, str) = try_parse_precision(str)?;250	let ((), str) = try_parse_length_modifier(str)?;251	let (convtype, str) = parse_conversion_type(str)?;252253	Ok((254		Code {255			mkey,256			cflags,257			width,258			precision,259			convtype: convtype.v,260			caps: convtype.caps,261		},262		str,263	))264}265266#[derive(Debug)]267pub enum Element<'s> {268	String(&'s str),269	Code(Code<'s>),270}271pub fn parse_codes(mut str: &str) -> Result<Vec<Element<'_>>> {272	let mut bytes = str.as_bytes();273	let mut out = vec![];274	let mut offset = 0;275276	loop {277		while offset != bytes.len() && bytes[offset] != b'%' {278			offset += 1;279		}280		if offset != 0 {281			out.push(Element::String(&str[0..offset]));282		}283		if offset == bytes.len() {284			return Ok(out);285		}286		str = &str[offset + 1..];287		let code;288		(code, str) = parse_code(str)?;289		bytes = str.as_bytes();290		offset = 0;291292		out.push(Element::Code(code));293	}294}295296const NUMBERS: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyz";297298#[inline]299#[allow(clippy::fn_params_excessive_bools)]300pub fn render_integer(301	out: &mut String,302	neg: bool,303	iv: f64,304	padding: u16,305	precision: u16,306	blank: bool,307	sign: bool,308	radix: i64,309	zero_prefix: &str,310	prefix_in_padding: bool,311	caps: bool,312) {313	debug_assert!(iv >= 0.0, "render_integer receives sign using arg");314	let iv = iv.floor() as i64;315	// Digit char indexes in reverse order, i.e316	// for radix = 16 and n = 12f: [15, 2, 1]317	let digits = if iv == 0 {318		vec![0u8]319	} else {320		let mut v = iv.abs();321		let mut nums = Vec::with_capacity(1);322		while v != 0 {323			nums.push((v % radix) as u8);324			v /= radix;325		}326		nums327	};328	#[allow(clippy::bool_to_int_with_if)]329	let zp = padding.saturating_sub(if neg || blank || sign { 1 } else { 0 });330331	let pref_len = zero_prefix.len() as u16;332	let zp2 = zp333		.saturating_sub(if prefix_in_padding { 0 } else { pref_len })334		.max(precision)335		.saturating_sub(if prefix_in_padding { pref_len } else { 0 } + digits.len() as u16);336337	if neg {338		out.push('-');339	} else if sign {340		out.push('+');341	} else if blank {342		out.push(' ');343	}344345	out.reserve(zp2 as usize);346	if iv != 0 {347		out.push_str(zero_prefix);348	}349	for _ in 0..zp2 {350		out.push('0');351	}352353	for digit in digits.into_iter().rev() {354		let ch = NUMBERS[digit as usize] as char;355		out.push(if caps { ch.to_ascii_uppercase() } else { ch });356	}357}358359pub fn render_decimal(360	out: &mut String,361	neg: bool,362	iv: f64,363	padding: u16,364	precision: u16,365	blank: bool,366	sign: bool,367) {368	render_integer(369		out, neg, iv, padding, precision, blank, sign, 10, "", false, false,370	);371}372#[allow(clippy::fn_params_excessive_bools)]373pub fn render_octal(374	out: &mut String,375	neg: bool,376	iv: f64,377	padding: u16,378	precision: u16,379	alt: bool,380	blank: bool,381	sign: bool,382) {383	render_integer(384		out,385		neg,386		iv,387		padding,388		precision,389		blank,390		sign,391		8,392		if alt && iv != 0.0 { "0" } else { "" },393		true,394		false,395	);396}397398#[allow(clippy::fn_params_excessive_bools)]399pub fn render_hexadecimal(400	out: &mut String,401	iv: f64,402	padding: u16,403	precision: u16,404	alt: bool,405	blank: bool,406	sign: bool,407	caps: bool,408) {409	render_integer(410		out,411		iv < 0.0,412		iv.abs(),413		padding,414		precision,415		blank,416		sign,417		16,418		match (alt, caps) {419			(true, true) => "0X",420			(true, false) => "0x",421			(false, _) => "",422		},423		false,424		caps,425	);426}427428#[allow(clippy::fn_params_excessive_bools)]429pub fn render_float(430	out: &mut String,431	n: f64,432	mut padding: u16,433	precision: u16,434	blank: bool,435	sign: bool,436	ensure_pt: bool,437	trailing: bool,438) {439	// Represent the rounded number as an integer * 1/10**prec.440	// Note that it can also be equal to 10**prec and we'll need to carry441	// over to the wholes.  We operate on the absolute numbers, so that we442	// don't have trouble with the rounding direction.443	let denominator = 10.0f64.powi(i32::from(precision));444	let numerator = n.abs().mul_add(denominator, 0.5);445	let whole = (numerator / denominator).floor();446	let frac = numerator.floor() % denominator;447448	#[allow(clippy::bool_to_int_with_if)]449	let dot_size = if precision == 0 && !ensure_pt { 0 } else { 1 };450	padding = padding.saturating_sub(dot_size + precision);451	render_decimal(out, n < 0.0, whole, padding, 0, blank, sign);452	if precision == 0 {453		if ensure_pt {454			out.push('.');455		}456		return;457	}458	if trailing || frac > 0.0 {459		out.push('.');460		let mut frac_str = String::new();461		render_decimal(&mut frac_str, false, frac, precision, 0, false, false);462		let mut trim = frac_str.len();463		if !trailing {464			for b in frac_str.as_bytes().iter().rev() {465				if *b == b'0' {466					trim -= 1;467				} else {468					break;469				}470			}471		}472		out.push_str(&frac_str[..trim]);473	} else if ensure_pt {474		out.push('.');475	}476}477478#[allow(clippy::fn_params_excessive_bools)]479pub fn render_float_sci(480	out: &mut String,481	n: f64,482	mut padding: u16,483	precision: u16,484	blank: bool,485	sign: bool,486	ensure_pt: bool,487	trailing: bool,488	caps: bool,489) {490	let exponent = if n == 0.0 {491		0.0492	} else {493		n.abs().log10().floor()494	};495496	let mantissa = if exponent as i16 == -324 {497		n * 10.0 / 10.0_f64.powf(exponent + 1.0)498	} else {499		n / 10.0_f64.powf(exponent)500	};501	let mut exponent_str = String::new();502	render_decimal(503		&mut exponent_str,504		exponent < 0.0,505		exponent.abs(),506		3,507		0,508		false,509		true,510	);511512	// +1 for e513	padding = padding.saturating_sub(exponent_str.len() as u16 + 1);514515	render_float(516		out, mantissa, padding, precision, blank, sign, ensure_pt, trailing,517	);518	out.push(if caps { 'E' } else { 'e' });519	out.push_str(&exponent_str);520}521522#[allow(clippy::too_many_lines)]523pub fn format_code(524	out: &mut String,525	value: &Val,526	code: &Code<'_>,527	width: u16,528	precision: Option<u16>,529) -> Result<()> {530	let clfags = &code.cflags;531	let (fpprec, iprec) = precision.map_or((6, 0), |v| (v, v));532	let padding = if clfags.zero && !clfags.left {533		width534	} else {535		0536	};537538	// TODO: If left padded, can optimize by writing directly to out539	let mut tmp_out = String::new();540541	match code.convtype {542		ConvTypeV::String => tmp_out.push_str(&value.clone().to_string()?),543		ConvTypeV::Decimal => {544			let value = f64::from_untyped(value.clone())?;545			render_decimal(546				&mut tmp_out,547				value <= -1.0,548				value.abs(),549				padding,550				iprec,551				clfags.blank,552				clfags.sign,553			);554		}555		ConvTypeV::Octal => {556			let value = f64::from_untyped(value.clone())?;557			render_octal(558				&mut tmp_out,559				value <= -1.0,560				value.abs(),561				padding,562				iprec,563				clfags.alt,564				clfags.blank,565				clfags.sign,566			);567		}568		ConvTypeV::Hexadecimal => {569			let value = f64::from_untyped(value.clone())?;570			render_hexadecimal(571				&mut tmp_out,572				value,573				padding,574				iprec,575				clfags.alt,576				clfags.blank,577				clfags.sign,578				code.caps,579			);580		}581		ConvTypeV::Scientific => {582			let value = f64::from_untyped(value.clone())?;583			render_float_sci(584				&mut tmp_out,585				value,586				padding,587				fpprec,588				clfags.blank,589				clfags.sign,590				clfags.alt,591				true,592				code.caps,593			);594		}595		ConvTypeV::Float => {596			let value = f64::from_untyped(value.clone())?;597			render_float(598				&mut tmp_out,599				value,600				padding,601				fpprec,602				clfags.blank,603				clfags.sign,604				clfags.alt,605				true,606			);607		}608		ConvTypeV::Shorter => {609			let value = f64::from_untyped(value.clone())?;610			let exponent = if value == 0.0 {611				0.0612			} else {613				value.abs().log10().floor()614			};615			if exponent < -4.0 || exponent >= f64::from(fpprec) {616				render_float_sci(617					&mut tmp_out,618					value,619					padding,620					fpprec - 1,621					clfags.blank,622					clfags.sign,623					clfags.alt,624					clfags.alt,625					code.caps,626				);627			} else {628				let digits_before_pt = 1.max(exponent as u16 + 1);629				render_float(630					&mut tmp_out,631					value,632					padding,633					fpprec - digits_before_pt,634					clfags.blank,635					clfags.sign,636					clfags.alt,637					clfags.alt,638				);639			}640		}641		ConvTypeV::Char => match value.clone() {642			Val::Num(n) => {643				let n = n.get();644				tmp_out.push(645					std::char::from_u32(n as u32)646						.ok_or_else(|| InvalidUnicodeCodepointGot(n as u32))?,647				);648			}649			Val::Str(s) => {650				let s = s.into_flat();651				if s.chars().count() != 1 {652					bail!("%c expected 1 char string, got {}", s.chars().count());653				}654				tmp_out.push_str(&s);655			}656			_ => {657				bail!(TypeMismatch(658					"%c requires number/string",659					vec![ValType::Num, ValType::Str],660					value.value_type(),661				));662			}663		},664		ConvTypeV::Percent => tmp_out.push('%'),665	}666667	let padding = width.saturating_sub(tmp_out.len() as u16);668669	if !clfags.left {670		for _ in 0..padding {671			out.push(' ');672		}673	}674	out.push_str(&tmp_out);675	if clfags.left {676		for _ in 0..padding {677			out.push(' ');678		}679	}680681	Ok(())682}683684pub fn format_arr(str: &str, mut values: &[Val]) -> Result<String> {685	let codes = parse_codes(str)?;686	let mut out = String::new();687	let value_count = values.len();688689	for code in codes {690		match code {691			Element::String(s) => {692				out.push_str(s);693			}694			Element::Code(c) => {695				let width = match c.width {696					Width::Star => {697						if values.is_empty() {698							bail!(NotEnoughValues);699						}700						let value = &values[0];701						values = &values[1..];702						u16::from_untyped(value.clone())?703					}704					Width::Fixed(n) => n,705				};706				let precision = match c.precision {707					Some(Width::Star) => {708						if values.is_empty() {709							bail!(NotEnoughValues);710						}711						let value = &values[0];712						values = &values[1..];713						Some(u16::from_untyped(value.clone())?)714					}715					Some(Width::Fixed(n)) => Some(n),716					None => None,717				};718719				// %% should not consume a value720				let value = if c.convtype == ConvTypeV::Percent {721					&Val::Null722				} else {723					if values.is_empty() {724						bail!(NotEnoughValues);725					}726					let value = &values[0];727					values = &values[1..];728					value729				};730731				format_code(&mut out, value, &c, width, precision)?;732			}733		}734	}735736	if !values.is_empty() {737		bail!(738			"too many values to format, expected {value_count}, got {}",739			value_count + values.len()740		)741	}742743	Ok(out)744}745746fn get_dotted_field(obj: ObjValue, field: &str) -> Result<Val> {747	let mut current = Val::Obj(obj);748	let mut name_offset = 0;749	for component in field.split('.') {750		let end_offset = name_offset + component.len();751		current = if let Val::Obj(obj) = current {752			if let Some(value) = obj.get(component.into())? {753				value754			} else {755				let current = &field[name_offset..end_offset];756				let full = &field[..name_offset];757				let found = Box::new(suggest_object_fields(&obj, current.into()));758				bail!(SubfieldNotFound {759					current: current.into(),760					full: full.into(),761					found,762				})763			}764		} else {765			// No underflow may happen, initially we always start with an object766			let subfield = &field[..name_offset - 1];767			bail!(SubfieldDidntYieldAnObject(768				subfield.into(),769				current.value_type()770			));771		};772		name_offset = end_offset + 1;773	}774	Ok(current)775}776777pub fn format_obj(str: &str, values: &ObjValue) -> Result<String> {778	let codes = parse_codes(str)?;779	let mut out = String::new();780781	for code in codes {782		match code {783			Element::String(s) => {784				out.push_str(s);785			}786			Element::Code(c) => {787				// TODO: Operate on ref788				let f: IStr = c.mkey.into();789				let width = match c.width {790					Width::Star => {791						bail!(CannotUseStarWidthWithObject);792					}793					Width::Fixed(n) => n,794				};795				let precision = match c.precision {796					Some(Width::Star) => {797						bail!(CannotUseStarWidthWithObject);798					}799					Some(Width::Fixed(n)) => Some(n),800					None => None,801				};802803				let value = if c.convtype == ConvTypeV::Percent {804					Val::Null805				} else {806					if f.is_empty() {807						bail!(MappingKeysRequired);808					}809					if let Some(v) = values.get(f.clone())? {810						v811					} else {812						get_dotted_field(values.clone(), &f)?813					}814				};815816				format_code(&mut out, &value, &c, width, precision)?;817			}818		}819	}820821	Ok(out)822}823824#[cfg(test)]825pub mod test_format {826	use super::*;827	use crate::val::NumValue;828829	#[test]830	fn parse() {831		assert_eq!(832			parse_codes(833				"How much error budget is left looking at our %.3f%% availability gurantees?"834			)835			.unwrap()836			.len(),837			4838		);839	}840841	fn num(v: f64) -> Val {842		Val::Num(NumValue::new(v).expect("finite"))843	}844845	#[test]846	fn octals() {847		assert_eq!(format_arr("%#o", &[num(8.0)]).unwrap(), "010");848		assert_eq!(format_arr("%#4o", &[num(8.0)]).unwrap(), " 010");849		assert_eq!(format_arr("%4o", &[num(8.0)]).unwrap(), "  10");850		assert_eq!(format_arr("%04o", &[num(8.0)]).unwrap(), "0010");851		assert_eq!(format_arr("%+4o", &[num(8.0)]).unwrap(), " +10");852		assert_eq!(format_arr("%+04o", &[num(8.0)]).unwrap(), "+010");853		assert_eq!(format_arr("%-4o", &[num(8.0)]).unwrap(), "10  ");854		assert_eq!(format_arr("%+-4o", &[num(8.0)]).unwrap(), "+10 ");855		assert_eq!(format_arr("%+-04o", &[num(8.0)]).unwrap(), "+10 ");856	}857858	#[test]859	fn percent_doesnt_consumes_values() {860		assert_eq!(861			format_arr(862				"How much error budget is left looking at our %.3f%% availability gurantees?",863				&[num(4.0)]864			)865			.unwrap(),866			"How much error budget is left looking at our 4.000% availability gurantees?"867		);868	}869}
modifiedcrates/jrsonnet-evaluator/src/stdlib/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stdlib/mod.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/mod.rs
@@ -3,7 +3,7 @@
 
 use format::{format_arr, format_obj};
 
-use crate::{function::CallLocation, in_frame, Result, Val};
+use crate::{Result, Val, function::CallLocation, in_frame};
 
 pub mod format;
 
modifiedcrates/jrsonnet-evaluator/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/tla.rs
+++ b/crates/jrsonnet-evaluator/src/tla.rs
@@ -5,8 +5,9 @@
 use jrsonnet_ir::{SourceFifo, SourcePath};
 
 use crate::{
+	Result, Thunk, Val,
 	function::{CallLocation, PreparedFuncVal},
-	in_description_frame, with_state, Result, Thunk, Val,
+	in_description_frame, with_state,
 };
 
 #[derive(Clone, Trace)]
modifiedcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/trace/mod.rs
+++ b/crates/jrsonnet-evaluator/src/trace/mod.rs
@@ -10,7 +10,7 @@
 #[cfg(feature = "explaining-traces")]
 use jrsonnet_ir::Span;
 
-use crate::{error::ErrorKind, Error};
+use crate::{Error, error::ErrorKind};
 
 /// The way paths should be displayed
 #[derive(Clone, Trace)]
@@ -258,7 +258,7 @@
 		struct ResetData {
 			loc: Span,
 		}
-		use hi_doc::{source_to_ansi, Formatting, SnippetBuilder, Text};
+		use hi_doc::{Formatting, SnippetBuilder, Text, source_to_ansi};
 
 		write!(out, "{}", error.error())?;
 		if let ErrorKind::ImportSyntaxError { path, error } = error.error() {
modifiedcrates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/conversions.rs
+++ b/crates/jrsonnet-evaluator/src/typed/conversions.rs
@@ -5,23 +5,23 @@
 use jrsonnet_types::{ComplexValType, ValType};
 
 use crate::{
+	ObjValue, ObjValueBuilder, Result, ResultExt, Thunk, Val,
 	arr::{ArrValue, BytesArray},
 	bail,
 	function::FuncVal,
 	typed::CheckType,
 	val::{IndexableVal, NumValue, StrValue, ThunkMapper},
-	ObjValue, ObjValueBuilder, Result, ResultExt, Thunk, Val,
 };
 
 #[doc(hidden)]
 pub mod __typed_macro_prelude {
 	pub use ::jrsonnet_evaluator::{
+		IStr, ObjValue, ObjValueBuilder, State, Val,
 		error::{ErrorKind, Result as JrResult},
 		typed::{
 			CheckType, ComplexValType, FromUntyped, IntoUntyped, ParseTypedObj, SerializeTypedObj,
 			Typed,
 		},
-		IStr, ObjValue, ObjValueBuilder, State, Val,
 	};
 }
 pub use jrsonnet_macros::{FromUntyped, IntoUntyped, Typed};
modifiedcrates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/mod.rs
+++ b/crates/jrsonnet-evaluator/src/typed/mod.rs
@@ -7,8 +7,9 @@
 use thiserror::Error;
 
 use crate::{
+	Val,
 	error::{Error, ErrorKind, Result},
-	in_description_frame, Val,
+	in_description_frame,
 };
 
 #[derive(Debug, Error, Clone, Acyclic)]
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -9,7 +9,7 @@
 	rc::Rc,
 };
 
-use jrsonnet_gcmodule::{cc_dyn, Acyclic, Cc, Trace};
+use jrsonnet_gcmodule::{Acyclic, Cc, Trace, cc_dyn};
 use jrsonnet_interner::IStr;
 pub use jrsonnet_macros::Thunk;
 use jrsonnet_types::ValType;
@@ -18,13 +18,12 @@
 
 pub use crate::arr::{ArrValue, ArrayLike};
 use crate::{
-	bail,
+	ObjValue, Result, SupThis, Unbound, WeakSupThis, bail,
 	error::{Error, ErrorKind::*},
 	function::FuncVal,
 	gc::WithCapacityExt as _,
 	manifest::{ManifestFormat, ToStringFormat},
 	typed::{BoundedUsize, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER},
-	ObjValue, Result, SupThis, Unbound, WeakSupThis,
 };
 
 pub trait ThunkValue: Trace {
modifiedcrates/jrsonnet-formatter/src/children.rsdiffbeforeafterboth
--- a/crates/jrsonnet-formatter/src/children.rs
+++ b/crates/jrsonnet-formatter/src/children.rs
@@ -3,8 +3,8 @@
 use std::{fmt::Debug, mem};
 
 use jrsonnet_rowan_parser::{
+	AstNode, AstToken, SyntaxElement, SyntaxNode, TS,
 	nodes::{CustomError, Trivia, TriviaKind},
-	AstNode, AstToken, SyntaxElement, SyntaxNode, TS,
 };
 
 pub type ChildTrivia = Vec<Result<Trivia, String>>;
modifiedcrates/jrsonnet-formatter/src/comments.rsdiffbeforeafterboth
--- a/crates/jrsonnet-formatter/src/comments.rs
+++ b/crates/jrsonnet-formatter/src/comments.rs
@@ -1,7 +1,7 @@
 use std::string::String;
 
 use dprint_core::formatting::PrintItems;
-use jrsonnet_rowan_parser::{nodes::TriviaKind, AstToken};
+use jrsonnet_rowan_parser::{AstToken, nodes::TriviaKind};
 
 use crate::{children::ChildTrivia, p, pi};
 
modifiedcrates/jrsonnet-formatter/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-formatter/src/lib.rs
+++ b/crates/jrsonnet-formatter/src/lib.rs
@@ -2,26 +2,26 @@
 
 use children::{children_between, trivia_before};
 use dprint_core::formatting::{
+	ConditionResolver, ConditionResolverContext, LineNumber, PrintItems, PrintOptions,
 	condition_helpers::is_multiple_lines,
 	condition_resolvers::true_resolver,
 	ir_helpers::{new_line_group, with_indent},
-	ConditionResolver, ConditionResolverContext, LineNumber, PrintItems, PrintOptions,
 };
 use hi_doc::{Formatting, SnippetBuilder};
 use jrsonnet_lexer::collect_lexed_str_block;
 use jrsonnet_rowan_parser::{
+	AstNode, AstToken as _, SyntaxToken,
 	nodes::{
 		Arg, ArgsDesc, Assertion, BinaryOperator, Bind, CompSpec, Destruct, DestructArrayPart,
 		DestructRest, Expr, ExprArray, ExprBase, FieldName, ForSpec, IfSpec, ImportKind, Literal,
 		Member, Name, Number, ObjBody, ObjLocal, ParamsDesc, SliceDesc, SourceFile, Stmt, Suffix,
 		Text, TextKind, UnaryOperator, Visibility,
 	},
-	AstNode, AstToken as _, SyntaxToken,
 };
 
 use crate::{
-	children::{trivia_after, Child, EndingComments},
-	comments::{format_comments, CommentLocation},
+	children::{Child, EndingComments, trivia_after},
+	comments::{CommentLocation, format_comments},
 };
 
 mod children;
@@ -461,18 +461,10 @@
 						if mem.should_start_with_newline {
 							p!(out, nl);
 						}
-						format_comments(
-							&mem.before_trivia,
-							CommentLocation::AboveItem,
-							&mut out,
-						);
-						p!(&mut out, {mem.value});
+						format_comments(&mem.before_trivia, CommentLocation::AboveItem, &mut out);
+						p!(&mut out, { mem.value });
 						p!(out, if("trailing comma", multi_line, str(",")));
-						format_comments(
-							&mem.inline_trivia,
-							CommentLocation::ItemInline,
-							&mut out,
-						);
+						format_comments(&mem.inline_trivia, CommentLocation::ItemInline, &mut out);
 						p!(out, if_else("member-comp sep", multi_line, nl)(sonl));
 					}
 
@@ -490,17 +482,9 @@
 						if mem.should_start_with_newline {
 							p!(out, nl);
 						}
-						format_comments(
-							&mem.before_trivia,
-							CommentLocation::AboveItem,
-							&mut out,
-						);
+						format_comments(&mem.before_trivia, CommentLocation::AboveItem, &mut out);
 						p!(&mut out, { mem.value });
-						format_comments(
-							&mem.inline_trivia,
-							CommentLocation::ItemInline,
-							&mut out,
-						);
+						format_comments(&mem.inline_trivia, CommentLocation::ItemInline, &mut out);
 						p!(out, if_else("comp spec sep", multi_line, nl)(sonl));
 					}
 
modifiedcrates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-interner/src/lib.rs
+++ b/crates/jrsonnet-interner/src/lib.rs
@@ -14,7 +14,7 @@
 	str,
 };
 
-use hashbrown::{hash_map::RawEntryMut, HashMap};
+use hashbrown::{HashMap, hash_map::RawEntryMut};
 use jrsonnet_gcmodule::{Acyclic, Trace};
 use rustc_hash::FxBuildHasher;
 
@@ -242,7 +242,7 @@
 pub mod interop {
 	use std::mem;
 
-	use crate::{PoolMap, POOL};
+	use crate::{POOL, PoolMap};
 
 	/// Type-erased interned string pool
 	pub enum PoolState {}
modifiedcrates/jrsonnet-ir-parser/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-ir-parser/Cargo.toml
+++ b/crates/jrsonnet-ir-parser/Cargo.toml
@@ -1,5 +1,6 @@
 [package]
 name = "jrsonnet-ir-parser"
+description = "Jrsonnet hand-rolled parser which parses source directly into IR"
 authors.workspace = true
 edition.workspace = true
 license.workspace = true
modifiedcrates/jrsonnet-ir-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir-parser/src/lib.rs
+++ b/crates/jrsonnet-ir-parser/src/lib.rs
@@ -2,12 +2,12 @@
 
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_ir::{
-	unescape, ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BinaryOpType, BindSpec, CompSpec,
-	Destruct, Expr, ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr, IfElse,
-	IfSpecData, ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers, Slice,
-	SliceDesc, Source, Span, Spanned, UnaryOpType, Visibility,
+	ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BinaryOpType, BindSpec, CompSpec, Destruct, Expr,
+	ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr, IfElse, IfSpecData,
+	ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers, Slice, SliceDesc,
+	Source, Span, Spanned, UnaryOpType, Visibility, unescape,
 };
-use jrsonnet_lexer::{collect_lexed_str_block, Lexeme, Lexer, SyntaxKind, T};
+use jrsonnet_lexer::{Lexeme, Lexer, SyntaxKind, T, collect_lexed_str_block};
 
 pub struct ParserSettings {
 	pub source: Source,
modifiedcrates/jrsonnet-ir/src/function.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir/src/function.rs
+++ b/crates/jrsonnet-ir/src/function.rs
@@ -1,6 +1,4 @@
-use std::fmt;
-use std::ops::Deref;
-use std::rc::Rc;
+use std::{fmt, ops::Deref, rc::Rc};
 
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_interner::IStr;
@@ -50,11 +48,7 @@
 }
 impl ParamDefault {
 	pub const fn exists(is_exists: bool) -> Self {
-		if is_exists {
-			Self::Exists
-		} else {
-			Self::None
-		}
+		if is_exists { Self::Exists } else { Self::None }
 	}
 }
 impl fmt::Display for ParamDefault {
modifiedcrates/jrsonnet-ir/src/location.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir/src/location.rs
+++ b/crates/jrsonnet-ir/src/location.rs
@@ -85,7 +85,7 @@
 
 #[cfg(test)]
 pub mod tests {
-	use super::{offset_to_location, CodeLocation};
+	use super::{CodeLocation, offset_to_location};
 
 	#[test]
 	fn test() {
modifiedcrates/jrsonnet-ir/src/source.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir/src/source.rs
+++ b/crates/jrsonnet-ir/src/source.rs
@@ -9,7 +9,7 @@
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_interner::{IBytes, IStr};
 
-use crate::location::{location_to_offset, offset_to_location, CodeLocation};
+use crate::location::{CodeLocation, location_to_offset, offset_to_location};
 
 macro_rules! any_ext_methods {
 	($T:ident) => {
@@ -286,22 +286,22 @@
 	}
 
 	pub fn code(&self) -> &str {
-		&self.0 .1
+		&self.0.1
 	}
 
 	pub fn source_path(&self) -> &SourcePath {
-		&self.0 .0
+		&self.0.0
 	}
 
 	pub fn map_source_locations<const S: usize>(&self, locs: &[u32; S]) -> [CodeLocation; S] {
-		offset_to_location(&self.0 .1, locs)
+		offset_to_location(&self.0.1, locs)
 	}
 	pub fn map_from_source_location(&self, line: usize, column: usize) -> Option<usize> {
-		location_to_offset(&self.0 .1, line, column)
+		location_to_offset(&self.0.1, line, column)
 	}
 }
 impl fmt::Debug for Source {
 	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-		write!(f, "{:?}", self.0 .0)
+		write!(f, "{:?}", self.0.0)
 	}
 }
modifiedcrates/jrsonnet-lexer/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-lexer/Cargo.toml
+++ b/crates/jrsonnet-lexer/Cargo.toml
@@ -1,5 +1,6 @@
 [package]
 name = "jrsonnet-lexer"
+description = "Jrsonnet lexer shared between rowan and hand-rolled parser"
 authors.workspace = true
 edition.workspace = true
 license.workspace = true
modifiedcrates/jrsonnet-lexer/src/lex.rsdiffbeforeafterboth
--- a/crates/jrsonnet-lexer/src/lex.rs
+++ b/crates/jrsonnet-lexer/src/lex.rs
@@ -1,12 +1,12 @@
 use core::ops::Range;
 
 use logos::Logos;
+
 // use rowan::{TextRange, TextSize};
-
 use crate::{
+	Span,
 	generated::syntax_kinds::SyntaxKind,
-	string_block::{lex_str_block, StringBlockError},
-	Span,
+	string_block::{StringBlockError, lex_str_block},
 };
 
 pub struct Lexer<'a> {
modifiedcrates/jrsonnet-lexer/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-lexer/src/lib.rs
+++ b/crates/jrsonnet-lexer/src/lib.rs
@@ -7,4 +7,4 @@
 
 pub use generated::syntax_kinds::SyntaxKind;
 pub use lex::{Lexeme, Lexer};
-pub use string_block::{collect_lexed_str_block, CollectStrBlock};
+pub use string_block::{CollectStrBlock, collect_lexed_str_block};
modifiedcrates/jrsonnet-lexer/src/string_block.rsdiffbeforeafterboth
--- a/crates/jrsonnet-lexer/src/string_block.rs
+++ b/crates/jrsonnet-lexer/src/string_block.rs
@@ -6,8 +6,8 @@
 	MissingIndent,
 }
 
+use StringBlockError::*;
 use logos::Lexer;
-use StringBlockError::*;
 
 use crate::generated::syntax_kinds::SyntaxKind;
 
modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-macros/src/lib.rs
+++ b/crates/jrsonnet-macros/src/lib.rs
@@ -3,14 +3,13 @@
 use proc_macro2::TokenStream;
 use quote::{quote, quote_spanned};
 use syn::{
-	parenthesized,
+	Attribute, DeriveInput, Error, Expr, ExprClosure, FnArg, GenericArgument, Ident, ItemFn,
+	LitStr, Meta, Pat, Path, PathArguments, Result, ReturnType, Token, Type, parenthesized,
 	parse::{Parse, ParseStream},
 	parse_macro_input,
 	punctuated::Punctuated,
 	spanned::Spanned,
 	token::Comma,
-	Attribute, DeriveInput, Error, Expr, ExprClosure, FnArg, GenericArgument, Ident, ItemFn,
-	LitStr, Meta, Pat, Path, PathArguments, Result, ReturnType, Token, Type,
 };
 
 use self::typed::{derive_from_untyped_inner, derive_into_untyped_inner, derive_typed_inner};
modifiedcrates/jrsonnet-macros/src/typed.rsdiffbeforeafterboth
--- a/crates/jrsonnet-macros/src/typed.rs
+++ b/crates/jrsonnet-macros/src/typed.rs
@@ -1,10 +1,13 @@
-use crate::names::Names;
-use crate::{extract_type_from_option, kw, parse_attr, type_is_path};
 use proc_macro2::TokenStream;
 use quote::quote;
-use syn::parse::{Parse, ParseStream};
-use syn::spanned::Spanned as _;
-use syn::{parenthesized, token, DeriveInput, Error, Ident, LitStr, Result, Token, Type};
+use syn::{
+	DeriveInput, Error, Ident, LitStr, Result, Token, Type, parenthesized,
+	parse::{Parse, ParseStream},
+	spanned::Spanned as _,
+	token,
+};
+
+use crate::{extract_type_from_option, kw, names::Names, parse_attr, type_is_path};
 
 #[derive(Default)]
 #[allow(clippy::struct_excessive_bools)]
modifiedcrates/jrsonnet-peg-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-peg-parser/src/lib.rs
+++ b/crates/jrsonnet-peg-parser/src/lib.rs
@@ -1,12 +1,13 @@
+use std::rc::Rc;
+
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_ir::{
-	unescape, ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BindSpec, CompSpec, Destruct,
-	DestructRest, Expr, ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr, IfElse,
-	IfSpecData, ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers, Slice,
-	SliceDesc, Source, Span, Spanned, Visibility,
+	ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BindSpec, CompSpec, Destruct, DestructRest, Expr,
+	ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr, IfElse, IfSpecData,
+	ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers, Slice, SliceDesc,
+	Source, Span, Spanned, Visibility, unescape,
 };
 use peg::parser;
-use std::rc::Rc;
 
 pub struct ParserSettings {
 	pub source: Source,
@@ -58,7 +59,7 @@
 		rule id() -> IStr = v:$(quiet!{ !reserved() alpha() (alpha() / digit())*} / expected!("<identifier>")) { v.into() }
 
 		rule keyword(id: &'static str) -> ()
-			= ##parse_string_literal(id) end_of_ident()
+			= #parse_string_literal(id) end_of_ident()
 
 		pub rule param(s: &ParserSettings) -> ExprParam = destruct:destruct(s) expr:(_ "=" _ expr:expr(s){expr})? { ExprParam { destruct, default: expr.map(Rc::new) } }
 		pub rule params(s: &ParserSettings) -> ExprParams
@@ -429,7 +430,7 @@
 	use insta::{assert_snapshot, glob};
 	use jrsonnet_ir::{IStr, Source};
 
-	use crate::{parse, ParserSettings};
+	use crate::{ParserSettings, parse};
 
 	#[test]
 	fn snapshots() {
modifiedcrates/jrsonnet-rowan-parser/src/event.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/event.rs
+++ b/crates/jrsonnet-rowan-parser/src/event.rs
@@ -3,10 +3,10 @@
 use rowan::{GreenNodeBuilder, Language, TextRange, TextSize};
 
 use crate::{
+	AstToken, JsonnetLanguage, SyntaxKind,
 	lex::Lexeme,
 	nodes::Trivia,
 	parser::{LocatedSyntaxError, Parse, SyntaxError},
-	AstToken, JsonnetLanguage, SyntaxKind,
 };
 
 #[derive(Clone, Debug)]
modifiedcrates/jrsonnet-rowan-parser/src/generated/nodes.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/generated/nodes.rs
+++ b/crates/jrsonnet-rowan-parser/src/generated/nodes.rs
@@ -3,9 +3,9 @@
 
 #![allow(non_snake_case, clippy::match_like_matches_macro)]
 use crate::{
-	ast::{support, AstChildren, AstNode, AstToken},
 	SyntaxKind::{self, *},
 	SyntaxNode, SyntaxToken, T,
+	ast::{AstChildren, AstNode, AstToken, support},
 };
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
modifiedcrates/jrsonnet-rowan-parser/src/marker.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/marker.rs
+++ b/crates/jrsonnet-rowan-parser/src/marker.rs
@@ -3,9 +3,9 @@
 use drop_bomb::DropBomb;
 
 use crate::{
+	SyntaxKind,
 	event::Event,
 	parser::{ExpectedSyntax, Parser, SyntaxError},
-	SyntaxKind,
 };
 
 // pub struct Ranger {
modifiedcrates/jrsonnet-rowan-parser/src/parser.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/parser.rs
+++ b/crates/jrsonnet-rowan-parser/src/parser.rs
@@ -3,13 +3,13 @@
 use rowan::{GreenNode, TextRange};
 
 use crate::{
+	AstToken, SyntaxKind,
+	SyntaxKind::*,
+	SyntaxNode, T, TS,
 	event::Event,
 	marker::{CompletedMarker, Marker},
 	nodes::{BinaryOperatorKind, Literal, Number, Text, UnaryOperatorKind},
 	token_set::SyntaxKindSet,
-	AstToken, SyntaxKind,
-	SyntaxKind::*,
-	SyntaxNode, T, TS,
 };
 
 pub struct Parse {
@@ -923,8 +923,7 @@
 
 		let m = p.start();
 		p.bump();
-		let _ = expr_binding_power(p, right_binding_power)
-			.map(|v| v.precede(p).complete(p, EXPR));
+		let _ = expr_binding_power(p, right_binding_power).map(|v| v.precede(p).complete(p, EXPR));
 		m.complete(p, EXPR_UNARY)
 	} else if p.at(T!['(']) {
 		let m = p.start();
modifiedcrates/jrsonnet-rowan-parser/src/tests.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/tests.rs
+++ b/crates/jrsonnet-rowan-parser/src/tests.rs
@@ -3,7 +3,7 @@
 
 use hi_doc::{Formatting, SnippetBuilder, Text};
 
-use crate::{parse, AstNode};
+use crate::{AstNode, parse};
 
 fn process(text: &str) -> String {
 	use std::fmt::Write;
modifiedcrates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -17,8 +17,8 @@
 exp-bigint = ["dep:num-bigint", "jrsonnet-evaluator/exp-bigint"]
 
 exp-null-coaelse = [
-	"jrsonnet-ir/exp-null-coaelse",
-	"jrsonnet-evaluator/exp-null-coaelse",
+  "jrsonnet-ir/exp-null-coaelse",
+  "jrsonnet-evaluator/exp-null-coaelse",
 ]
 # std.regexMatch and other helpers
 exp-regex = ["dep:regex", "dep:lru", "dep:rustc-hash"]
modifiedcrates/jrsonnet-stdlib/src/arrays.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/arrays.rs
+++ b/crates/jrsonnet-stdlib/src/arrays.rs
@@ -1,12 +1,11 @@
 #![allow(non_snake_case)]
 
 use jrsonnet_evaluator::{
-	bail,
-	function::{builtin, FuncVal, NativeFn},
+	Either, IStr, ObjValue, ObjValueBuilder, Result, ResultExt, Thunk, Val, bail,
+	function::{FuncVal, NativeFn, builtin},
 	runtime_error,
 	typed::{BoundedI32, BoundedUsize, Either2, FromUntyped},
-	val::{equals, ArrValue, IndexableVal},
-	Either, IStr, ObjValue, ObjValueBuilder, Result, ResultExt, Thunk, Val,
+	val::{ArrValue, IndexableVal, equals},
 };
 
 pub fn eval_on_empty(on_empty: Option<Thunk<Val>>) -> Result<Val> {
modifiedcrates/jrsonnet-stdlib/src/compat.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/compat.rs
+++ b/crates/jrsonnet-stdlib/src/compat.rs
@@ -1,7 +1,7 @@
 use std::cmp::Ordering;
 
 use jrsonnet_evaluator::{
-	function::builtin, operator::evaluate_compare_op, val::ArrValue, Result, Val,
+	Result, Val, function::builtin, operator::evaluate_compare_op, val::ArrValue,
 };
 
 #[builtin]
modifiedcrates/jrsonnet-stdlib/src/encoding.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/encoding.rs
+++ b/crates/jrsonnet-stdlib/src/encoding.rs
@@ -1,10 +1,9 @@
-use base64::{engine::general_purpose::STANDARD, Engine};
+use base64::{Engine, engine::general_purpose::STANDARD};
 use jrsonnet_evaluator::{
-	bail,
+	IBytes, IStr, Result, bail,
 	function::builtin,
 	runtime_error,
 	typed::{Either, Either2},
-	IBytes, IStr, Result,
 };
 
 #[builtin]
modifiedcrates/jrsonnet-stdlib/src/hash.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/hash.rs
+++ b/crates/jrsonnet-stdlib/src/hash.rs
@@ -1,4 +1,4 @@
-use jrsonnet_evaluator::{function::builtin, IStr};
+use jrsonnet_evaluator::{IStr, function::builtin};
 
 #[builtin]
 pub fn builtin_md5(s: IStr) -> String {
modifiedcrates/jrsonnet-stdlib/src/keyf.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/keyf.rs
+++ b/crates/jrsonnet-stdlib/src/keyf.rs
@@ -1,6 +1,8 @@
-use jrsonnet_evaluator::function::{CallLocation, FuncVal, PreparedFuncVal};
-use jrsonnet_evaluator::typed::{ComplexValType, FromUntyped, Typed, ValType};
-use jrsonnet_evaluator::{Error, Result, Thunk, Val};
+use jrsonnet_evaluator::{
+	Error, Result, Thunk, Val,
+	function::{CallLocation, FuncVal, PreparedFuncVal},
+	typed::{ComplexValType, FromUntyped, Typed, ValType},
+};
 
 #[derive(Default, Clone)]
 pub enum KeyF {
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -12,12 +12,12 @@
 pub use encoding::*;
 pub use hash::*;
 use jrsonnet_evaluator::{
+	ContextBuilder, IStr, ObjValue, ObjValueBuilder, Thunk, Val,
 	error::Result,
 	function::{CallLocation, FuncVal},
 	tla::TlaArg,
 	trace::PathResolver,
 	val::NumValue,
-	ContextBuilder, IStr, ObjValue, ObjValueBuilder, Thunk, Val,
 };
 use jrsonnet_gcmodule::{Acyclic, Cc, Trace};
 use jrsonnet_ir::Source;
modifiedcrates/jrsonnet-stdlib/src/manifest/ini.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/ini.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/ini.rs
@@ -1,9 +1,9 @@
 use std::collections::BTreeMap;
 
 use jrsonnet_evaluator::{
+	IStr, ObjValue, Result, ResultExt, Val,
 	manifest::{ManifestFormat, ToStringFormat},
 	typed::{FromUntyped, Typed},
-	IStr, ObjValue, Result, ResultExt, Val,
 };
 
 pub struct IniFormat {
modifiedcrates/jrsonnet-stdlib/src/manifest/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/mod.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/mod.rs
@@ -6,9 +6,9 @@
 
 pub use ini::IniFormat;
 use jrsonnet_evaluator::{
+	IStr, ObjValue, Result, Val,
 	function::builtin,
-	manifest::{escape_string_json, JsonFormat, YamlStreamFormat},
-	IStr, ObjValue, Result, Val,
+	manifest::{JsonFormat, YamlStreamFormat, escape_string_json},
 };
 pub use python::{PythonFormat, PythonVarsFormat};
 pub use toml::TomlFormat;
modifiedcrates/jrsonnet-stdlib/src/manifest/python.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/python.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/python.rs
@@ -1,7 +1,6 @@
 use jrsonnet_evaluator::{
-	bail,
-	manifest::{escape_string_json_buf, ManifestFormat, ToStringFormat},
-	Result, Val,
+	Result, Val, bail,
+	manifest::{ManifestFormat, ToStringFormat, escape_string_json_buf},
 };
 
 pub struct PythonFormat {
modifiedcrates/jrsonnet-stdlib/src/manifest/toml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/toml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/toml.rs
@@ -1,10 +1,9 @@
 use std::borrow::Cow;
 
 use jrsonnet_evaluator::{
-	bail, in_description_frame,
-	manifest::{escape_string_json_buf, ManifestFormat},
+	IStr, ObjValue, Result, ResultExt, Val, bail, in_description_frame,
+	manifest::{ManifestFormat, escape_string_json_buf},
 	val::ArrValue,
-	IStr, ObjValue, Result, ResultExt, Val,
 };
 
 pub struct TomlFormat<'s> {
modifiedcrates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/xml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/xml.rs
@@ -1,9 +1,8 @@
 use jrsonnet_evaluator::{
-	bail, in_description_frame,
+	Either, ObjValue, Result, ResultExt, Val, bail, in_description_frame,
 	manifest::{ManifestFormat, ToStringFormat},
 	typed::{ComplexValType, Either2, FromUntyped, Typed, ValType},
 	val::ArrValue,
-	Either, ObjValue, Result, ResultExt, Val,
 };
 
 pub struct XmlJsonmlFormat {
modifiedcrates/jrsonnet-stdlib/src/manifest/yaml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/yaml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/yaml.rs
@@ -1,9 +1,8 @@
 use std::{borrow::Cow, fmt::Write};
 
 use jrsonnet_evaluator::{
-	bail, in_description_frame,
-	manifest::{escape_string_json_buf, ManifestFormat},
-	Result, ResultExt, Val,
+	Result, ResultExt, Val, bail, in_description_frame,
+	manifest::{ManifestFormat, escape_string_json_buf},
 };
 
 pub struct YamlFormat<'s> {
modifiedcrates/jrsonnet-stdlib/src/math.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/math.rs
+++ b/crates/jrsonnet-stdlib/src/math.rs
@@ -9,11 +9,7 @@
 
 #[builtin]
 pub fn builtin_sign(n: f64) -> f64 {
-	if n == 0. {
-		0.
-	} else {
-		n.signum()
-	}
+	if n == 0. { 0. } else { n.signum() }
 }
 
 #[builtin]
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -1,13 +1,12 @@
 use std::{cell::RefCell, collections::BTreeSet};
 
 use jrsonnet_evaluator::{
-	bail,
+	Either, IStr, ObjValue, ObjValueBuilder, ResultExt, Thunk, Val, bail,
 	error::{ErrorKind::*, Result},
-	function::{builtin, CallLocation, FuncVal},
+	function::{CallLocation, FuncVal, builtin},
 	manifest::JsonFormat,
 	typed::{Either2, Either4},
-	val::{equals, ArrValue},
-	Either, IStr, ObjValue, ObjValueBuilder, ResultExt, Thunk, Val,
+	val::{ArrValue, equals},
 };
 use jrsonnet_gcmodule::Cc;
 
@@ -202,7 +201,9 @@
 	for field in target_fields.union(&patch_fields) {
 		let Some(field_patch) = patch.get(field.clone())? else {
 			// All lazy fields might be unified into a single filtered object core instead of creating a thunk per, but this implementation is good enough.
-			let target_field = target.get_lazy(field.clone()).expect("we're iterating over fields union, if field is missing in patch - it exists in target");
+			let target_field = target.get_lazy(field.clone()).expect(
+				"we're iterating over fields union, if field is missing in patch - it exists in target",
+			);
 			out.field(field.clone()).thunk(target_field);
 			continue;
 		};
modifiedcrates/jrsonnet-stdlib/src/objects.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/objects.rs
+++ b/crates/jrsonnet-stdlib/src/objects.rs
@@ -1,9 +1,9 @@
 use jrsonnet_evaluator::{
+	IStr, ObjValue, ObjValueBuilder,
 	function::builtin,
 	gc::WithCapacityExt,
 	rustc_hash::FxHashSet,
 	val::{ArrValue, Val},
-	IStr, ObjValue, ObjValueBuilder,
 };
 
 #[builtin]
modifiedcrates/jrsonnet-stdlib/src/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/operator.rs
+++ b/crates/jrsonnet-stdlib/src/operator.rs
@@ -2,12 +2,12 @@
 //! However, in our case we instead implement them in native, and implement native functions on top of core for backwards compatibility
 
 use jrsonnet_evaluator::{
+	IStr, Result, Val,
 	function::builtin,
 	operator::evaluate_mod_op,
 	stdlib::std_format,
 	typed::{Either, Either2},
-	val::{equals, primitive_equals, NumValue},
-	IStr, Result, Val,
+	val::{NumValue, equals, primitive_equals},
 };
 
 #[builtin]
modifiedcrates/jrsonnet-stdlib/src/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/parse.rs
+++ b/crates/jrsonnet-stdlib/src/parse.rs
@@ -1,4 +1,4 @@
-use jrsonnet_evaluator::{function::builtin, runtime_error, IStr, Result, Val};
+use jrsonnet_evaluator::{IStr, Result, Val, function::builtin, runtime_error};
 
 #[builtin]
 pub fn builtin_parse_json(str: IStr) -> Result<Val> {
modifiedcrates/jrsonnet-stdlib/src/regex.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/regex.rs
+++ b/crates/jrsonnet-stdlib/src/regex.rs
@@ -2,11 +2,11 @@
 
 use ::regex::Regex;
 use jrsonnet_evaluator::{
+	IStr, ObjValue, ObjValueBuilder,
 	error::{ErrorKind::*, Result},
 	rustc_hash::FxBuildHasher,
 	typed::{IntoUntyped, Typed},
 	val::StrValue,
-	IStr, ObjValue, ObjValueBuilder,
 };
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_macros::builtin;
modifiedcrates/jrsonnet-stdlib/src/sets.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/sets.rs
+++ b/crates/jrsonnet-stdlib/src/sets.rs
@@ -1,7 +1,7 @@
 use std::cmp::Ordering;
 
 use jrsonnet_evaluator::{
-	function::builtin, operator::evaluate_compare_op, val::ArrValue, Result, Thunk, Val,
+	Result, Thunk, Val, function::builtin, operator::evaluate_compare_op, val::ArrValue,
 };
 use jrsonnet_ir::BinaryOpType;
 
modifiedcrates/jrsonnet-stdlib/src/sort.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/sort.rs
+++ b/crates/jrsonnet-stdlib/src/sort.rs
@@ -3,11 +3,10 @@
 use std::cmp::Ordering;
 
 use jrsonnet_evaluator::{
-	bail,
+	Result, Thunk, Val, bail,
 	function::builtin,
 	operator::evaluate_compare_op,
-	val::{equals, ArrValue},
-	Result, Thunk, Val,
+	val::{ArrValue, equals},
 };
 use jrsonnet_ir::BinaryOpType;
 
modifiedcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/strings.rs
+++ b/crates/jrsonnet-stdlib/src/strings.rs
@@ -1,12 +1,11 @@
 use std::collections::BTreeSet;
 
 use jrsonnet_evaluator::{
-	bail,
+	Either, IStr, Val, bail,
 	error::{ErrorKind::*, Result},
 	function::builtin,
 	typed::{Either2, FromUntyped, M1},
 	val::{ArrValue, IndexableVal},
-	Either, IStr, Val,
 };
 
 #[builtin]
@@ -206,8 +205,8 @@
 #[cfg(feature = "exp-bigint")]
 #[builtin]
 pub fn builtin_bigint(v: Either![f64, IStr]) -> Result<Val> {
+	use Either2::*;
 	use jrsonnet_evaluator::runtime_error;
-	use Either2::*;
 	Ok(match v {
 		A(a) => {
 			Val::BigInt(Box::new(a.to_string().parse().map_err(|e| {
modifiedcrates/jrsonnet-stdlib/src/types.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/types.rs
+++ b/crates/jrsonnet-stdlib/src/types.rs
@@ -1,4 +1,4 @@
-use jrsonnet_evaluator::{function::builtin, IStr, Val};
+use jrsonnet_evaluator::{IStr, Val, function::builtin};
 
 #[builtin]
 pub fn builtin_type(x: Val) -> IStr {
modifiedflake.lockdiffbeforeafterboth
--- a/flake.lock
+++ b/flake.lock
@@ -2,18 +2,40 @@
   "nodes": {
     "crane": {
       "locked": {
-        "lastModified": 1770419512,
-        "owner": "ipetkov",
+        "lastModified": 1775245625,
+        "owner": "CertainLach",
         "repo": "crane",
-        "rev": "2510f2cbc3ccd237f700bb213756a8f35c32d8d7",
+        "rev": "9c67a3098774323d0270004eed7d7291ddcfe918",
         "type": "github"
       },
       "original": {
-        "owner": "ipetkov",
+        "owner": "CertainLach",
+        "ref": "refactor/drop-remarshal",
         "repo": "crane",
         "type": "github"
       }
     },
+    "fenix": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "rust-analyzer-src": "rust-analyzer-src"
+      },
+      "locked": {
+        "lastModified": 1775272531,
+        "owner": "CertainLach",
+        "repo": "fenix",
+        "rev": "831116e5887552af53f2998dcb46e1d55dc0850e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "CertainLach",
+        "ref": "fix/libatomic",
+        "repo": "fenix",
+        "type": "github"
+      }
+    },
     "flake-parts": {
       "inputs": {
         "nixpkgs-lib": [
@@ -21,10 +43,10 @@
         ]
       },
       "locked": {
-        "lastModified": 1769996383,
+        "lastModified": 1775087534,
         "owner": "hercules-ci",
         "repo": "flake-parts",
-        "rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
+        "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
         "type": "github"
       },
       "original": {
@@ -33,12 +55,34 @@
         "type": "github"
       }
     },
+    "hercules-ci-effects": {
+      "inputs": {
+        "flake-parts": [
+          "flake-parts"
+        ],
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1773550609,
+        "owner": "hercules-ci",
+        "repo": "hercules-ci-effects",
+        "rev": "554f6ed448ca74c00aa2371cde901ae1e73005b9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "hercules-ci-effects",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1770468184,
+        "lastModified": 1775270577,
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "a124a10ea33a73329c42d67f30efcdbfb60a4e04",
+        "rev": "9370b0614498381a0019e082c10e9cf8413e7c2c",
         "type": "github"
       },
       "original": {
@@ -51,28 +95,28 @@
     "root": {
       "inputs": {
         "crane": "crane",
+        "fenix": "fenix",
         "flake-parts": "flake-parts",
+        "hercules-ci-effects": "hercules-ci-effects",
         "nixpkgs": "nixpkgs",
-        "rust-overlay": "rust-overlay",
-        "shelly": "shelly"
+        "shelly": "shelly",
+        "treefmt-nix": "treefmt-nix"
       }
     },
-    "rust-overlay": {
-      "inputs": {
-        "nixpkgs": [
-          "nixpkgs"
-        ]
-      },
+    "rust-analyzer-src": {
+      "flake": false,
       "locked": {
-        "lastModified": 1770433312,
-        "owner": "oxalica",
-        "repo": "rust-overlay",
-        "rev": "9922ff9f99a6436756cbe6f5d11f9c3630e58cf0",
+        "lastModified": 1775174431,
+        "narHash": "sha256-jSw1C5MuyySiCpPgjdR+H0wPR3AgPRuylLunw+yd7A0=",
+        "owner": "rust-lang",
+        "repo": "rust-analyzer",
+        "rev": "9767050b2db436f5a770c5f91a548c88fd91ec71",
         "type": "github"
       },
       "original": {
-        "owner": "oxalica",
-        "repo": "rust-overlay",
+        "owner": "rust-lang",
+        "ref": "nightly",
+        "repo": "rust-analyzer",
         "type": "github"
       }
     },
@@ -89,6 +133,25 @@
         "repo": "shelly",
         "type": "github"
       }
+    },
+    "treefmt-nix": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1775125835,
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "rev": "75925962939880974e3ab417879daffcba36c4a3",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "type": "github"
+      }
     }
   },
   "root": "root",
modifiedflake.nixdiffbeforeafterboth
--- a/flake.nix
+++ b/flake.nix
@@ -2,46 +2,219 @@
   description = "Jrsonnet";
   inputs = {
     nixpkgs.url = "github:nixos/nixpkgs/release-25.11";
-    rust-overlay = {
-      url = "github:oxalica/rust-overlay";
+    fenix = {
+      url = "github:CertainLach/fenix/fix/libatomic";
       inputs.nixpkgs.follows = "nixpkgs";
     };
     flake-parts = {
       url = "github:hercules-ci/flake-parts";
       inputs.nixpkgs-lib.follows = "nixpkgs";
     };
-    crane.url = "github:ipetkov/crane";
+    hercules-ci-effects = {
+      url = "github:hercules-ci/hercules-ci-effects";
+      inputs.flake-parts.follows = "flake-parts";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    crane.url = "github:CertainLach/crane/refactor/drop-remarshal";
     shelly.url = "github:CertainLach/shelly";
   };
   outputs =
-    inputs@{
-      nixpkgs,
-      flake-parts,
-      rust-overlay,
-      crane,
-      shelly,
-      ...
-    }:
-    flake-parts.lib.mkFlake { inherit inputs; } {
-      imports = [ shelly.flakeModule ];
-      systems = inputs.nixpkgs.lib.systems.flakeExposed;
+    inputs:
+    let
+      inherit (inputs.nixpkgs.lib)
+        mkIf
+        mkForce
+        optionals
+        optionalAttrs
+        ;
+    in
+    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
+      imports = [
+        inputs.shelly.flakeModule
+        inputs.hercules-ci-effects.flakeModule
+      ];
+      systems = [
+        "x86_64-linux"
+        "i686-linux"
+        "aarch64-linux"
+        "armv7l-linux"
+        "aarch64-darwin"
+      ];
       perSystem =
         {
           config,
+          self',
           system,
           ...
         }:
         let
-          pkgs = import nixpkgs {
+          pkgs = import inputs.nixpkgs {
             inherit system;
-            overlays = [ rust-overlay.overlays.default ];
+            overlays = [ inputs.fenix.overlays.default ];
             config.allowUnsupportedSystem = true;
+            config.allowUnfreePredicate = pkg: pkg.name == "Xcode.app";
+          };
+          targetArch = pkgs.stdenv.hostPlatform.parsed.cpu.name;
+          rustfmt = (pkgs.fenix.complete or pkgs.fenix.stable).rustfmt;
+          toolchain = pkgs.fenix.combine [
+            (pkgs.fenix.stable.withComponents [
+              "cargo"
+              "clippy"
+              "rustc"
+              "rust-src"
+            ])
+            rustfmt
+          ];
+          craneLib = (inputs.crane.mkLib pkgs).overrideToolchain toolchain;
+          treefmt =
+            (inputs.treefmt-nix.lib.evalModule pkgs (import ./treefmt.nix { inherit rustfmt; })).config.build;
+
+          # Cross-compilation toolchains
+          crossToolchain = pkgs.fenix.combine [
+            (pkgs.fenix.stable.withComponents [
+              "cargo"
+              "rustc"
+            ])
+            pkgs.fenix.targets."${targetArch}-unknown-linux-musl".stable.rust-std
+            pkgs.fenix.targets."${targetArch}-apple-darwin".stable.rust-std
+          ];
+          craneLibCross = (inputs.crane.mkLib pkgs).overrideToolchain crossToolchain;
+
+          # Windows cross-compilation
+          pkgsWindows = import inputs.nixpkgs {
+            overlays = [ inputs.fenix.overlays.default ];
+            localSystem = system;
+            crossSystem = {
+              config = "${targetArch}-w64-mingw32";
+              libc = "msvcrt";
+            };
           };
-          rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
-          craneLib = (crane.mkLib pkgs).overrideToolchain rust;
+          windowsToolchain = pkgs.fenix.combine [
+            (pkgs.fenix.stable.withComponents [
+              "cargo"
+              "rustc"
+            ])
+            pkgs.fenix.targets."${targetArch}-pc-windows-gnu".stable.rust-std
+          ];
+          craneLibWindows = (inputs.crane.mkLib pkgsWindows).overrideToolchain (_: windowsToolchain);
+
         in
         {
           legacyPackages = {
+            release = optionalAttrs pkgs.stdenv.hostPlatform.isLinux (
+              {
+                jrsonnet-linux-glibc = self'.packages.jrsonnet;
+                jrsonnet-experimental-linux-glibc = self'.packages.jrsonnet-experimental;
+              }
+              // optionalAttrs pkgs.stdenv.hostPlatform.is64bit rec {
+                jrsonnet-linux-musl = pkgs.callPackage ./nix/jrsonnet-cross-musl.nix {
+                  craneLib = craneLibCross;
+                  targetTriple = "${targetArch}-unknown-linux-musl";
+                  muslCC = pkgs.pkgsMusl.stdenv.cc;
+                };
+                jrsonnet-experimental-linux-musl = jrsonnet-linux-musl.override {
+                  withExperimentalFeatures = true;
+                };
+              }
+              // optionalAttrs (targetArch == "aarch64") rec {
+                jrsonnet-darwin = pkgs.callPackage ./nix/jrsonnet-cross-darwin.nix {
+                  craneLib = craneLibCross;
+                  targetTriple = "${targetArch}-apple-darwin";
+                };
+                jrsonnet-experimental-darwin = jrsonnet-darwin.override {
+                  withExperimentalFeatures = true;
+                };
+              }
+              // optionalAttrs (targetArch == "x86_64") rec {
+                jrsonnet-windows = pkgsWindows.callPackage ./nix/jrsonnet-cross-windows.nix {
+                  craneLib = craneLibWindows;
+                  targetTriple = "${targetArch}-pc-windows-gnu";
+                };
+                jrsonnet-experimental-windows = jrsonnet-windows.override {
+                  withExperimentalFeatures = true;
+                };
+              }
+            );
+            benchmarks = optionalAttrs (system == "x86_64-linux" || system == "aarch64-linux") {
+              default = pkgs.callPackage ./nix/benchmarks.nix {
+                inherit (config.legacyPackages.jsonnetImpls)
+                  go-jsonnet
+                  sjsonnet
+                  cpp-jsonnet
+                  rsjsonnet
+                  ;
+                jrsonnetVariants = [
+                  {
+                    drv = self'.packages.jrsonnet.override { forBenchmarks = true; };
+                    name = "";
+                  }
+                ];
+              };
+              quick = pkgs.callPackage ./nix/benchmarks.nix {
+                inherit (config.legacyPackages.jsonnetImpls)
+                  go-jsonnet
+                  sjsonnet
+                  cpp-jsonnet
+                  rsjsonnet
+                  ;
+                quick = true;
+                jrsonnetVariants = [
+                  {
+                    drv = self'.packages.jrsonnet.override { forBenchmarks = true; };
+                    name = "";
+                  }
+                ];
+              };
+              against-release = pkgs.callPackage ./nix/benchmarks.nix {
+                inherit (config.legacyPackages.jsonnetImpls)
+                  go-jsonnet
+                  sjsonnet
+                  cpp-jsonnet
+                  rsjsonnet
+                  ;
+                jrsonnetVariants = [
+                  {
+                    drv = self'.packages.jrsonnet.override { forBenchmarks = true; };
+                    name = "current";
+                  }
+                  {
+                    drv = self'.packages.jrsonnet-experimental.override { forBenchmarks = true; };
+                    name = "current-experimental";
+                  }
+                  {
+                    drv = self'.legacyPackages.jsonnetImpls.jrsonnet-release.override { forBenchmarks = true; };
+                    name = "release";
+                  }
+                ];
+              };
+              quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {
+                inherit (config.legacyPackages.jsonnetImpls)
+                  go-jsonnet
+                  sjsonnet
+                  cpp-jsonnet
+                  rsjsonnet
+                  ;
+                quick = true;
+                jrsonnetVariants = [
+                  {
+                    drv = self'.packages.jrsonnet.override { forBenchmarks = true; };
+                    name = "current";
+                  }
+                  {
+                    drv = self'.packages.jrsonnet-experimental.override { forBenchmarks = true; };
+                    name = "current-experimental";
+                  }
+                  {
+                    drv = self'.legacyPackages.jsonnetImpls.jrsonnet-release.override { forBenchmarks = true; };
+                    name = "release";
+                  }
+                ];
+              };
+            };
             jsonnetImpls = {
               go-jsonnet = pkgs.callPackage ./nix/go-jsonnet.nix { };
               sjsonnet = pkgs.callPackage ./nix/sjsonnet.nix { };
@@ -49,101 +222,33 @@
               # I didn't managed to build it, and nixpkgs version is marked as broken
               # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };
               rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix { };
+              # Older released version of jrsonnet itself, for benchmarking purposes
+              jrsonnet-release = pkgs.callPackage ./nix/jrsonnet-release.nix {
+                rustPlatform = pkgs.makeRustPlatform {
+                  rustc = toolchain;
+                  cargo = toolchain;
+                };
+              };
             };
           };
-          packages = rec {
-            default = jrsonnet;
-
-            jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {
-              inherit craneLib;
-            };
-            jrsonnet-experimental = pkgs.callPackage ./nix/jrsonnet.nix {
-              inherit craneLib;
-              withExperimentalFeatures = true;
-            };
-
-            jrsonnet-release = pkgs.callPackage ./nix/jrsonnet-release.nix {
-              rustPlatform = pkgs.makeRustPlatform {
-                rustc = rust;
-                cargo = rust;
+          packages =
+            let
+              jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {
+                inherit craneLib;
               };
-            };
-
-            benchmarks = pkgs.callPackage ./nix/benchmarks.nix {
-              inherit (config.legacyPackages.jsonnetImpls)
-                go-jsonnet
-                sjsonnet
-                cpp-jsonnet
-                rsjsonnet
-                ;
-              jrsonnetVariants = [
-                {
-                  drv = jrsonnet.override { forBenchmarks = true; };
-                  name = "";
-                }
-              ];
+              jrsonnet-experimental = pkgs.callPackage ./nix/jrsonnet.nix {
+                inherit craneLib;
+                withExperimentalFeatures = true;
+              };
+            in
+            {
+              default = jrsonnet;
+              inherit jrsonnet jrsonnet-experimental;
             };
-            benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix {
-              inherit (config.legacyPackages.jsonnetImpls)
-                go-jsonnet
-                sjsonnet
-                cpp-jsonnet
-                rsjsonnet
-                ;
-              quick = true;
-              jrsonnetVariants = [
-                {
-                  drv = jrsonnet.override { forBenchmarks = true; };
-                  name = "";
-                }
-              ];
-            };
-            benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix {
-              inherit (config.legacyPackages.jsonnetImpls)
-                go-jsonnet
-                sjsonnet
-                cpp-jsonnet
-                rsjsonnet
-                ;
-              jrsonnetVariants = [
-                {
-                  drv = jrsonnet.override { forBenchmarks = true; };
-                  name = "current";
-                }
-                {
-                  drv = jrsonnet-experimental.override { forBenchmarks = true; };
-                  name = "current-experimental";
-                }
-                {
-                  drv = jrsonnet-release.override { forBenchmarks = true; };
-                  name = "release";
-                }
-              ];
-            };
-            benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {
-              inherit (config.legacyPackages.jsonnetImpls)
-                go-jsonnet
-                sjsonnet
-                cpp-jsonnet
-                rsjsonnet
-                ;
-              quick = true;
-              jrsonnetVariants = [
-                {
-                  drv = jrsonnet.override { forBenchmarks = true; };
-                  name = "current";
-                }
-                {
-                  drv = jrsonnet-experimental.override { forBenchmarks = true; };
-                  name = "current-experimental";
-                }
-                {
-                  drv = jrsonnet-release.override { forBenchmarks = true; };
-                  name = "release";
-                }
-              ];
-            };
+          checks = optionalAttrs (system != "armv7l-linux") {
+            formatting = treefmt.check inputs.self;
           };
+          formatter = mkIf (system != "armv7l-linux") treefmt.wrapper;
           shelly.shells.default = {
             factory = craneLib.devShell;
             packages =
@@ -158,11 +263,126 @@
                 hyperfine
                 graphviz
               ]
-              ++ lib.optionals (!stdenv.isDarwin) [
+              ++ optionals (!stdenv.isDarwin) [
                 valgrind
                 kdePackages.kcachegrind
               ];
           };
         };
+      hercules-ci.github-releases.files =
+        let
+          rel = system: inputs.self.legacyPackages.${system}.release;
+          bin = drv: "${drv}/bin/jrsonnet";
+          exe = drv: "${drv}/bin/jrsonnet.exe";
+        in
+        [
+          {
+            label = "jrsonnet-x86_64-linux-musl";
+            path = bin (rel "x86_64-linux").jrsonnet-linux-musl;
+          }
+          {
+            label = "jrsonnet-experimental-x86_64-linux-musl";
+            path = bin (rel "x86_64-linux").jrsonnet-experimental-linux-musl;
+          }
+          {
+            label = "jrsonnet-aarch64-darwin";
+            path = bin (rel "aarch64-linux").jrsonnet-darwin;
+          }
+          {
+            label = "jrsonnet-experimental-aarch64-darwin";
+            path = bin (rel "aarch64-linux").jrsonnet-experimental-darwin;
+          }
+          {
+            label = "jrsonnet-x86_64-windows.exe";
+            path = exe (rel "x86_64-linux").jrsonnet-windows;
+          }
+          {
+            label = "jrsonnet-experimental-x86_64-windows.exe";
+            path = exe (rel "x86_64-linux").jrsonnet-experimental-windows;
+          }
+
+          {
+            label = "jrsonnet-aarch64-linux-musl";
+            path = bin (rel "aarch64-linux").jrsonnet-linux-musl;
+          }
+          {
+            label = "jrsonnet-experimental-aarch64-linux-musl";
+            path = bin (rel "aarch64-linux").jrsonnet-experimental-linux-musl;
+          }
+
+          {
+            label = "jrsonnet-x86_64-linux-glibc";
+            path = bin (rel "x86_64-linux").jrsonnet-linux-glibc;
+          }
+          {
+            label = "jrsonnet-experimental-x86_64-linux-glibc";
+            path = bin (rel "x86_64-linux").jrsonnet-experimental-linux-glibc;
+          }
+          {
+            label = "jrsonnet-aarch64-linux-glibc";
+            path = bin (rel "aarch64-linux").jrsonnet-linux-glibc;
+          }
+          {
+            label = "jrsonnet-experimental-aarch64-linux-glibc";
+            path = bin (rel "aarch64-linux").jrsonnet-experimental-linux-glibc;
+          }
+          {
+            label = "jrsonnet-i686-linux-glibc";
+            path = bin (rel "i686-linux").jrsonnet-linux-glibc;
+          }
+          {
+            label = "jrsonnet-experimental-i686-linux-glibc";
+            path = bin (rel "i686-linux").jrsonnet-experimental-linux-glibc;
+          }
+          {
+            label = "jrsonnet-armv7l-linux-glibc";
+            path = bin (rel "armv7l-linux").jrsonnet-linux-glibc;
+          }
+          {
+            label = "jrsonnet-experimental-armv7l-linux-glibc";
+            path = bin (rel "armv7l-linux").jrsonnet-experimental-linux-glibc;
+          }
+        ];
+      hercules-ci.cargo-publish = {
+        enable = true;
+        secretName = "crates-io";
+      };
+      hercules-ci.flake-update = {
+        enable = true;
+        baseMerge.enable = true;
+        baseMerge.method = "fast-forward";
+        when = {
+          dayOfWeek = [ "Sat" ];
+        };
+      };
+      herculesCI =
+        { lib, config, ... }:
+        {
+          ciSystems = [
+            "x86_64-linux"
+            "i686-linux"
+            "aarch64-linux"
+            "armv7l-linux"
+            # TODO: add workers for these platforms
+            # "aarch64-darwin"
+          ];
+          onPush.default.outputs = {
+            benchmarks.x86_64-linux = inputs.self.legacyPackages.x86_64-linux.benchmarks.default;
+
+            # Cross: musl/mingw/darwin-zigbuild
+            release.x86_64-linux = inputs.self.legacyPackages.x86_64-linux.release;
+            release.aarch64-linux = inputs.self.legacyPackages.aarch64-linux.release;
+            release.armv7l-linux = inputs.self.legacyPackages.armv7l-linux.release;
+            release.i686-linux = inputs.self.legacyPackages.i686-linux.release;
+
+            # Too much to build for CI purposes
+            devShells = mkForce { };
+            formatter = mkForce { };
+
+            # No need to run them on different arch, pretty large derivations and might try to compile GHC
+            checks.i686-linux.formatting = mkForce { };
+            checks.aarch64-linux.formatting = mkForce { };
+          };
+        };
     };
 }
modifiednix/benchmarks.nixdiffbeforeafterboth
--- a/nix/benchmarks.nix
+++ b/nix/benchmarks.nix
@@ -53,7 +53,7 @@
 in
 stdenv.mkDerivation {
   name = "benchmarks";
-  __impure = true;
+  # __impure = true; # not supported by hercules-ci
   unpackPhase = "true";
 
   buildInputs = [
@@ -143,7 +143,9 @@
                 "\"sjsonnet-native $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"Scala (native)\""
             } \
             ${
-              optionalString (skipScala == "")
+              # My aarch64-linux machine can't run graalvm image:
+              # The current machine does not support all of the following CPU features that are required by the image: [FP, ASIMD, CRC32, LSE].
+              optionalString (skipScala == "" && stdenv.hostPlatform.system != "aarch64-linux")
                 "\"sjsonnet-graalvm $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"Scala (GraalVM)\""
             } \
             ${optionalString (skipCpp == "")
@@ -174,9 +176,14 @@
         echo "* C++: $(jsonnet --version)" >> $out
         echo "* Scala (native/GraalVM): $(sjsonnet-native 2>&1 | grep -oP 'Sjsonnet \S+')" >> $out
         echo "* Rust (alternative): rsjsonnet ${rsjsonnet.version} (${rsjsonnet.src.rev})" >> $out
-        ${concatStringsSep "\n" (forEach jrsonnetVariants (variant:
-          "echo \"* Rust${if variant.name != "" then " (${variant.name})" else ""}: $(${variant.drv}/bin/jrsonnet --version 2>&1)\" >> $out"
-        ))}
+        ${concatStringsSep "\n" (
+          forEach jrsonnetVariants (
+            variant:
+            "echo \"* Rust${
+              if variant.name != "" then " (${variant.name})" else ""
+            }: $(${variant.drv}/bin/jrsonnet --version 2>&1)\" >> $out"
+          )
+        )}
         echo "====" >> $out
         echo >> $out
       ''}
addednix/jrsonnet-cross-darwin.nixdiffbeforeafterboth
--- /dev/null
+++ b/nix/jrsonnet-cross-darwin.nix
@@ -0,0 +1,49 @@
+{
+  lib,
+  craneLib,
+  cargo-zigbuild,
+  zig,
+  darwin,
+  targetTriple,
+  withExperimentalFeatures ? false,
+}:
+let
+  inherit (lib) optionalString;
+in
+craneLib.buildPackage {
+  src = lib.cleanSourceWith {
+    src = ../.;
+    filter = path: type: (lib.hasSuffix ".jsonnet" path) || (craneLib.filterCargoSources path type);
+  };
+  pname = "jrsonnet";
+  version = "current${optionalString withExperimentalFeatures "-experimental"}";
+  strictDeps = true;
+
+  depsBuildBuild = [
+    zig
+    cargo-zigbuild
+  ];
+
+  nativeBuildInputs = [
+    darwin.xcode_12_2
+  ];
+
+  cargoExtraArgs = "-p jrsonnet";
+
+  buildPhaseCargoCommand = ''
+    export SDKROOT=${darwin.xcode_12_2}/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
+    export XDG_CACHE_HOME=$TMPDIR/xdg_cache
+    mkdir -p $XDG_CACHE_HOME
+    export CARGO_ZIGBUILD_CACHE_DIR=$TMPDIR/cargo-zigbuild-cache
+    mkdir -p $CARGO_ZIGBUILD_CACHE_DIR
+
+    HOME=$(mktemp -d)
+    cargo zigbuild --release --locked ${optionalString withExperimentalFeatures "--features=experimental"} --target=${targetTriple}
+  '';
+
+  doNotPostBuildInstallCargoBinaries = true;
+  installPhaseCommand = ''
+    mkdir -p $out/bin
+    cp target/${targetTriple}/release/jrsonnet $out/bin/jrsonnet
+  '';
+}
addednix/jrsonnet-cross-musl.nixdiffbeforeafterboth
--- /dev/null
+++ b/nix/jrsonnet-cross-musl.nix
@@ -0,0 +1,31 @@
+{
+  lib,
+  craneLib,
+  muslCC,
+  targetTriple,
+  withExperimentalFeatures ? false,
+}:
+let
+  targetEnv = builtins.replaceStrings [ "-" ] [ "_" ] targetTriple;
+  inherit (lib) optionalString;
+in
+craneLib.buildPackage {
+  src = lib.cleanSourceWith {
+    src = ../.;
+    filter = path: type: (lib.hasSuffix ".jsonnet" path) || (craneLib.filterCargoSources path type);
+  };
+  pname = "jrsonnet";
+  version = "current${optionalString withExperimentalFeatures "-experimental"}";
+  strictDeps = true;
+
+  cargoExtraArgs = "--locked --features=mimalloc${optionalString withExperimentalFeatures ",experimental"} --target=${targetTriple}";
+
+  "CC_${targetEnv}" = "${muslCC}/bin/${muslCC.targetPrefix}cc";
+  "CARGO_TARGET_${lib.toUpper targetEnv}_LINKER" = "${muslCC}/bin/${muslCC.targetPrefix}cc";
+
+  doNotPostBuildInstallCargoBinaries = true;
+  installPhaseCommand = ''
+    mkdir -p $out/bin
+    cp target/${targetTriple}/release/jrsonnet $out/bin/jrsonnet
+  '';
+}
addednix/jrsonnet-cross-windows.nixdiffbeforeafterboth
--- /dev/null
+++ b/nix/jrsonnet-cross-windows.nix
@@ -0,0 +1,26 @@
+{
+  lib,
+  craneLib,
+  targetTriple,
+  withExperimentalFeatures ? false,
+}:
+let
+  inherit (lib) optionalString;
+in
+craneLib.buildPackage {
+  src = lib.cleanSourceWith {
+    src = ../.;
+    filter = path: type: (lib.hasSuffix ".jsonnet" path) || (craneLib.filterCargoSources path type);
+  };
+  pname = "jrsonnet";
+  version = "current${optionalString withExperimentalFeatures "-experimental"}";
+  strictDeps = true;
+
+  cargoExtraArgs = "--locked ${optionalString withExperimentalFeatures "--features=experimental"} --target=${targetTriple}";
+
+  doNotPostBuildInstallCargoBinaries = true;
+  installPhaseCommand = ''
+    mkdir -p $out/bin
+    cp target/${targetTriple}/release/jrsonnet.exe $out/bin/jrsonnet.exe
+  '';
+}
modifiednix/jrsonnet-release.nixdiffbeforeafterboth
--- a/nix/jrsonnet-release.nix
+++ b/nix/jrsonnet-release.nix
@@ -18,10 +18,10 @@
   };
   cargoHash = "sha256-ZHmdlqakucapzXJz6L7ZJpmvqTutelN8qkWAD4uDJr8=";
 
-  cargoTestFlags = ["--package=jrsonnet --features=mimalloc,legacy-this-file"];
-  cargoBuildFlags = ["--package=jrsonnet --features=mimalloc,legacy-this-file"];
+  cargoTestFlags = [ "--package=jrsonnet --features=mimalloc,legacy-this-file" ];
+  cargoBuildFlags = [ "--package=jrsonnet --features=mimalloc,legacy-this-file" ];
 
-  buildInputs = [makeWrapper];
+  buildInputs = [ makeWrapper ];
 
   postInstall = ''
     wrapProgram $out/bin/jrsonnet --add-flags "--max-stack=200000"
modifiednix/jrsonnet.nixdiffbeforeafterboth
--- a/nix/jrsonnet.nix
+++ b/nix/jrsonnet.nix
@@ -5,23 +5,23 @@
   withExperimentalFeatures ? false,
   forBenchmarks ? false,
 }:
-with lib;
-  craneLib.buildPackage {
-    src = lib.cleanSourceWith {
-      src = ../.;
-      filter = path: type:
-        (lib.hasSuffix "\.jsonnet" path)
-        || (craneLib.filterCargoSources path type);
-    };
-    pname = "jrsonnet";
-    version = "current${optionalString withExperimentalFeatures "-experimental"}";
+let
+  inherit (lib) optionalString;
+in
+craneLib.buildPackage {
+  src = lib.cleanSourceWith {
+    src = ../.;
+    filter = path: type: (lib.hasSuffix "\.jsonnet" path) || (craneLib.filterCargoSources path type);
+  };
+  pname = "jrsonnet";
+  version = "current${optionalString withExperimentalFeatures "-experimental"}";
 
-    cargoExtraArgs = "--locked --features=mimalloc${optionalString withExperimentalFeatures ",experimental"}";
+  cargoExtraArgs = "--locked --features=mimalloc${optionalString withExperimentalFeatures ",experimental"}";
 
-    nativeBuildInputs = [makeWrapper];
+  nativeBuildInputs = [ makeWrapper ];
 
-    # To clean-up hyperfine output
-    postInstall = optionalString forBenchmarks ''
-      wrapProgram $out/bin/jrsonnet --add-flags "--max-stack=200000"
-    '';
-  }
+  # To clean-up hyperfine output
+  postInstall = optionalString forBenchmarks ''
+    wrapProgram $out/bin/jrsonnet --add-flags "--max-stack=200000"
+  '';
+}
modifiednix/rsjsonnet.nixdiffbeforeafterboth
--- a/nix/rsjsonnet.nix
+++ b/nix/rsjsonnet.nix
@@ -16,7 +16,7 @@
 
   cargoHash = "sha256-0IDAxm4J2rEqfUGNYoQTP0RPrEZe4YPe2E6TT7A4THo=";
 
-  nativeBuildInputs = [makeWrapper];
+  nativeBuildInputs = [ makeWrapper ];
 
   postInstall = ''
     wrapProgram $out/bin/rsjsonnet --add-flags "--max-stack=200000"
modifiednix/sjsonnet.nixdiffbeforeafterboth
--- a/nix/sjsonnet.nix
+++ b/nix/sjsonnet.nix
@@ -17,29 +17,35 @@
   version = "0.6.2";
   baseUrl = "https://github.com/databricks/sjsonnet/releases/download/${version}";
 
-  nativePlatform = {
-    x86_64-linux = "linux-x86_64";
-    aarch64-linux = "linux-arm64";
-    aarch64-darwin = "darwin-arm64";
-    # Nobody cares about darwin on intel
-  }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
+  nativePlatform =
+    {
+      x86_64-linux = "linux-x86_64";
+      aarch64-linux = "linux-arm64";
+      aarch64-darwin = "darwin-arm64";
+      # Nobody cares about darwin on intel
+    }
+    .${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
 
   nativeSrc = fetchurl {
     url = "${baseUrl}/sjsonnet-${version}-${nativePlatform}";
-    hash = {
-      x86_64-linux = "sha256-r79Q6SovcPIomDDUYTGIP35/y5t9Xo5Z3ohP7pxsF8I=";
-      aarch64-linux = "sha256-LxWR94u1Oncau57Kmtzj2UFEofWGT4+laDTbRDkwv08=";
-      aarch64-darwin = "sha256-gNZ6XekMm+ebeD7UFeRfoapXw/90gHk8MoeGD86dzKk=";
-    }.${stdenv.hostPlatform.system};
+    hash =
+      {
+        x86_64-linux = "sha256-r79Q6SovcPIomDDUYTGIP35/y5t9Xo5Z3ohP7pxsF8I=";
+        aarch64-linux = "sha256-LxWR94u1Oncau57Kmtzj2UFEofWGT4+laDTbRDkwv08=";
+        aarch64-darwin = "sha256-gNZ6XekMm+ebeD7UFeRfoapXw/90gHk8MoeGD86dzKk=";
+      }
+      .${stdenv.hostPlatform.system};
   };
 
   graalvmSrc = fetchurl {
     url = "${baseUrl}/sjsonnet-graalvm-${version}-${nativePlatform}";
-    hash = {
-      x86_64-linux = "sha256-XNJCnQlwVFySrUevn1nLN/DY8UBGgvCFAitkedLB+yM=";
-      aarch64-linux = "sha256-J+C3pmiBEmo8M00IDHp9jznonibXmHVRlhsvQ4apVWw=";
-      aarch64-darwin = "sha256-TXNL52sS4NE3GjbOFtgf6aCP268qGKMFaoTwAfJfgGc=";
-    }.${stdenv.hostPlatform.system};
+    hash =
+      {
+        x86_64-linux = "sha256-XNJCnQlwVFySrUevn1nLN/DY8UBGgvCFAitkedLB+yM=";
+        aarch64-linux = "sha256-J+C3pmiBEmo8M00IDHp9jznonibXmHVRlhsvQ4apVWw=";
+        aarch64-darwin = "sha256-TXNL52sS4NE3GjbOFtgf6aCP268qGKMFaoTwAfJfgGc=";
+      }
+      .${stdenv.hostPlatform.system};
   };
 in
 stdenv.mkDerivation {
@@ -52,10 +58,18 @@
   };
 
   unpackPhase = "true";
-  nativeBuildInputs = [ makeWrapper ]
-    ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
-  buildInputs = [ java ]
-    ++ lib.optionals stdenv.hostPlatform.isLinux [ zlib openssl stdenv.cc.cc.lib ];
+  nativeBuildInputs = [
+    makeWrapper
+  ]
+  ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
+  buildInputs = [
+    java
+  ]
+  ++ lib.optionals stdenv.hostPlatform.isLinux [
+    zlib
+    openssl
+    stdenv.cc.cc.lib
+  ];
 
   installPhase = ''
     mkdir -p $out/bin $out/lib
modifiedrust-toolchain.tomldiffbeforeafterboth
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
 [toolchain]
-channel = "1.93.0"
+channel = "stable"
 components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]
addedtreefmt.nixdiffbeforeafterboth
--- /dev/null
+++ b/treefmt.nix
@@ -0,0 +1,14 @@
+{ rustfmt }:
+{
+  settings.global.excludes = [
+    "*.jsonnet"
+    "*.libsonnet"
+  ];
+
+  programs.nixfmt.enable = true;
+  programs.rustfmt = {
+    enable = true;
+    package = rustfmt;
+  };
+  programs.taplo.enable = true;
+}
modifiedxtask/Cargo.tomldiffbeforeafterboth
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -16,4 +16,4 @@
 quote.workspace = true
 ungrammar.workspace = true
 xshell.workspace = true
-clap = {workspace = true, features = ["derive"]}
+clap = { workspace = true, features = ["derive"] }
modifiedxtask/src/main.rsdiffbeforeafterboth
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1,6 +1,6 @@
 use anyhow::Result;
 use clap::Parser;
-use xshell::{cmd, Shell};
+use xshell::{Shell, cmd};
 
 mod sourcegen;
 
@@ -68,7 +68,11 @@
 			if cachegrind {
 				let mut cachegrind_out = out.path().to_owned();
 				cachegrind_out.push("cachegrind.out.1");
-				cmd!(sh, "valgrind --tool=cachegrind --cachegrind-out-file={cachegrind_out} {built} {args...}").run()?;
+				cmd!(
+					sh,
+					"valgrind --tool=cachegrind --cachegrind-out-file={cachegrind_out} {built} {args...}"
+				)
+				.run()?;
 				cmd!(sh, "kcachegrind {cachegrind_out}").run()?;
 			}
 
modifiedxtask/src/sourcegen/ast.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/ast.rs
+++ b/xtask/src/sourcegen/ast.rs
@@ -5,8 +5,8 @@
 use ungrammar::{Grammar, Rule};
 
 use super::{
+	KindsSrc,
 	util::{pluralize, to_lower_snake_case},
-	KindsSrc,
 };
 
 impl AstNodeSrc {
@@ -282,9 +282,11 @@
 		_ => return false,
 	};
 	let (node, repeat, trailing_comma) = match rule.as_slice() {
-		[Rule::Node(node), Rule::Rep(repeat), Rule::Opt(trailing_comma)] => {
-			(node, repeat, trailing_comma)
-		}
+		[
+			Rule::Node(node),
+			Rule::Rep(repeat),
+			Rule::Opt(trailing_comma),
+		] => (node, repeat, trailing_comma),
 		_ => return false,
 	};
 	let repeat = match &**repeat {
modifiedxtask/src/sourcegen/mod.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/mod.rs
+++ b/xtask/src/sourcegen/mod.rs
@@ -1,7 +1,7 @@
 use std::{collections::HashMap, path::PathBuf};
 
 use anyhow::Result;
-use ast::{lower, AstSrc};
+use ast::{AstSrc, lower};
 use itertools::Itertools;
 use kinds::{KindsSrc, TokenKind};
 use proc_macro2::{Ident, Punct, Spacing, Span, TokenStream};
@@ -56,7 +56,9 @@
 						});
 					}
 					SpecialName::Error => {
-						panic!("error token ERROR_{name} must be explicitly defined in jsonnet_kinds()");
+						panic!(
+							"error token ERROR_{name} must be explicitly defined in jsonnet_kinds()"
+						);
 					}
 				}
 				continue;
modifiedxtask/src/sourcegen/util.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/util.rs
+++ b/xtask/src/sourcegen/util.rs
@@ -3,7 +3,7 @@
 use std::{fs, path::Path};
 
 use anyhow::Result;
-use xshell::{cmd, Shell};
+use xshell::{Shell, cmd};
 
 /// Checks that the `file` has the specified `contents`. If that is not the
 /// case, updates the file and then fails the test.