yew icon indicating copy to clipboard operation
yew copied to clipboard

Feature soundness is a chore to deal with

Open WorldSEnder opened this issue 3 years ago • 3 comments

Problem The feature soundness lints are useful but clippy is not very helpful when determining the correct visibilities and features. At least sometimes I don't understand immediately why clippy is allowing some things but not others. Take for example this clippy run. It complains about a function that is apparently never used, but it is used, just in a module that happens to have a cfg(any(feature = "csr", feature = "ssr")) annotation somewhere further up in the module hierarchy. It's a pain to figure that out, since the tooling doesn't help much in reasoning why the function is unused.

Expected behavior A clear module tree and feature dependencies. When searching cfg(feature, I get 168 results across the code base. That's too many to reasonably figure out which impact what part.

Questionnaire

  • [x] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

WorldSEnder avatar Apr 26 '22 14:04 WorldSEnder

cargo hack may be helpful here

ranile avatar Apr 26 '22 14:04 ranile

This is unfortunate, but not that clippy is wrong in any way.

When clippy runs with a certain feature flag, it treats all code that is flagged as inactive as if they are not there. This is needed because compiler flag can be used to feature gate conflicting code.

This simply means that anything that is only used by code marked with a certain compiler flag should also be marked with the same flag.

futursolo avatar Apr 28 '22 13:04 futursolo

Cargo hack can definitely be recommended but otherwise I agree with OP

pseacrest avatar May 02 '22 19:05 pseacrest