From 3430a0a6eed42267e036063369546a6f192e39a8 Mon Sep 17 00:00:00 2001 From: nyyu Date: Sat, 31 May 2025 20:43:40 +0200 Subject: [PATCH] chore: regex remove default features --- Cargo.toml | 2 +- src/kb_data_source.rs | 6 ++++-- src/ms_data_source.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9f683e..25fa33e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ indexmap = {version = "2.2", features = ["serde", "rayon"]} log = "0.4" logsy = "1.0.1" rayon = "1.10" -regex = "1.11.1" +regex = {version = "1.11.1", features = ["std"], default-features = false} serde = "1.0" serde_derive = "1.0" serde_json = {version = "1.0", features = ["preserve_order"]} diff --git a/src/kb_data_source.rs b/src/kb_data_source.rs index 3a8cd75..3d95cbe 100644 --- a/src/kb_data_source.rs +++ b/src/kb_data_source.rs @@ -385,7 +385,8 @@ mod tests { let client = ureq::Agent::config_builder() .user_agent(USER_AGENT_VALUE) .timeout_global(Some(Duration::from_secs(10))) - .build().into(); + .build() + .into(); let datasource = KBDataSource::new(); let champion = ChampionLoL { data: IndexMap::new(), @@ -399,7 +400,8 @@ mod tests { let client = ureq::Agent::config_builder() .user_agent(USER_AGENT_VALUE) .timeout_global(Some(Duration::from_secs(10))) - .build().into(); + .build() + .into(); let datasource = KBDataSource::new(); let champ = ChampInfo { id: String::from("Annie"), diff --git a/src/ms_data_source.rs b/src/ms_data_source.rs index 3e0e44a..88fc8fe 100644 --- a/src/ms_data_source.rs +++ b/src/ms_data_source.rs @@ -26,7 +26,7 @@ fn get_champ_from_name(champs: &Champion, name: String) -> Option { } fn find_next_number(rest: &str) -> f32 { - let re = Regex::new(r"(\d+\.?\d+)").unwrap(); + let re = Regex::new(r"([0-9]+\.?[0-9]+)").unwrap(); if let Some(cap) = re.captures(rest) { if let Some(matched) = cap.get(1) { return matched.as_str().parse::().unwrap_or(0.0);