mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.37k stars 305 forks source link

Honor cbindgen:ignore directives for associated functions and constants #949

Closed scovich closed 4 months ago

scovich commented 5 months ago

Fix for https://github.com/mozilla/cbindgen/issues/947

Add missing checks so that cbindgen honors cbindgen:ignore directives for associated functions and constants declared inside a struct impl.

scovich commented 5 months ago

The clippy failures all seem to be in code this PR didn't touch, e.g.

error: assigning the result of `ToOwned::to_owned()` may be inefficient
   --> src/bindgen/ir/constant.rs:135:21
    |
135 |                     *export_name = self_ty.name().to_owned();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `self_ty.name().clone_into(export_name)`

Is that expected?

emilio commented 4 months ago

No, not your fault. I fixed those issues in master, should be good to go. Thanks for the fix!