perf: Simplify string case conversions to ASCII only (#7890)

This commit is contained in:
HuaGu-Dragon authored and GitHub committed 2026-07-07 09:37:16 +02:00
1 parent c645d79a67
commit fff02ca501
5 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -279,7 +279,7 @@ pub enum PaneDirection {
impl PaneDirection {
pub fn direction_from_str(arg: &str) -> Result<PaneDirection, String> {
for candidate in PaneDirection::variants() {
if candidate.to_lowercase() == arg.to_lowercase() {
if candidate.eq_ignore_ascii_case(arg) {
if let Ok(direction) = PaneDirection::from_dynamic(
&Value::String(candidate.to_string()),
FromDynamicOptions::default(),
+1 -1
View File
@@ -32,7 +32,7 @@ pub fn running_under_wsl() -> bool {
std::ffi::CStr::from_ptr(name.version.as_ptr()).to_string_lossy(),
std::ffi::CStr::from_ptr(name.release.as_ptr()).to_string_lossy()
);
return version.to_lowercase().contains("microsoft");
return version.to_ascii_lowercase().contains("microsoft");
}
};
+3 -3
View File
@@ -432,7 +432,7 @@ impl ParsedFont {
// fontconfig resorts to name matching, so we do too :-/
let style = match style {
FontStyle::Normal => {
let lower = names.full_name.to_lowercase();
let lower = names.full_name.to_ascii_lowercase();
if lower.contains("italic") || lower.contains("kursiv") {
FontStyle::Italic
} else if lower.contains("oblique") {
@@ -442,7 +442,7 @@ impl ParsedFont {
}
}
FontStyle::Italic => {
let lower = names.full_name.to_lowercase();
let lower = names.full_name.to_ascii_lowercase();
if lower.contains("oblique") {
FontStyle::Oblique
} else {
@@ -802,7 +802,7 @@ impl ParsedFont {
// This heuristic is awful, TBH.
if !self.is_built_in_fallback
&& !attr.is_synthetic
&& self.names.full_name.to_lowercase().contains("moji")
&& self.names.full_name.to_ascii_lowercase().contains("moji")
{
self.assume_emoji_presentation = true;
}
+1 -1
View File
@@ -139,7 +139,7 @@ async fn async_run_ssh(opts: SshCommand) -> anyhow::Result<()> {
ssh_option.insert("wezterm_ssh_verbose".to_string(), "true".to_string());
}
for (k, v) in opts.config_override {
ssh_option.insert(k.to_lowercase().to_string(), v);
ssh_option.insert(k.to_ascii_lowercase(), v);
}
let dom = SshDomain {
+1 -1
View File
@@ -296,7 +296,7 @@ impl ParsedConfigFile {
let mut tokens = v.split_ascii_whitespace();
while let Some(cname) = tokens.next() {
match cname.to_lowercase().as_str() {
match cname.to_ascii_lowercase().as_str() {
"all" => {
criteria.push(Criteria::All);
}