bevy_lint/lints/restriction/
mod.rs

1//! Opt-in lints that restrict you from writing certain code patterns.
2//!
3//! These are designed for scenarios where you want to increase the consistency of your project by
4//! rejecting certain patterns. These lints should not all be enabled as a group, but instead
5//! should be chosen individually after reading the documentation.
6//!
7//! These lints are **allow** by default.
8
9use rustc_lint::{Level, Lint, LintStore};
10
11use crate::lint::LintGroup;
12
13pub mod missing_reflect;
14pub mod missing_trait_for_unit_struct;
15pub mod panicking_methods;
16pub mod schedule;
17
18pub(crate) struct Restriction;
19
20impl LintGroup for Restriction {
21    const NAME: &str = "bevy::restriction";
22    const LEVEL: Level = Level::Allow;
23    const LINTS: &[&Lint] = &[
24        missing_reflect::MISSING_REFLECT,
25        missing_trait_for_unit_struct::MISSING_CLONE,
26        missing_trait_for_unit_struct::MISSING_COPY,
27        missing_trait_for_unit_struct::MISSING_DEFAULT,
28        panicking_methods::PANICKING_METHODS,
29        schedule::FIXED_UPDATE_SCHEDULE,
30        schedule::UPDATE_SCHEDULE,
31    ];
32
33    fn register_passes(store: &mut LintStore) {
34        store.register_late_pass(|_| Box::new(missing_reflect::MissingReflect));
35        store.register_late_pass(|_| {
36            Box::new(missing_trait_for_unit_struct::MissingTraitForUnitStruct)
37        });
38        store.register_late_pass(|_| Box::new(panicking_methods::PanickingMethods));
39        store.register_late_pass(|_| Box::new(schedule::Schedule));
40    }
41}