-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Use eq_ignore_ascii_case
to avoid heap alloc in detect_confuse_type
#145152
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
Conversation
cc @Muscraft |
Such error paths are cold, but sure, why not. r? lqd I'll send it to bors when it's green. |
It'll be green in 3... 2... 1... Okay, it takes longer than I thought |
only miri left, good enough for me @bors r+ rollup |
Would https://doc.rust-lang.org/std/primitive.str.html#method.eq_ignore_ascii_case be even better in this case? |
it's not a str it's a char, so https://doc.rust-lang.org/std/primitive.char.html#method.eq_ignore_ascii_case but why not. Even better is left in the eye of the beholder, because it's just a shorthand for what's in this PR. but since it's not in a rollup yet, let's do that @xizheyin @bors r- |
Use `to_ascii_lowercase` to avoid heap alloc in `detect_confuse_type` A small optimization has been made, using `to_ascii_lowercase()` instead of `to_lowercase().to_string()`. r? compiler
Yeah, no problem |
It's in a rollup now...., race condition, or bors not seeing edits, no worries. Another PR will be fine, not in this one @xizheyin |
Re-approving explicitly, bors state was weird. @bors r=lqd |
💡 This pull request was already approved, no need to approve it again.
|
Rollup of 8 pull requests Successful merges: - #144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc) - #145089 (Improve error output when a command fails in bootstrap) - #145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC) - #145135 (Stabilize `duration_constructors_lite` feature) - #145146 (remove `P`) - #145152 (Use `to_ascii_lowercase` to avoid heap alloc in `detect_confuse_type`) - #145156 (Override custom Cargo `build-dir` in bootstrap) - #145160 (Change days-threshold to 28 in [behind-upstream]) Failed merges: - #145145 (some `derive_more` refactors) r? `@ghost` `@rustbot` modify labels: rollup
Use `to_ascii_lowercase` to avoid heap alloc in `detect_confuse_type` A small optimization has been made, using `to_ascii_lowercase()` instead of `to_lowercase().to_string()`. r? compiler
The rollup failed. Based on the conversation above, I'm assuming you would prefer to modify this PR instead of merging it as-is. @bors r- |
Signed-off-by: xizheyin <[email protected]>
a8b0f75
to
cf1a1b7
Compare
to_ascii_lowercase
to avoid heap alloc in detect_confuse_type
eq_ignore_ascii_case
to avoid heap alloc in detect_confuse_type
@rustbot ready CI is green :) |
Thanks! @bors r+ rollup |
Rollup of 7 pull requests Successful merges: - #144553 (Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`) - #145064 (Add regression test for `saturating_sub` bounds check issue) - #145121 (bootstrap: `x.py dist rustc-src` should keep LLVM's siphash) - #145150 (Replace unsafe `security_attributes` function with safe `inherit_handle` alternative) - #145152 (Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type`) - #145200 (mbe: Fix typo in attribute tracing) - #145222 (Fix typo with paren rustc_llvm/build.rs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145152 - xizheyin:detect-confusion-type, r=lqd Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type` A small optimization has been made, using `to_ascii_lowercase()` instead of `to_lowercase().to_string()`. r? compiler
A small optimization has been made, using
to_ascii_lowercase()
instead ofto_lowercase().to_string()
.r? compiler