diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-10-14 14:48:45 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-10-14 14:48:45 -0700 |
| commit | 8bf6d353772aacc15c78919e3d2f2db0528484b1 (patch) | |
| tree | a623f49784a95d9282182a985ad99bd073af1157 /src/librustc_errors | |
| parent | 6dd718ca7937fc1a769d65b06396cf64f45f94ba (diff) | |
| download | rust-8bf6d353772aacc15c78919e3d2f2db0528484b1.tar.gz rust-8bf6d353772aacc15c78919e3d2f2db0528484b1.zip | |
Tweak heuristics for less noise
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index d02201d5321..84400091100 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -2064,9 +2064,9 @@ pub fn is_case_difference(sm: &dyn SourceMapper, suggested: &str, sp: Span) -> b // FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode. let found = sm.span_to_snippet(sp).unwrap(); let ascii_confusables = &['c', 'f', 'i', 'k', 'o', 's', 'u', 'v', 'w', 'x', 'y', 'z']; - // There are ASCII chars that are confusable (above) and differ in capitalization: - let confusable = found.chars().zip(suggested.chars()).any(|(f, s)| { - (ascii_confusables.contains(&f) || ascii_confusables.contains(&s)) && f != s + // All the chars that differ in capitalization are confusable (above): + let confusable = found.chars().zip(suggested.chars()).filter(|(f, s)| f != s).all(|(f, s)| { + (ascii_confusables.contains(&f) || ascii_confusables.contains(&s)) }); confusable && found.to_lowercase() == suggested.to_lowercase() // FIXME: We sometimes suggest the same thing we already have, which is a |
