#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn is_heavily_cfg_gated(content: &str) -> bool {
let cfg_count = content.matches("#[cfg(target").count()
+ content.matches("#[target_feature").count()
+ content.matches("#[cfg(feature").count();
cfg_count > 3
}
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn is_excluded_from_analysis(path_str: &str) -> bool {
path_str.ends_with("_tests.rs")
|| path_str.contains("/tests/")
|| path_str.contains("/falsification/")
|| path_str.contains("_falsification")
|| path_str.contains("/quantize/")
|| path_str.contains("/simd/")
|| path_str.contains("/benches/")
|| path_str.contains("/examples/")
}
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn is_test_module_marker(line: &str) -> bool {
let trimmed = line.trim();
trimmed == "#[cfg(test)]" || trimmed.starts_with("#[cfg(test)]")
}
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn is_dead_code_annotation(line: &str) -> bool {
let trimmed = line.trim();
trimmed.starts_with(&format!("#[allow({})]", "dead_code")) || trimmed.starts_with("#[allow(unused")
}
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn is_code_item_declaration(line: &str) -> bool {
let trimmed = line.trim();
trimmed.starts_with("pub fn ")
|| trimmed.starts_with("fn ")
|| trimmed.starts_with("pub struct ")
|| trimmed.starts_with("struct ")
|| trimmed.starts_with("pub enum ")
|| trimmed.starts_with("enum ")
|| trimmed.starts_with("pub const ")
|| trimmed.starts_with("const ")
|| trimmed.starts_with("pub static ")
|| trimmed.starts_with("static ")
|| trimmed.starts_with("pub type ")
|| trimmed.starts_with("type ")
|| trimmed.starts_with("pub trait ")
|| trimmed.starts_with("trait ")
|| trimmed.starts_with("impl ")
}