Skip to content

Optional error on unused returned value when returned value is not None #1125

Description

It would be useful to have the option to show an error when a function's non-None returned value is not used. For example in this code:

def greeting(name: str) -> str:
    return f"Hi {name}"

def greet(name: str) -> None:
    greeting(name)

I would like to get an error on the call to greeting inside of greet because a value is returned but unused. If a returned value is meant to be ignored it would expressed explicitly with _ = greeting(name) or _unused_greeting = greeting(name).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions