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

Replace .len() < 1 with .is_empty() in generated code #120

Closed
DmitrySamoylov opened this issue Jan 27, 2021 · 5 comments · Fixed by #148
Closed

Replace .len() < 1 with .is_empty() in generated code #120

DmitrySamoylov opened this issue Jan 27, 2021 · 5 comments · Fixed by #148

Comments

@DmitrySamoylov
Copy link
Contributor

No description provided.

@jplatte
Copy link
Contributor

jplatte commented Jun 11, 2021

Since this was sitting in my notifications for forever, I just had a look. Seems like this is just a specific case of 1 for an otherwise generic check, and as such I don't think we should change the codegen. We can probably just add an #[allow] to that section of the code.

@DmitrySamoylov
Copy link
Contributor Author

Agreed, #[allow] would be better. But I don't get how we cannot change codegen. #[allow] should be added by codegen?

@jplatte
Copy link
Contributor

jplatte commented Jun 11, 2021

Right, I just meant not complicate it with extra branches.

@wt
Copy link

wt commented Aug 25, 2023

I think the is_empty would be better for the case with < 1. Isn't is possible that that method could be implemented in a more efficient manner than the .len() method?

@WhyNotHugo
Copy link
Contributor

See: #148

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

Successfully merging a pull request may close this issue.

4 participants