mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
795 stars 44 forks source link

Many clippy warnings when running on code containing `cpp!` macro #99

Closed hunger closed 2 years ago

hunger commented 2 years ago

I noticed lots of warnings about turning a number into a sequence of bytes (clippy::transmute_num_to_bytes) when running clippy over some of our code that uses the cpp! macro.

Does it make sense to automatically suppress this warning in the code created by your macro?

If this is a sensible suggestion and it is not just a trivial fix for you, then I can help to implement this:-)

ogoffart commented 2 years ago

This is probably an warning that comes from our check that the size and alignment are matching. With latest rust version, it is probably possible to use const variable to simulate static_assert, instead of the trick we use. But if not, we should indeed try to make sure that the macro don't generate clippy warning and we should clean it.