From 5373f4020881d543466c5bbff9afcafd1aecbdba Mon Sep 17 00:00:00 2001 From: Kevin Amado Date: Fri, 18 Feb 2022 17:43:38 -0500 Subject: [PATCH] fix: idiom pkgs --- src/rules/lambda.rs | 2 +- tests/cases/idioms/in | 13 +------------ tests/cases/idioms/out | 32 ++++++++------------------------ tests/cases/idioms_pkgs_1/in | 13 +++++++++++++ tests/cases/idioms_pkgs_1/out | 17 +++++++++++++++++ 5 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 tests/cases/idioms_pkgs_1/in create mode 100644 tests/cases/idioms_pkgs_1/out diff --git a/src/rules/lambda.rs b/src/rules/lambda.rs index b2aab3e..79d5dab 100644 --- a/src/rules/lambda.rs +++ b/src/rules/lambda.rs @@ -83,7 +83,7 @@ pub fn rule( | rnix::SyntaxKind::NODE_LET_IN | rnix::SyntaxKind::NODE_LIST | rnix::SyntaxKind::NODE_STRING - ); + ) && build_ctx.pos_new.column > 1; if should_indent { steps.push_back(crate::builder::Step::Indent); diff --git a/tests/cases/idioms/in b/tests/cases/idioms/in index f8158f6..26490c4 100644 --- a/tests/cases/idioms/in +++ b/tests/cases/idioms/in @@ -1,17 +1,6 @@ [ { meta = with lib; { a=1; b=2; c=3; };} - {stdenv, lib, fetchFrom, ... }: - stdenv.mkDerivation rec { - pname = "test"; - version = "0.0"; - src = fetchFrom { - url = "example/${version}"; - }; - meta = with lib; { - maintainers = with maintainers; [ someone ]; - description = "something"; - }; - } + { meta = with lib; # comment { a=1; b=2; c=3; };} diff --git a/tests/cases/idioms/out b/tests/cases/idioms/out index 78dd934..faed7b0 100644 --- a/tests/cases/idioms/out +++ b/tests/cases/idioms/out @@ -6,30 +6,14 @@ c = 3; }; } + { - stdenv, - lib, - fetchFrom, - ... - }: - stdenv.mkDerivation rec { - pname = "test"; - version = "0.0"; - src = fetchFrom { - url = "example/${version}"; + meta = with lib; + # comment + { + a = 1; + b = 2; + c = 3; }; - meta = with lib; { - maintainers = with maintainers; [someone]; - description = "something"; - }; - } - { - meta = with lib; - # comment - { - a = 1; - b = 2; - c = 3; - }; - } + } ] diff --git a/tests/cases/idioms_pkgs_1/in b/tests/cases/idioms_pkgs_1/in new file mode 100644 index 0000000..777f1d2 --- /dev/null +++ b/tests/cases/idioms_pkgs_1/in @@ -0,0 +1,13 @@ +{stdenv, lib, fetchFrom, ... }: + +stdenv.mkDerivation rec { + pname = "test"; + version = "0.0"; + src = fetchFrom { + url = "example/${version}"; + }; + meta = with lib; { + maintainers = with maintainers; [ someone ]; + description = "something"; + }; +} diff --git a/tests/cases/idioms_pkgs_1/out b/tests/cases/idioms_pkgs_1/out new file mode 100644 index 0000000..dbee48d --- /dev/null +++ b/tests/cases/idioms_pkgs_1/out @@ -0,0 +1,17 @@ +{ + stdenv, + lib, + fetchFrom, + ... +}: +stdenv.mkDerivation rec { + pname = "test"; + version = "0.0"; + src = fetchFrom { + url = "example/${version}"; + }; + meta = with lib; { + maintainers = with maintainers; [someone]; + description = "something"; + }; +}