blob: c663427a89f12a46c10a00685ddbd0a6eeef8ebf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
use crate::err::ExplainErr;
use lib::LINTS;
pub fn explain(code: u32) -> Result<&'static str, ExplainErr> {
match code {
0 => Ok("syntax error"),
_ => LINTS
.values()
.flatten()
.find(|l| l.code() == code)
.map(|l| l.explaination())
.ok_or(ExplainErr::LintNotFound(code)),
}
}
|