![](/style/images/good.png)
![](/style/images/bad.png)
Warn on structs with a trailing zero-sized array but no `repr` attribute by nham...
source link: https://github.com/rust-lang/rust-clippy/pull/7838
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Closes #2868
changelog: Implement [`trailing_empty_array`]
, which warns if a struct is defined where the last field is a zero-sized array but there are no repr
attributes. Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters. Either way, a repr
attribute is needed.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK