You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add option for block indentation of array literals #574
-static ERROR_FORMAT_STRING_STRING: [libc::c_char; 4] = [- '{' as libc::c_char,- '0' as libc::c_char,- '}' as libc::c_char,- 0 as libc::c_char,-];+static ERROR_FORMAT_STRING_STRING: [libc::c_char; 4] = ['{' as libc::c_char,+ '0' as libc::c_char,+ '}' as libc::c_char,+ 0 as libc::c_char];
Looks OK to me - it's consistent with how we would format shorter arrays or functions, etc. Even if we did prefer this style here (I can sympathise that the large block of whitespace is sub-optimal) it's hard to imagine how you would choose between visual and block indent.
We should have an option for this I guess (since we do for most other places where you could choose either way). Changing the title accordingly.
consistent with how we would format shorter arrays or functions, etc
But not consistent with the initialization of structs.
The current output might work with short variable names, short type signatures and few array items. Once any of these get larger, the formatting becomes problematic. Think of cryptographic algorithms where you have to declare large blocks of 64 bit constants. With one item per line almost flushed to the right, the source code will look very strange.
Activity
nrc commentedon Nov 9, 2015
Looks OK to me - it's consistent with how we would format shorter arrays or functions, etc. Even if we did prefer this style here (I can sympathise that the large block of whitespace is sub-optimal) it's hard to imagine how you would choose between visual and block indent.
We should have an option for this I guess (since we do for most other places where you could choose either way). Changing the title accordingly.
[-]Poor formatting of multiline arrays[/-][+]Add option for block indentation of array literals[/+]slyrz commentedon Nov 24, 2015
But not consistent with the initialization of structs.
The current output might work with short variable names, short type signatures and few array items. Once any of these get larger, the formatting becomes problematic. Think of cryptographic algorithms where you have to declare large blocks of 64 bit constants. With one item per line almost flushed to the right, the source code will look very strange.
hsivonen commentedon Jan 11, 2016
I suggest adding a line break after
[in large array literals. Example of non-ideal formatting.marcusklaas commentedon May 13, 2016
This was addressed in #893.