Add rustX check to codeblock attributes lint

This commit is contained in:
Guillaume Gomez 2023-12-12 14:27:20 +01:00
parent fb32eb3529
commit d3cb25f4cf

View File

@ -1284,6 +1284,16 @@ fn parse(
LangStringToken::LangToken(x) if x.starts_with("edition") => { LangStringToken::LangToken(x) if x.starts_with("edition") => {
data.edition = x[7..].parse::<Edition>().ok(); data.edition = x[7..].parse::<Edition>().ok();
} }
LangStringToken::LangToken(x)
if x.starts_with("rust") && x[4..].parse::<Edition>().is_ok() =>
{
if let Some(extra) = extra {
extra.error_invalid_codeblock_attr(format!(
"unknown attribute `{x}`. Did you mean `edition{}`?",
&x[4..]
));
}
}
LangStringToken::LangToken(x) LangStringToken::LangToken(x)
if allow_error_code_check && x.starts_with('E') && x.len() == 5 => if allow_error_code_check && x.starts_with('E') && x.len() == 5 =>
{ {