astro/deadnix

Incorrect formatting when removing let binding

siraben opened this issue · 2 comments

While testing NixOS/nixpkgs#149892, the following file pkgs/pkgs-lib/tests/default.nix gets formatted incorrectly:

# Call nix-build on this file to run all tests in this directory
{ pkgs ? import ../../.. {} }:
let
  formats = import ./formats.nix { inherit pkgs; };
in pkgs.linkFarm "nixpkgs-pkgs-lib-tests" [
  { name = "formats"; path = import ./formats.nix { inherit pkgs; }; }
]

deadnix produces

# Call nix-build on this file to run all tests in this directory
{ pkgs ? import ../../.. {} }:pkgs.linkFarm "nixpkgs-pkgs-lib-tests" [
  { name = "formats"; path = import ./formats.nix { inherit pkgs; }; }
]

while maybe something like this is more appropriate

# Call nix-build on this file to run all tests in this directory
{ pkgs ? import ../../.. {} }:
pkgs.linkFarm "nixpkgs-pkgs-lib-tests" [
  { name = "formats"; path = import ./formats.nix { inherit pkgs; }; }
]
astro commented

very interesting, thank you for reporting.

astro commented

fixed and released in 0.1.2