make simple check of prinf function.
With this commit we start to make some simple check when the name resolution fails, and we generate some helper message in case the name is a C name like in the case of the `printf` and suggest the correct rust method. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
@@ -282,6 +282,14 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||
"you may want to use a bool value instead",
|
||||
format!("{}", item_typo),
|
||||
))
|
||||
// FIXME(vicnenzopalazzo): make the check smarter,
|
||||
// and maybe expand with levenshtein distance checks
|
||||
} else if item_str.as_str() == "printf" {
|
||||
Some((
|
||||
item_span,
|
||||
"you may have meant to use the `print` macro",
|
||||
"print!".to_owned(),
|
||||
))
|
||||
} else {
|
||||
suggestion
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user