You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StrExt::splitn requires a DoubleEndedSearcher whereas StrExt::split does not #23262
Wanting to limit your splits to a certain number suddenly requires the pattern to implement DoubleEndedSearcher, so the following code fragment using strings as splits fails:
<anon>:3:54: 3:63 error: type `core::str::SplitN<'_, &str>` does not implement any method in scope named `collect`
<anon>:3 let v2: Vec<_> = "test:thing:test".splitn(1, ":").collect();
^~~~~~~~~
I would expect both of them to have pretty much the same requirements as for the pattern argument.
Activity
sfackler commentedon Mar 10, 2015
At the very least, the trait bound should be placed on
splitnas well so you get a compilation error in the right place.shepmaster commentedon Mar 14, 2015
@sfackler some conversation on the PR indicates that we aren't going to add the trait bounds on the method.
rollup merge of rust-lang#23269: shepmaster/split-not-double-ended
Merge pull request rust-lang#23262 from BenjaminBrienen/freestanding