Skip to content

feat: impl Iterator for errors#120

Merged
lrlna merged 1 commit intomainfrom
igni/impl_iterator_for_errors
Nov 29, 2021
Merged

feat: impl Iterator for errors#120
lrlna merged 1 commit intomainfrom
igni/impl_iterator_for_errors

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 force-pushed the igni/impl_iterator_for_errors branch from 018b6b1 to a816538 Compare November 24, 2021 17:04
@o0Ignition0o o0Ignition0o marked this pull request as ready for review November 24, 2021 18:03
@o0Ignition0o o0Ignition0o requested a review from lrlna 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