From d8063e13ed94b57304e82700a1c8f5ef4fa13f84 Mon Sep 17 00:00:00 2001 From: Jilani Syed Date: Mon, 28 Oct 2024 12:07:41 +0530 Subject: [PATCH] B (#236) some changes --- Cargo.toml | 8 ++++---- src/structs/true_false_blank_value.rs | 4 ++-- src/structs/true_false_value.rs | 8 ++++++-- src/structs/worksheet.rs | 16 +++++++--------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 42820100..30676e71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,18 +19,18 @@ cbc = "0.1.2" cfb = "0.10.0" chrono = { version = "0.4.31", default-features = false, features = ["clock"] } encoding_rs = "0.8.33" -fancy-regex = "0.13.0" +fancy-regex = "0.14.0" getrandom = { version = "0.2.14" } -hashbrown = "0.14.3" +hashbrown = "0.14.5" hmac = "0.12.1" html_parser = "0.7.0" image = { version = "0.25.0", optional = true } lazy_static = "1.4.0" md-5 = "0.10.6" -regex = "1.10.2" +regex = "1.11.1" sha2 = "0.10.8" thousands = "0.2.0" -quick-xml = { version = "0.35.0", features = ["serialize"] } +quick-xml = { version = "0.36.2", features = ["serialize"] } zip = { version = "1.1.4", default-features = false, features = ["deflate"] } [lib] diff --git a/src/structs/true_false_blank_value.rs b/src/structs/true_false_blank_value.rs index 38754fc0..71842b8e 100644 --- a/src/structs/true_false_blank_value.rs +++ b/src/structs/true_false_blank_value.rs @@ -22,8 +22,8 @@ impl TrueFalseBlankValue { } pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Self { - let value_str = value.into(); - self.set_value(!(&value_str == "f" || &value_str == "False")) + let value = value.into(); + self.set_value(!(value.eq_ignore_ascii_case("f") || value.eq_ignore_ascii_case("false"))) } pub(crate) fn has_value(&self) -> bool { diff --git a/src/structs/true_false_value.rs b/src/structs/true_false_value.rs index db4257e2..7b5f0e27 100644 --- a/src/structs/true_false_value.rs +++ b/src/structs/true_false_value.rs @@ -9,7 +9,10 @@ impl TrueFalseValue { } pub(crate) fn get_value_string(&self) -> &str { - self.value.as_ref().map_or("f", |b| "t") + match self.get_value() { + true => "t", + false => "f", + } } pub(crate) fn set_value(&mut self, value: bool) -> &mut Self { @@ -18,7 +21,8 @@ impl TrueFalseValue { } pub(crate) fn set_value_string>(&mut self, value: S) -> &mut Self { - self.set_value(value.into() != "f") + let value: String = value.into(); + self.set_value(!(value.eq_ignore_ascii_case("f") || value.eq_ignore_ascii_case("false"))) } pub(crate) fn has_value(&self) -> bool { diff --git a/src/structs/worksheet.rs b/src/structs/worksheet.rs index 2b861a14..22ea7d1a 100644 --- a/src/structs/worksheet.rs +++ b/src/structs/worksheet.rs @@ -1778,19 +1778,17 @@ impl AdjustmentCoordinate for Worksheet { } // defined_names - let mut idx = 0 as usize; - while idx < self.defined_names.len() { - if self.defined_names[idx].is_remove_coordinate_with_sheet( - &self.title, + let title = &self.title; + self.defined_names.retain(|defined_name| { + !defined_name.is_remove_coordinate_with_sheet( + &title, root_col_num, offset_col_num, root_row_num, offset_row_num, - ) { - self.defined_names.remove(idx); - } - idx += 1; - } + ) + }); + for defined_name in &mut self.defined_names { defined_name.adjustment_remove_coordinate_with_sheet( &self.title,