about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-10-14 14:48:45 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-10-14 14:48:45 -0700
commit8bf6d353772aacc15c78919e3d2f2db0528484b1 (patch)
treea623f49784a95d9282182a985ad99bd073af1157
parent6dd718ca7937fc1a769d65b06396cf64f45f94ba (diff)
downloadrust-8bf6d353772aacc15c78919e3d2f2db0528484b1.tar.gz
rust-8bf6d353772aacc15c78919e3d2f2db0528484b1.zip
Tweak heuristics for less noise
-rw-r--r--src/librustc_errors/emitter.rs6
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr.stderr2
-rw-r--r--src/test/ui/enable-unstable-lib-feature.stderr2
-rw-r--r--src/test/ui/lint/lint-lowercase-static-const-pattern.stderr2
-rw-r--r--src/test/ui/lint/lint-non-snake-case-functions.stderr4
-rw-r--r--src/test/ui/lint/lint-non-uppercase-associated-const.stderr2
-rw-r--r--src/test/ui/lint/not_found.stderr2
7 files changed, 10 insertions, 10 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
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/src/test/ui/consts/const-eval/const_fn_ptr.stderr
index 9a5871905a0..2fbb1932244 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr.stderr
@@ -20,7 +20,7 @@ warning: constant `X_const` should have an upper case name
   --> $DIR/const_fn_ptr.rs:9:7
    |
 LL | const X_const: fn(usize) -> usize = double_const;
-   |       ^^^^^^^ help: convert the identifier to upper case (notice the capitalization): `X_CONST`
+   |       ^^^^^^^ help: convert the identifier to upper case: `X_CONST`
    |
    = note: `#[warn(non_upper_case_globals)]` on by default
 
diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr
index d89f804f15b..d5b8c0efaad 100644
--- a/src/test/ui/enable-unstable-lib-feature.stderr
+++ b/src/test/ui/enable-unstable-lib-feature.stderr
@@ -2,7 +2,7 @@ error: function `BOGUS` should have a snake case name
   --> $DIR/enable-unstable-lib-feature.rs:11:8
    |
 LL | pub fn BOGUS() { }
-   |        ^^^^^ help: convert the identifier to snake case (notice the capitalization): `bogus`
+   |        ^^^^^ help: convert the identifier to snake case: `bogus`
    |
 note: lint level defined here
   --> $DIR/enable-unstable-lib-feature.rs:6:9
diff --git a/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr
index 40e5a736a8e..d95510ccd2d 100644
--- a/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr
+++ b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr
@@ -20,7 +20,7 @@ error: constant in pattern `not_okay` should have an upper case name
   --> $DIR/lint-lowercase-static-const-pattern.rs:40:13
    |
 LL |         (0, not_okay) => 0,
-   |             ^^^^^^^^ help: convert the identifier to upper case (notice the capitalization): `NOT_OKAY`
+   |             ^^^^^^^^ help: convert the identifier to upper case: `NOT_OKAY`
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/lint/lint-non-snake-case-functions.stderr b/src/test/ui/lint/lint-non-snake-case-functions.stderr
index 244522acf1f..c5eca89debb 100644
--- a/src/test/ui/lint/lint-non-snake-case-functions.stderr
+++ b/src/test/ui/lint/lint-non-snake-case-functions.stderr
@@ -2,7 +2,7 @@ error: method `Foo_Method` should have a snake case name
   --> $DIR/lint-non-snake-case-functions.rs:7:8
    |
 LL |     fn Foo_Method() {}
-   |        ^^^^^^^^^^ help: convert the identifier to snake case (notice the capitalization): `foo_method`
+   |        ^^^^^^^^^^ help: convert the identifier to snake case: `foo_method`
    |
 note: lint level defined here
   --> $DIR/lint-non-snake-case-functions.rs:1:9
@@ -32,7 +32,7 @@ error: trait method `ABC` should have a snake case name
   --> $DIR/lint-non-snake-case-functions.rs:22:8
    |
 LL |     fn ABC();
-   |        ^^^ help: convert the identifier to snake case (notice the capitalization): `abc`
+   |        ^^^ help: convert the identifier to snake case: `abc`
 
 error: trait method `a_b_C` should have a snake case name
   --> $DIR/lint-non-snake-case-functions.rs:25:8
diff --git a/src/test/ui/lint/lint-non-uppercase-associated-const.stderr b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr
index 233048ee1dd..2185d5a0ab4 100644
--- a/src/test/ui/lint/lint-non-uppercase-associated-const.stderr
+++ b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr
@@ -2,7 +2,7 @@ error: associated constant `not_upper` should have an upper case name
   --> $DIR/lint-non-uppercase-associated-const.rs:7:11
    |
 LL |     const not_upper: bool = true;
-   |           ^^^^^^^^^ help: convert the identifier to upper case (notice the capitalization): `NOT_UPPER`
+   |           ^^^^^^^^^ help: convert the identifier to upper case: `NOT_UPPER`
    |
 note: lint level defined here
   --> $DIR/lint-non-uppercase-associated-const.rs:1:9
diff --git a/src/test/ui/lint/not_found.stderr b/src/test/ui/lint/not_found.stderr
index 8614e9f1173..5016d9b97d6 100644
--- a/src/test/ui/lint/not_found.stderr
+++ b/src/test/ui/lint/not_found.stderr
@@ -10,7 +10,7 @@ warning: unknown lint: `DEAD_CODE`
   --> $DIR/not_found.rs:8:8
    |
 LL | #[warn(DEAD_CODE)]
-   |        ^^^^^^^^^ help: did you mean (notice the capitalization): `dead_code`
+   |        ^^^^^^^^^ help: did you mean: `dead_code`
 
 warning: unknown lint: `Warnings`
   --> $DIR/not_found.rs:10:8