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 split_whitespace().collect() calls #1

Open
nils-ohlmeier opened this issue May 28, 2017 · 2 comments
Open

Replace split_whitespace().collect() calls #1

nils-ohlmeier opened this issue May 28, 2017 · 2 comments

Comments

@nils-ohlmeier
Copy link
Collaborator

Instead of using split_whitespace().collect() to get a temporary vector just use split_whitespace() and then the iterator with .next() for parsing.

@na-g
Copy link
Collaborator

na-g commented Jun 13, 2019

The code currently checks the length of the result of the collect(). AFAIK there is no way of doing that with an Iter without consuming the Iter.

@nils-ohlmeier
Copy link
Collaborator Author

Correct.
But in hindsight I think these length checks are somewhat stupid. They make testing a lot harder then it needs to be. For some of the attributed the amount of tokens depends on one of the tokens. And when you consume the tokens from an Iter the parser can provide a precise error message what is wrong with line instead of just "it's too short".
So basically I think we should not check the length at all and instead consume from the .next() calls.

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

No branches or pull requests

2 participants