Field is never used: `name`

why rust consider the name field is never used?

That's because to_string in line 9 is never used as well.

3 Likes

Tangentially, consider implementing Display instead of writing an inherent to_string method. Types that implement Display get ToString for free, and you can also use them in format!/print!-like macros with the {} format specifier.

3 Likes

i see, thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.