-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add std::str::Chars remaining() function: #12395 #12431
Conversation
I'm a little worried that this doesn't update any of
The string class has a fair number of iterators. Is there a reason that the |
Will hack that tomorrow, too late here atm :) |
I caution you before too much work is put in to this. I pointed out those iterators as an example of where this function may not fit into the library. I would find it a little annoying to have to define I think iterators are really good at doing just that, iterating. Conflating other state with specific iterators reduces the utility of other ones, so we'll want to approach this carefully. |
The thing with strings is that it is pretty hard to safely iterate over them on your own as you need to use s.chars(|c| if c == ' ' { break }).remaining().split(',', |tok| {println!("{}", tok)}); |
Sadly I don't think that iterator will quite work how you expect, because calling |
Ooops, of course not. Though this should work: let mut iter = s.chars();
for c in iter { if c == ' ' { break } }
iter.remaining().split(',', |tok| {println!("{}", tok)}); Or if we'd have s.chars().each(|c| { c != ' ' }).remaining().split(',', |tok| {println!("{}", tok)}); |
Closing due to a lack of activity. This may want to get fleshed out and agreed upon first before opening another PR. |
fix: Fix completions disappearing when typing two keys in quick succession With this PR we now retry requests if they get cancelled due to document changes. This fixes the completions problem we have where completions seem to randomly disappear, see https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completions.20not.20always.20appearing Fixes rust-lang/rust-analyzer#10187 Fixes rust-lang/rust-analyzer#7560 Fixes rust-lang/rust-analyzer#12153
Rustup r? `@ghost` changelog: none
No description provided.