Skip to content

Conversation

@martin-g
Copy link
Member

Which issue does this PR close?

  • Closes #.

Rationale for this change

Replace usages of str::to_lowercase().as_str() + patterm matching with str::eq_ignore_ascii_case(&str) to avoid allocating temporary String.

What changes are included in this PR?

It is a boring change from

match some_str.to_lowercase().as_str() {
 "one" => ...,
 "two" => ...,
 ...
}

to

if some_str.eq_ignore_ascii_case("one") { 
  ...
} else if some_str.eq_ignore_ascii_case("two") {
  ...
} ...

Are these changes tested?

The logic should be already covered by old tests.

Are there any user-facing changes?

No.

Replace usages of str::to_lowercase().as_str() + patterm matching with
str::eq_ignore_ascii_case(&str) to avoid allocating temporary String.
@github-actions github-actions bot added the functions Changes to functions implementation label Jan 15, 2026
@martin-g
Copy link
Member Author

There are many more occurrences of this pattern in the code base.

I updated just a few to see whether the change would be accepted. Maybe the gain is not big enough and the code style is not preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant