]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #37481 - estebank:lifetime-help-removal-for-impl, r=eddyb
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sat, 12 Nov 2016 08:38:37 +0000 (10:38 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Nov 2016 08:38:37 +0000 (10:38 +0200)
commit7894d2aad68be19a7e97194e3df4ec835ca524b6
treecf5f3a5d4208804ca365ce362eada9d94a2299c6
parent66da9a291152feeedc9bb53f23f4577478b377e1
parent87b6d386541c6f7a409775296da1cda2da469c36
Rollup merge of #37481 - estebank:lifetime-help-removal-for-impl, r=eddyb

Don't provide hint to add lifetime on impl items

``` rust
use std::str::FromStr;

pub struct Foo<'a> {
    field: &'a str,
}

impl<'a> FromStr for Foo<'a> {
    type Err = ();
    fn from_str(path: &str) -> Result<Self, ()> {
        Ok(Foo { field: path })
    }
}
```

would give the following hint:

``` nocode
help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()>
  --> <anon>:9:5
   |
9  |     fn from_str(path: &str) -> Result<Self, ()> {
   |     ^
```

which is never correct, since then there will be a lifetime mismatch between the `impl` and the trait.

Remove this hint for all `impl` items.

Re: #37363.