blob: 9e7ca26c7d40001cbed9be7fc67204b74f23f54f [file] [log] [blame]
#![feature(rustc_private)]
// This test checks that all lints defined in `clippy_config::conf` in `#[lints]`
// attributes exist as Clippy lints.
//
// This test is a no-op if run as part of the compiler test suite
// and will always succeed.
use std::collections::HashSet;
#[test]
fn config_consistency() {
if option_env!("RUSTC_TEST_SUITE").is_some() {
return;
}
let lint_names: HashSet<String> = clippy_lints::declared_lints::LINTS
.iter()
.map(|lint_info| lint_info.lint.name.strip_prefix("clippy::").unwrap().to_lowercase())
.collect();
for conf in clippy_config::get_configuration_metadata() {
for lint in conf.lints {
assert!(
lint_names.contains(*lint),
"Configuration option {} references lint `{lint}` which does not exist",
conf.name
);
}
}
}