-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Array of Tables inlined by default when using to_string_pretty #662
Comments
I'm somehow overlooking where it says that.
Currently, we don't do very deep introspection for our formatting choices. Not too keen to do so now, especially since we offer |
It just suggests it indeed. My point is just that is my sens, it's more "pretty" to write
instead of
so it should be made the default. Maybe based only on the number of fields, as i said. |
Could you quote or screenshot the section? The anchor provided was for file extensions. Just above that I see a reference comparing the two but it only says "You may also use inline tables where appropriate" which does not say one is preferred over the other. As for which is "prettier", a lot of that comes down to the person and the use case. |
That seems like a suggestion to me. That why in my sens, this crate should try to define "appropriate" and use inline table when it make sens.
Agreed but in this case, we can clearly see that one use 4 lines and the other 7. Also, In terms of Rust code, is feel intuitive to write it this way: struct Wrapper {
coords: Vec<Coord>, // notice the 's'
} and then have: # this is intuitive
coords = [
{ x = 1, y = 2 },
{ x = 3, y = 4 },
] # defining multiple time coords with an 's' seems odd to me
[[coords]]
x = 1
y = 2
[[coords]]
x = 3
y = 4 But that debatable. |
I would re-phrase that line as "as an alternative, you can also use inline tables where it makes sense". That is very different than "you should prefer inline tables where appropriate" To put this in context, things the TOML spec discourages
|
I would expect to be the case because the docs says it is the preferred way when appropriate: https://toml.io/en/v1.0.0#filename-extension.
I guess what they mean by that, is when the table has not to many fields or when the lines don't get to long.
The text was updated successfully, but these errors were encountered: