doc: tweak the coding conventions (#51113)
Encouraging to put container elements on their own lines to minimize diffs, merge conflicts and making re-ordering easier. Nix doesn't suffer the restrictions of other languages where commas are used to separate list items.
This commit is contained in:
parent
63c7ed9788
commit
064bd03b8c
1 changed files with 17 additions and 12 deletions
|
@ -56,25 +56,30 @@ foo { arg = ...; }
|
||||||
or list elements should be aligned:
|
or list elements should be aligned:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
# A long list.
|
# A long list.
|
||||||
list =
|
list = [
|
||||||
[ elem1
|
elem1
|
||||||
elem2
|
elem2
|
||||||
elem3
|
elem3
|
||||||
];
|
];
|
||||||
|
|
||||||
# A long attribute set.
|
# A long attribute set.
|
||||||
attrs =
|
|
||||||
{ attr1 = short_expr;
|
|
||||||
attr2 =
|
|
||||||
if true then big_expr else big_expr;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Alternatively:
|
|
||||||
attrs = {
|
attrs = {
|
||||||
attr1 = short_expr;
|
attr1 = short_expr;
|
||||||
attr2 =
|
attr2 =
|
||||||
if true then big_expr else big_expr;
|
if true then big_expr else big_expr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Combined
|
||||||
|
listOfAttrs = [
|
||||||
|
{
|
||||||
|
attr1 = 3;
|
||||||
|
attr2 = "fff";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
attr1 = 5;
|
||||||
|
attr2 = "ggg";
|
||||||
|
}
|
||||||
|
];
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
Loading…
Reference in a new issue