What problem does this solve or what need does it fill?
Code like this will not trigger unit_in_bundle:
fn bundle_in_array<B: Bundle>(array: [B; 2]) {
// ...
}
fn main() {
// No lint triggered here because we're not passing a bundle, but an array of bundles,
// to the function.
bundle_in_array([(), ()]);
}
This is because array is an array type, not a B: Bundle type, so the lint skips it. Code like this as well:
fn spawn_batch<I>(_batch: I)
where
I: IntoIterator + Send + Sync + 'static,
I::Item: Bundle<Effect: NoBundleEffect>,
{
}
fn main() {
let _ = spawn_batch(std::iter::once(()));
}
What solution would you like?
unit_in_bundle should inspect the generic parameters of types within the function signature, and use that to look for bundles as well.
What alternative(s) have you considered?
The current solution catches most cases. This feels like a "nice-to-have" feature, as I'm not sure how strong the need is.
Additional context
Raised as part of the #659 review.
What problem does this solve or what need does it fill?
Code like this will not trigger
unit_in_bundle:This is because
arrayis an array type, not aB: Bundletype, so the lint skips it. Code like this as well:What solution would you like?
unit_in_bundleshould inspect the generic parameters of types within the function signature, and use that to look for bundles as well.What alternative(s) have you considered?
The current solution catches most cases. This feels like a "nice-to-have" feature, as I'm not sure how strong the need is.
Additional context
Raised as part of the #659 review.