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

Official stance on how to return errors #13741

Open
dev-ardi opened this issue Nov 27, 2024 · 0 comments
Open

Official stance on how to return errors #13741

dev-ardi opened this issue Nov 27, 2024 · 0 comments
Labels
A-lint Area: New lints

Comments

@dev-ardi
Copy link

What it does

return Err(ErrKind::Foo.into()) and Err(ErrKind::Foo)? are both accepted.
There shouldn't be two ways of doing the same thing and the latter is more succint.

Advantage

  • Less code
  • Unified way of doing things

Drawbacks

  • Can be annoying.
  • Unclear if we want to emit where there's no .into()

Example

return Err(ErrKind::Foo.into())

Could be written as:

Err(ErrKind::Foo)?
@dev-ardi dev-ardi added the A-lint Area: New lints label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

1 participant