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

Analyzer for failing to use a Result #6

Open
jcotton42 opened this issue May 25, 2022 · 0 comments · May be fixed by #13
Open

Analyzer for failing to use a Result #6

jcotton42 opened this issue May 25, 2022 · 0 comments · May be fixed by #13

Comments

@jcotton42
Copy link

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
pobiega added a commit to pobiega/Remora.Results that referenced this issue May 6, 2023
@pobiega pobiega linked a pull request May 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant