Skip to main content

cargo_modernize_catalog/
lib.rs

1//! Self-contained embedded release inventories, precomputed static inventory & rule passport tables,
2//! re-export mappings, triage records, manifest/text rules, and fixtures for `cargo-modernize`.
3#![no_std]
4
5#[derive(Debug, Clone, Copy)]
6pub struct PrecomputedInventoryItem {
7    pub item_kind: &'static str,
8    pub family: Option<&'static str>,
9    pub paths: &'static [&'static str],
10    pub trait_ref: Option<&'static str>,
11    pub self_types: &'static [&'static str],
12    pub where_bounds: Option<&'static str>,
13    pub previously_in: Option<&'static str>,
14    pub previous_since: Option<(u32, u32)>,
15    pub reexport_of: Option<&'static str>,
16    pub is_prelude: Option<bool>,
17    pub signature: Option<&'static str>,
18    pub before_signature: Option<&'static str>,
19    pub after_signature: Option<&'static str>,
20    pub body: Option<&'static str>,
21    pub methods: &'static [&'static str],
22    pub docs_url: Option<&'static str>,
23}
24
25#[derive(Debug, Clone, Copy)]
26pub struct PrecomputedInventoryEntry {
27    pub id: &'static str,
28    pub kind: &'static str,
29    pub feature: Option<&'static str>,
30    pub since: (u32, u32),
31    pub const_since: Option<(u32, u32)>,
32    pub available_in: Option<&'static str>,
33    pub triage_hint: Option<&'static str>,
34    pub clippy_msrvs: &'static [&'static str],
35    pub section: Option<&'static str>,
36    pub summary: Option<&'static str>,
37    pub pr_url: Option<&'static str>,
38    pub items: &'static [PrecomputedInventoryItem],
39}
40
41#[derive(Debug, Clone, Copy)]
42pub struct PrecomputedEditionEntry {
43    pub edition: &'static str,
44    pub rust_version: (u32, u32),
45    pub id: &'static str,
46    pub category: &'static str,
47    pub title: &'static str,
48    pub chapter_path: &'static str,
49    pub lang_features: &'static [&'static str],
50    pub summary: &'static str,
51    pub docs_url: &'static str,
52    pub triage_hint: Option<&'static str>,
53}
54
55#[derive(Debug, Clone, Copy)]
56pub struct PrecomputedBehaviorClasses {
57    pub evaluation: &'static str,
58    pub drop_order: &'static str,
59    pub panic_overflow: &'static str,
60    pub evaluation_count: &'static str,
61    pub type_inference: &'static str,
62    pub const_eval: &'static str,
63}
64
65#[derive(Debug, Clone, Copy)]
66pub enum PrecomputedBehavior {
67    None,
68    Classes(PrecomputedBehaviorClasses),
69}
70
71#[derive(Debug, Clone, Copy)]
72pub struct PrecomputedClippyLint {
73    pub name: &'static str,
74    pub relation: &'static str,
75}
76
77/// Declarative rule passport precompiled from `catalog/entries/**/*.toml`.
78/// Covers 100% of `C1`, `C3`, and `C4` knowledge entries for `guidelines list`, `explain`,
79/// `export-clippy-candidates`, and CST rule binding.
80#[derive(Debug, Clone, Copy)]
81pub struct PrecomputedRuleEntry {
82    pub id: &'static str,
83    pub aliases: &'static [&'static str],
84    pub class: &'static str,
85    pub impact: &'static str,
86    pub track: &'static str,
87    pub summary: &'static str,
88    pub message: &'static str,
89    pub requires: &'static [&'static str],
90    pub requires_dependency: Option<&'static str>,
91    pub crate_tier: Option<&'static str>,
92    pub const_override: Option<bool>,
93    pub edition: Option<&'static str>,
94    pub targets: &'static [&'static str],
95    pub supersedes: &'static [&'static str],
96    pub semver: &'static str,
97    pub confidence: &'static str,
98    pub status: &'static str,
99    pub default: &'static str,
100    pub earned: Option<&'static str>,
101    pub check: Option<&'static str>,
102    pub verified_by: Option<&'static str>,
103    pub behavior: PrecomputedBehavior,
104    pub keep_when: Option<&'static str>,
105    pub clippy_lints: &'static [PrecomputedClippyLint],
106    pub before_example: Option<&'static str>,
107    pub after_example: Option<&'static str>,
108    pub clippy_candidate_note: Option<&'static str>,
109    pub derived_since: (u32, u32),
110    pub derived_const_since: Option<(u32, u32)>,
111    pub derived_const_allowed: bool,
112    pub derived_crate_tier: &'static str,
113    pub derived_edition: Option<&'static str>,
114    pub derived_introduces_new_syntax: bool,
115}
116
117/// Structural `Cargo.toml` rule precompiled from `catalog/manifest-rules.toml`.
118#[derive(Debug, Clone, Copy)]
119pub struct PrecomputedManifestRule {
120    pub id: &'static str,
121    pub aliases: &'static [&'static str],
122    pub since: (u32, u32),
123    pub edition: Option<&'static str>,
124    pub confidence: &'static str,
125    pub status: &'static str,
126    pub default: &'static str,
127    pub earned: Option<&'static str>,
128    pub behavior: PrecomputedBehavior,
129    pub semver: &'static str,
130    pub detector: &'static str,
131    pub summary: &'static str,
132    pub explanation: Option<&'static str>,
133    pub keep_when: Option<&'static str>,
134    pub check_message: Option<&'static str>,
135    pub verified_by: Option<&'static str>,
136    pub requires: &'static [&'static str],
137}
138
139/// Non-Rust / string-literal text rule precompiled from `catalog/text-rules.toml`.
140#[derive(Debug, Clone, Copy)]
141pub struct PrecomputedTextRule {
142    pub id: &'static str,
143    pub aliases: &'static [&'static str],
144    pub requires: &'static [&'static str],
145    pub since: (u32, u32),
146    pub edition: Option<&'static str>,
147    pub confidence: &'static str,
148    pub status: &'static str,
149    pub default: &'static str,
150    pub behavior: PrecomputedBehavior,
151    pub summary: &'static str,
152    pub explanation: Option<&'static str>,
153    pub keep_when: Option<&'static str>,
154    pub check_message: Option<&'static str>,
155    pub verified_by: Option<&'static str>,
156    pub files: &'static [&'static str],
157    pub exclude_files: &'static [&'static str],
158    pub pattern: &'static str,
159    pub replacement: Option<&'static str>,
160}
161
162include!(concat!(env!("OUT_DIR"), "/embedded_catalog.rs"));