summaryrefslogtreecommitdiff
path: root/tests/ui/lint
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2024-09-01 03:42:18 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2024-09-06 15:47:52 +0300
commitdcfc71310d560a77b4813f60511c2b15c5125b80 (patch)
tree844862fd277f4b9d95cfcaf73c4040090f8b004b /tests/ui/lint
parente38764d73b84eb625102233623e79f36515345e2 (diff)
elided_named_lifetimes: add suggestions
Diffstat (limited to 'tests/ui/lint')
-rw-r--r--tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr4
-rw-r--r--tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr19
-rw-r--r--tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr8
-rw-r--r--tests/ui/lint/elided-named-lifetimes/static.stderr19
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
index 8c5426a60cb..5af5123c032 100644
--- a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
@@ -9,6 +9,10 @@ note: the lint level is defined here
|
LL | #![deny(elided_named_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+ |
+LL | pub fn get_mut(&'static self, x: &mut u8) -> &'static mut u8 {
+ | ~~~~~~~~
error: aborting due to 1 previous error
diff --git a/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr
index 249ae146b16..6abaad7f5d2 100644
--- a/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr
@@ -11,6 +11,10 @@ note: the lint level is defined here
|
LL | #![deny(elided_named_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+ |
+LL | fn ampersand<'a>(x: &'a u8) -> &'a u8 {
+ | ~~~
error: elided lifetime has a name
--> $DIR/missing-lifetime-kind.rs:10:31
@@ -19,6 +23,11 @@ LL | fn brackets<'a>(x: &'a u8) -> Brackets {
| -- ^^^^^^^^ this elided lifetime gets resolved as `'a`
| |
| lifetime `'a` declared here
+ |
+help: consider specifying it explicitly
+ |
+LL | fn brackets<'a>(x: &'a u8) -> Brackets<'a> {
+ | ~~~~~~~~~~~~
error: elided lifetime has a name
--> $DIR/missing-lifetime-kind.rs:17:33
@@ -27,6 +36,11 @@ LL | fn comma<'a>(x: &'a u8) -> Comma<u8> {
| -- ^ this elided lifetime gets resolved as `'a`
| |
| lifetime `'a` declared here
+ |
+help: consider specifying it explicitly
+ |
+LL | fn comma<'a>(x: &'a u8) -> Comma<'a, u8> {
+ | ~~~~
error: elided lifetime has a name
--> $DIR/missing-lifetime-kind.rs:22:34
@@ -35,6 +49,11 @@ LL | fn underscore<'a>(x: &'a u8) -> &'_ u8 {
| -- ^^ this elided lifetime gets resolved as `'a`
| |
| lifetime `'a` declared here
+ |
+help: consider specifying it explicitly
+ |
+LL | fn underscore<'a>(x: &'a u8) -> &'a u8 {
+ | ~~
error: aborting due to 4 previous errors
diff --git a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
index c465aab1a03..cbc1b862caa 100644
--- a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
@@ -9,6 +9,10 @@ note: the lint level is defined here
|
LL | #[warn(elided_named_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+ |
+LL | fn bar(x: &'static u8) -> &'static u8 {
+ | ~~~~~~~~
error: elided lifetime has a name
--> $DIR/not-tied-to-crate.rs:11:31
@@ -21,6 +25,10 @@ note: the lint level is defined here
|
LL | #[deny(elided_named_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+ |
+LL | fn baz(x: &'static u8) -> &'static u8 {
+ | ~~~~~~~~
error: aborting due to 1 previous error; 1 warning emitted
diff --git a/tests/ui/lint/elided-named-lifetimes/static.stderr b/tests/ui/lint/elided-named-lifetimes/static.stderr
index d2e9776cb4f..6c3944e5ea5 100644
--- a/tests/ui/lint/elided-named-lifetimes/static.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/static.stderr
@@ -9,24 +9,43 @@ note: the lint level is defined here
|
LL | #![deny(elided_named_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+ |
+LL | fn ampersand(x: &'static u8) -> &'static u8 {
+ | ~~~~~~~~
error: elided lifetime has a name
--> $DIR/static.rs:23:32
|
LL | fn brackets(x: &'static u8) -> Brackets {
| ^^^^^^^^ this elided lifetime gets resolved as `'static`
+ |
+help: consider specifying it explicitly
+ |
+LL | fn brackets(x: &'static u8) -> Brackets<'static> {
+ | ~~~~~~~~~~~~~~~~~
error: elided lifetime has a name
--> $DIR/static.rs:30:34
|
LL | fn comma(x: &'static u8) -> Comma<u8> {
| ^ this elided lifetime gets resolved as `'static`
+ |
+help: consider specifying it explicitly
+ |
+LL | fn comma(x: &'static u8) -> Comma<'static, u8> {
+ | ~~~~~~~~~
error: elided lifetime has a name
--> $DIR/static.rs:35:35
|
LL | fn underscore(x: &'static u8) -> &'_ u8 {
| ^^ this elided lifetime gets resolved as `'static`
+ |
+help: consider specifying it explicitly
+ |
+LL | fn underscore(x: &'static u8) -> &'static u8 {
+ | ~~~~~~~
error: aborting due to 4 previous errors