bevy_lint/lints/suspicious/
mod.rs

1//! Lints that checks for suspicious, potentially incorrect code.
2//!
3//! Unlike [`correctness`](super::correctness) lints, these may have false positives that you need
4//! to `#[allow(...)]`.
5//!
6//! These lints are **warn** by default.
7
8use rustc_lint::{Level, Lint, LintStore};
9
10use crate::lint::LintGroup;
11
12pub mod insert_event_resource;
13pub mod iter_current_update_events;
14pub mod unit_in_bundle;
15
16pub(crate) struct Suspicious;
17
18impl LintGroup for Suspicious {
19    const NAME: &str = "bevy::suspicious";
20    const LEVEL: Level = Level::Warn;
21    const LINTS: &[&Lint] = &[
22        insert_event_resource::INSERT_EVENT_RESOURCE,
23        iter_current_update_events::ITER_CURRENT_UPDATE_EVENTS,
24        unit_in_bundle::UNIT_IN_BUNDLE,
25    ];
26
27    fn register_passes(store: &mut LintStore) {
28        store.register_late_pass(|_| Box::new(insert_event_resource::InsertEventResource));
29        store.register_late_pass(|_| Box::new(iter_current_update_events::IterCurrentUpdateEvents));
30        store.register_late_pass(|_| Box::new(unit_in_bundle::UnitInBundle));
31    }
32
33    fn register_lints(store: &mut LintStore) {
34        store.register_lints(Self::LINTS);
35
36        // This helps users migrate to v0.4.0, but should be removed before v0.5.0 is released.
37        store.register_renamed("bevy::insert_unit_bundle", "bevy::unit_in_bundle");
38    }
39}