Skip to content

Remove unnecessary allocation when checking whether to hide argument name hint#7224

Merged
bors[bot] merged 3 commits intorust-lang:masterfrom
jhpratt:master
Jan 10, 2021
Merged

Remove unnecessary allocation when checking whether to hide argument name hint#7224
bors[bot] merged 3 commits intorust-lang:masterfrom
jhpratt:master

Conversation

@jhpratt
Copy link
Member

@jhpratt jhpratt commented Jan 10, 2021

The case-insensitive prefix/suffix check can be performed
character-by-character. This allows the check to be done without having
to allocate a new string. As a side effect, it's also no longer
necessary to convert the entire string to lowercase, as it's done as
needed. As the only case equality we're handling is ASCII, this
operation can be further optimized by using byte equality, rather than
character equality.

cc @SomeoneToIgnore, as it's an update on my PR from yesterday.

The case-insensitive prefix/suffix check can be performed
character-by-character. This allows the check to be done without having
to allocate a new string. As a side effect, it's also no longer
necessary to convert the entire string to lowercase, as it's done as
needed. As the only case equality we're handling is ASCII, this
operation can be further optimized by using byte equality, rather than
character equality.
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-up.

I like the idea, let's make it to behave similar to the previous version.

@SomeoneToIgnore
Copy link
Contributor

SomeoneToIgnore commented Jan 10, 2021

bors d+

Don't bother with the underscore if you still think it's not worth it and just merge the PR then.
Thanks!

@bors
Copy link
Contributor

bors bot commented Jan 10, 2021

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

@jhpratt
Copy link
Member Author

jhpratt commented Jan 10, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 10, 2021

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.

2 participants