Skip to content

take_split return is not intuitive #1450

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
Stargateur opened this issue Oct 29, 2021 · 1 comment
Closed

take_split return is not intuitive #1450

Stargateur opened this issue Oct 29, 2021 · 1 comment

Comments

@Stargateur
Copy link
Contributor

Stargateur commented Oct 29, 2021

take_split() doesn't precise what is returned and implementation do:

fn take_split(&self, count: usize) -> (Self, Self) {
  let (prefix, suffix) = self.split_at(count);
  (suffix, prefix)
}

That really not intuitive when you are expected std nomenclature and it's more logical to return it as std do it. Plus, I think this function should return either a Result or a Option (like std should) to avoid unexpected panic.

Open rust-lang/rust#90410.

@Geal
Copy link
Collaborator

Geal commented Oct 30, 2021

I don't think there's an issue with take_split, it's consistent with the rest of nom. Could you avoid opening an issue then immediately opening a PR for an architecture change or new feature without waiting for my opinion? This was not necessary

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 a pull request may close this issue.

2 participants