Skip to content

Normalize asserts #6999

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

Closed
tschuett opened this issue Mar 29, 2021 · 2 comments
Closed

Normalize asserts #6999

tschuett opened this issue Mar 29, 2021 · 2 comments
Labels
A-lint Area: New lints

Comments

@tschuett
Copy link

What it does

Improves readability

Categories (optional)

What is the advantage of the recommended code over the original code

For example:

  • Remove bounce checking inserted by ...
  • Remove the need to duplicating/storing/typo ...

Drawbacks

None.

Example

assert!(result.len() == self.data.len());
assert!(result.len() != self.data.len());

Could be written as:

assert_eq!(result.len(), self.data.len());
assert_ne!(result.len(), self.data.len());
@tschuett tschuett added the A-lint Area: New lints label Mar 29, 2021
@alex-700
Copy link
Contributor

Duplicate of #6637

@giraffate
Copy link
Contributor

Thanks for your suggestion!

But I'm closing this because it seems to be a duplicate of #6637.

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

3 participants