Skip to content

Assist: replace string with char #6256

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

Merged
merged 3 commits into from
Oct 20, 2020
Merged

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Oct 16, 2020

close #6252

Signed-off-by: Benjamin Coenen <[email protected]>
@bnjjj bnjjj force-pushed the feat_assist_string_char branch from d143bf2 to c22c039 Compare October 20, 2020 13:57
let value = token.value()?;
let target = token.syntax().text_range();

if value.is_empty() || value.chars().count() > 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if value.is_empty() || value.chars().count() > 1 {
if value.chars().count() != 1 {

but its probably best to avoid premature pessimization and call .next twice manually instead of O(N) count

other then this, lgmt!

bors d+

@bors
Copy link
Contributor

bors bot commented Oct 20, 2020

✌️ bnjjj can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@bnjjj
Copy link
Contributor Author

bnjjj commented Oct 20, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 20, 2020

@bors bors bot merged commit c003395 into rust-lang:master Oct 20, 2020
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.

Assist: replace string with char
4 participants