diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-10-28 00:13:18 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-10-28 00:14:41 -0700 |
| commit | faea5bbc650d93e28e4a89a62aee0dc1409b08c7 (patch) | |
| tree | 32c36dcaec10cc43f9bc7bc4f6c21cbd52f7f200 /src/test/ui | |
| parent | fd28753e83ac0599357aef8df4b25996e7f4a630 (diff) | |
| download | rust-faea5bbc650d93e28e4a89a62aee0dc1409b08c7.tar.gz rust-faea5bbc650d93e28e4a89a62aee0dc1409b08c7.zip | |
single-use-lifetime lint: don't false-positive on the anonymous lifetime
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs index a862bbbe30c..b392f7a5174 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs @@ -12,10 +12,8 @@ #![allow(dead_code)] #![allow(unused_variables)] -// Test that we DO warn for a lifetime used only once in an impl. -// -// (Actually, until #15872 is fixed, you can't use `'_` here, but -// hopefully that will come soon.) +// Test that we DO warn for a lifetime used only once in an impl, and that we +// don't warn for the anonymous lifetime. struct Foo<'f> { data: &'f u32 @@ -26,4 +24,9 @@ impl<'f> Foo<'f> { //~ ERROR `'f` only used once } } +impl Foo<'_> { + fn inherent_b(&self) {} +} + + fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index 2509366f969..40dfa677d0a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-impl-header.rs:24:6 + --> $DIR/one-use-in-inherent-impl-header.rs:22:6 | LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | ^^ -- ...is used only here |
