Check arguments length in trivial diagnostic lint
This commit is contained in:
parent
151a070afe
commit
9027d208f2
3 changed files with 27 additions and 2 deletions
|
@ -478,8 +478,10 @@ impl EarlyLintPass for Diagnostics {
|
|||
}
|
||||
if !segments.iter().all(|(name, args)| {
|
||||
let arg = match name.as_str() {
|
||||
"struct_span_err" | "span_note" | "span_label" | "span_help" => &args[1],
|
||||
"note" | "help" => &args[0],
|
||||
"struct_span_err" | "span_note" | "span_label" | "span_help" if args.len() == 2 => {
|
||||
&args[1]
|
||||
}
|
||||
"note" | "help" if args.len() == 1 => &args[0],
|
||||
_ => {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue