Skip to content

Analyzer for failing to use a Result #6

@jcotton42

Description

@jcotton42

Given that results aren't "noisy" like exceptions it would be useful to get a warning/error if you fail to use one. As an example, the following code should result in some sort of warning:

// some code
MethodThatReturnsAResult();
// some more code

From here there's two ways I can see this going: you only need to read the Result at all to shut up the analyzer

// some code
var weNeveDoAnythingWithThis = MethodThatReturnsAResult();
// some more code

Or you actually have to do something with the variable it's assigned to, and to explicitly ignore it you would need to use a discard

// some code
_ = MethodThatReturnsAResult();
// some more code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions