Skip to content

Commit 61ff811

Browse files
committed
refactor: reuse parens on string interpol
1 parent a15388c commit 61ff811

File tree

5 files changed

+5
-72
lines changed

5 files changed

+5
-72
lines changed

src/alejandra_engine/src/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn format(
188188
rnix::SyntaxKind::NODE_STRING => crate::rules::string::rule,
189189
// ${a}
190190
rnix::SyntaxKind::NODE_STRING_INTERPOL => {
191-
crate::rules::string_interpol::rule
191+
crate::rules::paren::rule
192192
}
193193
// !a
194194
rnix::SyntaxKind::NODE_UNARY_OP => crate::rules::default,

src/alejandra_engine/src/rules/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub(crate) mod root;
1616
pub(crate) mod scoped;
1717
pub(crate) mod select;
1818
pub(crate) mod string;
19-
pub(crate) mod string_interpol;
2019

2120
pub(crate) fn default(
2221
_: &crate::builder::BuildCtx,

src/alejandra_engine/src/rules/string_interpol.rs

-60
This file was deleted.

src/alejandra_engine/tests/cases/apply/out

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
*/
2323
))
2424
''
25-
otherModules=${
26-
pkgs.writeText "other-modules.json"
25+
otherModules=${pkgs.writeText "other-modules.json"
2726
(l.toJSON
2827
(l.mapAttrs
2928
(pname: subOutputs: let
@@ -32,8 +31,7 @@
3231
installMethod = "copy";
3332
});
3433
in "${pkg}/lib/node_modules/${pname}/node_modules")
35-
outputs.subPackages))
36-
}
34+
outputs.subPackages))}
3735
''
3836
{
3937
name1 =

src/alejandra_engine/tests/cases/string/out

+2-6
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,8 @@
8484
</plist>''
8585

8686
''
87-
--${
88-
"test"
89-
}
87+
--${"test"}
9088
''
9189

92-
"--${
93-
"test"
94-
}"
90+
"--${"test"}"
9591
]

0 commit comments

Comments
 (0)