-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommend replacing ones with L's in functions like println!()
#13677
Comments
It's probably better to use the same "distance" code function name "did you mean" works, and not just focus on characters that look alike |
What do you mean by distance? Number of characters in a keyword? |
Probably edit distance, which tells how far apart two strings are using addition, deletion and substitution. |
Okay, I think I can see how that could be done. |
Didn't mean to close that. |
Not gonna get around to trying to fix this any time soon. |
If someone could add labels that would be good. I'm assuming this is |
Fixes #13677 This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers. Example. Compiling this program: ```rust macro_rules! foo { ($e:expr) => ( $e ) } fn main() { fob!("hello!"); } ``` gives the following error message: ``` /Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!' /Users/mcp/temp/test.rs:7 fob!("hello!"); ^~~ /Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`? /Users/mcp/temp/test.rs:7 fob!("hello!"); ``` I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
Fixes rust-lang/rust-clippy#10780 We correctly no longer give a warning when a closure is passed to a method, where one of the arguments to that method uses the variable which would be shadowed by an argument to that closure. Uses is defined loosely as any expression used in the calling expression mentions the shadowee binding (except for the closure itself): ```rust #![deny(clippy::shadow_unrelated)] let x = Some(1); let y = x.map(|x| x + 1); ``` will now succeed. See linebender/xilem#745 - without this change, all of the `expect(shadow_unrelated)` in the repository are met; with it, none of them are. changelog: [`shadow_unrelated`]: Don't treat closures arguments as unrelated when the calling function uses them
Give a helpful tip to point out the "one" should be an "L" in keywords like this. Pointing out zeros for
O
oro
might also be good.It was suggested I try to fix this which I may in a few days.
A better error message might be like:
The text was updated successfully, but these errors were encountered: