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

Suggest impl Trait return type when incorrectly using a generic return type #89892

Merged
merged 1 commit into from
Feb 19, 2022

Commits on Feb 18, 2022

  1. Suggest impl Trait return type

    Address rust-lang#85991
    
    Suggest the `impl Trait` return type syntax if the user tried to return a generic parameter and we get a type mismatch
    
    The suggestion is not emitted if the param appears in the function parameters, and only get the bounds that actually involve `T: ` directly
    
    It also checks whether the generic param is contained in any where bound (where it isn't the self type), and if one is found (like `Option<T>: Send`), it is not suggested.
    
    This also adds `TyS::contains`, which recursively vistits the type and looks if the other type is contained anywhere
    Noratrieb committed Feb 18, 2022
    Configuration menu
    Copy the full SHA
    4bed748 View commit details
    Browse the repository at this point in the history