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

feat: impl Iterator for errors #120

Merged
merged 1 commit into from
Nov 29, 2021
Merged

feat: impl Iterator for errors #120

merged 1 commit into from
Nov 29, 2021

Conversation

o0Ignition0o
Copy link
Contributor

@o0Ignition0o o0Ignition0o commented Nov 24, 2021

fixes #119

ast.errors() now return an Iter<'_, crate::Error> which allows us to iterate, but also check for the len() (through ExactSizeIterator). It should allow us to use is_empty() as well eventually, if / when rust-lang/rust#35428 lands.

I wish we could use is_empty(), the ergonomics feel a bit clunky without it. I would totally understand if we decided not to return an impl Iterator, or something else for this reason.

@o0Ignition0o o0Ignition0o force-pushed the igni/impl_iterator_for_errors branch 5 times, most recently from 4c3c81e to 018b6b1 Compare November 24, 2021 17:01
fixes #139

ast.errors() now return an `Iter<'_, Error>` which allows us to iterate, but also check for the `len()`. It should allow us to use `is_empty()` as well eventually, if / when rust-lang/rust#35428 lands.
@o0Ignition0o o0Ignition0o marked this pull request as ready for review November 24, 2021 18:03
Copy link
Member

@lrlna lrlna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you!

@lrlna lrlna merged commit 6fd0c59 into main Nov 29, 2021
@lrlna lrlna deleted the igni/impl_iterator_for_errors branch November 29, 2021 14:32
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 this pull request may close these issues.

Ast errors: return an iterator
2 participants