Skip to content
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

enumerate_arrays doesn't annotate last item in array and comments are badly placed #289

Closed
Boscop opened this issue Dec 6, 2020 · 1 comment · Fixed by #344
Closed
Labels

Comments

@Boscop
Copy link

Boscop commented Dec 6, 2020

https://docs.rs/ron/0.6.2/ron/ser/struct.PrettyConfig.html

enumerate_arrays doesn't annotate last item in array:

(
    tags: [
        "asd",// [0]
        "4k",// [1]
        "foo",// [2]
        "bar",// [3]
        "2020",
    ],
    inputs: {
        BufferA: [
            None,// [0]
            None,// [1]
            None,// [2]
            None,
        ],
        Image: [
            Some((
                asset: Misc(Buffer),
                sampler: (filter:mipmap,wrap:clamp,vflip:true),
            )),// [0]
            None,// [1]
            None,// [2]
            Some((
                asset: Misc(Stream),
                sampler: (filter:linear,wrap:clamp,vflip:true),
            )),
        ],
        BufferB: [
            Some((
                asset: Misc(Buffer),
                sampler: (filter:linear,wrap:clamp,vflip:true),
            )),// [0]
            None,// [1]
            None,// [2]
            None,
        ],
        Common: [
            None,// [0]
            None,// [1]
            None,// [2]
            None,
        ],
    },
)

Putting the comment after each item looks weird, especially with large items that span multiple lines.
This part looks very weird:

            Some((
                asset: Misc(Buffer),
                sampler: (filter:mipmap,wrap:clamp,vflip:true),
            )),// [0]
            None,// [1]

Also, it looks weird that there is no space between each item and //.

I suggest putting the comment before each item, so that they are at the same indentation level (thus visually easier to scan), like this:

        Image: [
            // [0]
            Some((
                asset: Misc(Buffer),
                sampler: (filter:mipmap,wrap:clamp,vflip:true),
            )),
            // [1]
            None,
            // [2]
            None,
            // [3]
            Some((
                asset: Misc(Stream),
                sampler: (filter:linear,wrap:clamp,vflip:true),
            )),
        ],
@kvark
Copy link
Collaborator

kvark commented Dec 9, 2020

Oh snap, that's a bug. Thank you for filing!

@kvark kvark added the bug label Dec 9, 2020
juntyr added a commit to juntyr/ron that referenced this issue Nov 22, 2021
juntyr added a commit that referenced this issue Nov 22, 2021
torkleyy pushed a commit to torkleyy/ron that referenced this issue Jun 6, 2022
@torkleyy torkleyy mentioned this issue Jun 6, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants