Skip to content

Conversation

@Fuuzetsu
Copy link
Contributor

The indentantion in case of structs inside the
arrays was wrong with pretty debug instance.
Instead of rolling one by hand, just use the
underlying slice implementation. It appears that
this was even the intention orginally, based on
the TinyVec_pretty_debug test. The main issue is that the test used a simple value instead of a
struct so it missed the problem. FWIW I have kept
the existing test but I think it could just be
deleted now.

I haven't touched the Display version because
while slices have a Debug impl, there isn't one
for Display. So I think probably Display has
the same problem.

These tests can technically be written in a
non-alloc/non-std way by defining an array-backed
buffer and giving it core::fmt::Write but I was
too lazy to do so: it doesn't seem useful.

Fixes #192.

The indentantion in case of structs inside the
arrays was wrong with pretty debug instance.
Instead of rolling one by hand, just use the
underlying slice implementation. It appears that
this was even the intention orginally, based on
the `TinyVec_pretty_debug` test. The main issue is
that the test used a simple value instead of a
struct so it missed the problem. FWIW I have kept
the existing test but I think it could just be
deleted now.

I haven't touched the `Display` version because
while slices have a `Debug` impl, there isn't one
for `Display`. So I think probably `Display` has
the same problem.

These tests can technically be written in a
non-alloc/non-std way by defining an array-backed
buffer and giving it `core::fmt::Write` but I was
too lazy to do so: it doesn't seem useful.

Fixes Lokathor#192.
@Lokathor Lokathor merged commit a6db082 into Lokathor:main Dec 19, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incorrect indent for dbg!(tiny_vec)

2 participants