Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't provide hint to add lifetime on impl items #37481

Merged
merged 1 commit into from
Nov 12, 2016

Commits on Nov 11, 2016

  1. Don't hint to add lifetime on trait impl

    Don't provide hint to add lifetime on impl items that implement a trait.
    
    ```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 impl items that implement a trait.
    estebank committed Nov 11, 2016
    Configuration menu
    Copy the full SHA
    87b6d38 View commit details
    Browse the repository at this point in the history