about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-internal/interning_literals.stderr15
-rw-r--r--tests/ui-internal/interning_literals_unfixable.stderr9
-rw-r--r--tests/ui-internal/symbol_as_str.fixed7
-rw-r--r--tests/ui-internal/symbol_as_str.rs7
-rw-r--r--tests/ui-internal/symbol_as_str.stderr35
-rw-r--r--tests/ui-internal/symbol_as_str_unfixable.stderr9
6 files changed, 64 insertions, 18 deletions
diff --git a/tests/ui-internal/interning_literals.stderr b/tests/ui-internal/interning_literals.stderr
index 628b97eff84..9ff4194e542 100644
--- a/tests/ui-internal/interning_literals.stderr
+++ b/tests/ui-internal/interning_literals.stderr
@@ -4,9 +4,10 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("f32");
    |             ^^^^^^^^^^^^^^^^^^^^^
    |
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
    = note: `-D clippy::interning-literals` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::interning_literals)]`
-help: use the preinterned symbol
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("f32");
 LL +     let _ = sym::f32;
@@ -18,7 +19,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("proc-macro");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("proc-macro");
 LL +     let _ = sym::proc_dash_macro;
@@ -30,7 +32,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("self");
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("self");
 LL +     let _ = kw::SelfLower;
@@ -42,7 +45,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("msrv");
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("msrv");
 LL +     let _ = sym::msrv;
@@ -54,7 +58,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("Cargo.toml");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("Cargo.toml");
 LL +     let _ = sym::Cargo_toml;
diff --git a/tests/ui-internal/interning_literals_unfixable.stderr b/tests/ui-internal/interning_literals_unfixable.stderr
index 8294453a8f9..879d9e633c2 100644
--- a/tests/ui-internal/interning_literals_unfixable.stderr
+++ b/tests/ui-internal/interning_literals_unfixable.stderr
@@ -4,9 +4,10 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("xyz123");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
    = note: `-D clippy::interning-literals` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::interning_literals)]`
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("xyz123");
 LL +     let _ = sym::xyz123;
@@ -18,7 +19,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("with-dash");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("with-dash");
 LL +     let _ = sym::with_dash;
@@ -30,7 +32,8 @@ error: interning a string literal
 LL |     let _ = Symbol::intern("with.dot");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+   = help: add the symbol to `clippy_utils/src/sym.rs` if needed
+help: use a preinterned symbol instead
    |
 LL -     let _ = Symbol::intern("with.dot");
 LL +     let _ = sym::with_dot;
diff --git a/tests/ui-internal/symbol_as_str.fixed b/tests/ui-internal/symbol_as_str.fixed
index 3e26732836c..6a71b16c604 100644
--- a/tests/ui-internal/symbol_as_str.fixed
+++ b/tests/ui-internal/symbol_as_str.fixed
@@ -18,4 +18,11 @@ fn f(s: Symbol) {
     //~^ symbol_as_str
     sym::get == s;
     //~^ symbol_as_str
+
+    let _ = match s {
+        //~^ symbol_as_str
+        sym::unwrap_err => 1,
+        sym::unwrap_or_default | sym::unwrap_or_else => 2,
+        _ => 3,
+    };
 }
diff --git a/tests/ui-internal/symbol_as_str.rs b/tests/ui-internal/symbol_as_str.rs
index 334c32d1898..43136504bf1 100644
--- a/tests/ui-internal/symbol_as_str.rs
+++ b/tests/ui-internal/symbol_as_str.rs
@@ -18,4 +18,11 @@ fn f(s: Symbol) {
     //~^ symbol_as_str
     "get" == s.as_str();
     //~^ symbol_as_str
+
+    let _ = match s.as_str() {
+        //~^ symbol_as_str
+        "unwrap_err" => 1,
+        "unwrap_or_default" | "unwrap_or_else" => 2,
+        _ => 3,
+    };
 }
diff --git a/tests/ui-internal/symbol_as_str.stderr b/tests/ui-internal/symbol_as_str.stderr
index 39f81f3833c..3eeead4aa8c 100644
--- a/tests/ui-internal/symbol_as_str.stderr
+++ b/tests/ui-internal/symbol_as_str.stderr
@@ -4,9 +4,10 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "f32";
    |     ^^^^^^^^^^
    |
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
    = note: `-D clippy::symbol-as-str` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::symbol_as_str)]`
-help: use the preinterned symbol
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "f32";
 LL +     s == sym::f32;
@@ -18,7 +19,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "proc-macro";
    |     ^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "proc-macro";
 LL +     s == sym::proc_dash_macro;
@@ -30,7 +32,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "self";
    |     ^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "self";
 LL +     s == kw::SelfLower;
@@ -42,7 +45,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "msrv";
    |     ^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "msrv";
 LL +     s == sym::msrv;
@@ -54,7 +58,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "Cargo.toml";
    |     ^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "Cargo.toml";
 LL +     s == sym::Cargo_toml;
@@ -66,11 +71,27 @@ error: converting a Symbol to a string
 LL |     "get" == s.as_str();
    |              ^^^^^^^^^^
    |
-help: use the preinterned symbol
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     "get" == s.as_str();
 LL +     sym::get == s;
    |
 
-error: aborting due to 6 previous errors
+error: converting a Symbol to a string
+  --> tests/ui-internal/symbol_as_str.rs:22:19
+   |
+LL |     let _ = match s.as_str() {
+   |                   ^^^^^^^^^^
+   |
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
+   |
+LL ~     let _ = match s {
+LL |
+LL ~         sym::unwrap_err => 1,
+LL ~         sym::unwrap_or_default | sym::unwrap_or_else => 2,
+   |
+
+error: aborting due to 7 previous errors
 
diff --git a/tests/ui-internal/symbol_as_str_unfixable.stderr b/tests/ui-internal/symbol_as_str_unfixable.stderr
index 5349983ca51..65664ebb451 100644
--- a/tests/ui-internal/symbol_as_str_unfixable.stderr
+++ b/tests/ui-internal/symbol_as_str_unfixable.stderr
@@ -4,9 +4,10 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "xyz123";
    |     ^^^^^^^^^^
    |
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
    = note: `-D clippy::symbol-as-str` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::symbol_as_str)]`
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "xyz123";
 LL +     s == sym::xyz123;
@@ -18,7 +19,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "with-dash";
    |     ^^^^^^^^^^
    |
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "with-dash";
 LL +     s == sym::with_dash;
@@ -30,7 +32,8 @@ error: converting a Symbol to a string
 LL |     s.as_str() == "with.dot";
    |     ^^^^^^^^^^
    |
-help: add the symbol to `clippy_utils/src/sym.rs` and use it
+   = help: add the symbols to `clippy_utils/src/sym.rs` if needed
+help: use preinterned symbols instead
    |
 LL -     s.as_str() == "with.dot";
 LL +     s == sym::with_dot;