From 8585c0220dbba0dd023ab9e8cb1d36dc24dc3582 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:07:32 -0400 Subject: [PATCH 01/13] bump dependencies --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7d15f05f..ce427adc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ encoding_rs = "0.8" log = "0.4" once_cell = { version = "1.18", optional = true } serde = "1.0" -quick-xml = { version = "0.29", features = ["encoding"] } +quick-xml = { version = "0.30", features = ["encoding"] } zip = { version = "0.6", default-features = false, features = ["deflate"] } chrono = { version = "0.4", features = [ "serde", @@ -28,9 +28,9 @@ chrono = { version = "0.4", features = [ [dev-dependencies] glob = "0.3" -env_logger = "0.9" +env_logger = "0.10" serde_derive = "1.0" -sha256 = "1.2" +sha256 = "1.3" [features] default = [] From 5d8e233ea21debf68b4fd7fb1c9126e117c228f6 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:08:01 -0400 Subject: [PATCH 02/13] clippy::needless_borrow warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/xls.rs:1003:42 | 1003 | .map_or("#REF", |sh| &sh); | ^^^ help: change this to: `sh` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default --- src/xls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xls.rs b/src/xls.rs index 1770994d..fa52c4f7 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -1000,7 +1000,7 @@ fn parse_formula( let sh = xtis .get(ixti as usize) .and_then(|xti| sheets.get(xti.itab_first as usize)) - .map_or("#REF", |sh| &sh); + .map_or("#REF", |sh| sh); stack.push(formula.len()); formula.push_str(sh); formula.push('!'); From 8884bd3aca371ef5e498c94ab32919ca55b3c2d8 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:13:07 -0400 Subject: [PATCH 03/13] clippy::needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:610:53 | 610 | fn parse_short_string(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:627:37 | 627 | fn parse_string(r: &[u8], encoding: &mut XlsEncoding) -> Result { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:725:16 | 725 | fn parse_xf(r: &mut Record<'_>) -> Result { | ^^^^^^^^^^^^^^^ help: consider changing to: `&Record<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:742:15 | 742 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:816:15 | 816 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:839:15 | 839 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:841:10 | 841 | len: &mut usize, | ^^^^^^^^^^ help: consider changing to: `&usize` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- src/xls.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index fa52c4f7..eca07008 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -607,7 +607,7 @@ fn rk_num(rk: &[u8], formats: &[CellFormat], is_1904: bool) -> DataType { } /// ShortXLUnicodeString [MS-XLS 2.5.240] -fn parse_short_string(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result { +fn parse_short_string(r: &mut Record<'_>, encoding: &XlsEncoding) -> Result { if r.data.len() < 2 { return Err(XlsError::Len { typ: "short string", @@ -624,7 +624,7 @@ fn parse_short_string(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result< } /// XLUnicodeString [MS-XLS 2.5.294] -fn parse_string(r: &[u8], encoding: &mut XlsEncoding) -> Result { +fn parse_string(r: &[u8], encoding: &XlsEncoding) -> Result { if r.len() < 2 { return Err(XlsError::Len { typ: "short string", @@ -722,7 +722,7 @@ fn parse_sst(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result) -> Result { +fn parse_xf(r: &Record<'_>) -> Result { if r.data.len() < 4 { return Err(XlsError::Len { typ: "xf", @@ -739,7 +739,7 @@ fn parse_xf(r: &mut Record<'_>) -> Result { /// See: https://learn.microsoft.com/ru-ru/openspecs/office_file_formats/ms-xls/300280fd-e4fe-4675-a924-4d383af48d3b fn parse_format( r: &mut Record<'_>, - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, ) -> Result<(u16, CellFormat), XlsError> { if r.data.len() < 4 { return Err(XlsError::Len { @@ -813,7 +813,7 @@ fn read_rich_extended_string( } fn read_dbcs( - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, mut len: usize, r: &mut Record<'_>, mut high_byte: bool, @@ -836,9 +836,9 @@ fn read_dbcs( } fn read_unicode_string_no_cch( - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, buf: &[u8], - len: &mut usize, + len: &usize, s: &mut String, ) { encoding.decode_to(&buf[1..=*len], *len, s, Some(buf[0] & 0x1 != 0)); From 840d5ac44c63cd7719d14e049406b506449d4b7b Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:15:57 -0400 Subject: [PATCH 04/13] more clippy::needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:463:15 | 463 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:768:15 | 768 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:985:15 | 985 | encoding: &mut XlsEncoding, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut --- src/xls.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index eca07008..ecc186a3 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -460,7 +460,7 @@ impl Xls { /// BoundSheet8 [MS-XLS 2.4.28] fn parse_sheet_name( r: &mut Record<'_>, - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, ) -> Result<(usize, String), XlsError> { let pos = read_u32(r.data) as usize; r.data = &r.data[6..]; @@ -765,7 +765,7 @@ fn parse_format( /// See: fn read_rich_extended_string( r: &mut Record<'_>, - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, ) -> Result { if r.data.is_empty() && !r.continue_record() || r.data.len() < 3 { return Err(XlsError::Len { @@ -982,7 +982,7 @@ fn parse_formula( sheets: &[String], names: &[(String, String)], xtis: &[Xti], - encoding: &mut XlsEncoding, + encoding: &XlsEncoding, ) -> Result { let mut stack = Vec::new(); let mut formula = String::with_capacity(rgce.len()); From 58cff0b9ff0b38a264cd441733e690b87aa819f3 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:19:05 -0400 Subject: [PATCH 05/13] clippy::match_ref_pats warning: you don't need to add `&` to all patterns --> src/xls.rs:1304:5 | 1304 | / match r { 1305 | | &[0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record 1306 | | &[0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))), 1307 | | &[0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some), ... | 1312 | | _ => Ok(Some(DataType::Float(read_f64(r)))), 1313 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats = note: `#[warn(clippy::match_ref_pats)]` on by default help: instead of prefixing all patterns with `&`, you can dereference the expression | 1304 ~ match *r { 1305 ~ [0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record 1306 ~ [0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))), 1307 ~ [0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some), 1308 ~ [e, .., 0xFF, 0xFF] => Err(XlsError::Unrecognized { --- src/xls.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index ecc186a3..852b8154 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -1301,11 +1301,11 @@ fn parse_formula( /// FormulaValue [MS-XLS 2.5.133] fn parse_formula_value(r: &[u8]) -> Result, XlsError> { - match r { - &[0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record - &[0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))), - &[0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some), - &[e, .., 0xFF, 0xFF] => Err(XlsError::Unrecognized { + match *r { + [0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record + [0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))), + [0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some), + [e, .., 0xFF, 0xFF] => Err(XlsError::Unrecognized { typ: "error", val: e, }), From 0756f091fea5af65b9f9535834b3eee6f3ac527f Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:30:23 -0400 Subject: [PATCH 06/13] clippy::unnecessary_mut_passed warning: the function `parse_format` doesn't need a mutable reference --> src/xls.rs:292:66 | 292 | let (idx, format) = parse_format(&mut r, &mut encoding)?; | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default warning: the function `parse_xf` doesn't need a mutable reference --> src/xls.rs:297:43 | 297 | xfs.push(parse_xf(&mut r)?); | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `parse_sheet_name` doesn't need a mutable reference --> src/xls.rs:301:68 | 301 | let (pos, name) = parse_sheet_name(&mut r, &mut encoding)?; | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference --> src/xls.rs:311:29 | 311 | ... &mut encoding, | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference --> src/xls.rs:313:29 | 313 | ... &mut cch, | ^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `parse_sst` doesn't need a mutable reference --> src/xls.rs:329:59 | 329 | 0x00FC => strings = parse_sst(&mut r, &mut encoding)?, // SST | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default warning: the function `parse_string` doesn't need a mutable reference --> src/xls.rs:396:73 | 396 | let val = DataType::String(parse_string(r.data, &mut encoding)?); | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `parse_formula` doesn't need a mutable reference --> src/xls.rs:425:29 | 425 | ... &mut encoding, | ^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference --> src/xls.rs:1104:66 | 1104 | read_unicode_string_no_cch(encoding, &rgce[1..], &mut cch, &mut formula); | ^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed warning: this argument is a mutable reference, but not used mutably --> src/xls.rs:704:44 | 704 | fn parse_sst(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result, XlsError> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default --- src/xls.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index 852b8154..f06ad21f 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -289,28 +289,28 @@ impl Xls { } // FORMATTING 0x041E => { - let (idx, format) = parse_format(&mut r, &mut encoding)?; + let (idx, format) = parse_format(&mut r, &encoding)?; formats.insert(idx, format); } // XFS 0x00E0 => { - xfs.push(parse_xf(&mut r)?); + xfs.push(parse_xf(&r)?); } // RRTabId 0x0085 => { - let (pos, name) = parse_sheet_name(&mut r, &mut encoding)?; + let (pos, name) = parse_sheet_name(&mut r, &encoding)?; self.metadata.sheets.push(name.clone()); sheet_names.push((pos, name)); // BoundSheet8 } 0x0018 => { // Lbl for defined_names - let mut cch = r.data[3] as usize; + let cch = r.data[3] as usize; let cce = read_u16(&r.data[4..]) as usize; let mut name = String::new(); read_unicode_string_no_cch( - &mut encoding, + &encoding, &r.data[14..], - &mut cch, + &cch, &mut name, ); let rgce = &r.data[r.data.len() - cce..]; @@ -326,7 +326,7 @@ impl Xls { _itab_last: read_i16(&xti[4..]), })); } - 0x00FC => strings = parse_sst(&mut r, &mut encoding)?, // SST + 0x00FC => strings = parse_sst(&mut r, &encoding)?, // SST #[cfg(feature = "picture")] 0x00EB => { // MsoDrawingGroup @@ -393,7 +393,7 @@ impl Xls { 0x0205 => cells.push(parse_bool_err(r.data)?), // 517: BoolErr 0x0207 => { // 519 String (formula value) - let val = DataType::String(parse_string(r.data, &mut encoding)?); + let val = DataType::String(parse_string(r.data, &encoding)?); cells.push(Cell::new(fmla_pos, val)) } 0x027E => cells.push(parse_rk(r.data, &self.formats, self.is_1904)?), // 638: Rk @@ -422,7 +422,7 @@ impl Xls { &fmla_sheet_names, &defined_names, &xtis, - &mut encoding, + &encoding, ) .unwrap_or_else(|e| { debug!("{}", e); @@ -701,7 +701,7 @@ fn parse_dimensions(r: &[u8]) -> Result { } } -fn parse_sst(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result, XlsError> { +fn parse_sst(r: &mut Record<'_>, encoding: &XlsEncoding) -> Result, XlsError> { if r.data.len() < 8 { return Err(XlsError::Len { typ: "sst", @@ -1100,8 +1100,8 @@ fn parse_formula( 0x17 => { stack.push(formula.len()); formula.push('\"'); - let mut cch = rgce[0] as usize; - read_unicode_string_no_cch(encoding, &rgce[1..], &mut cch, &mut formula); + let cch = rgce[0] as usize; + read_unicode_string_no_cch(encoding, &rgce[1..], &cch, &mut formula); formula.push('\"'); rgce = &rgce[2 + cch..]; } From ab0fe9efef44656ed6fa1d07a1d6e66e4cab8acf Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 16 Aug 2023 07:43:22 -0400 Subject: [PATCH 07/13] rust fmt --- src/xls.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index f06ad21f..33a8b88e 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -307,12 +307,7 @@ impl Xls { let cch = r.data[3] as usize; let cce = read_u16(&r.data[4..]) as usize; let mut name = String::new(); - read_unicode_string_no_cch( - &encoding, - &r.data[14..], - &cch, - &mut name, - ); + read_unicode_string_no_cch(&encoding, &r.data[14..], &cch, &mut name); let rgce = &r.data[r.data.len() - cce..]; let formula = parse_defined_names(rgce)?; defined_names.push((name, formula)); @@ -737,10 +732,7 @@ fn parse_xf(r: &Record<'_>) -> Result { /// Decode Format /// /// See: https://learn.microsoft.com/ru-ru/openspecs/office_file_formats/ms-xls/300280fd-e4fe-4675-a924-4d383af48d3b -fn parse_format( - r: &mut Record<'_>, - encoding: &XlsEncoding, -) -> Result<(u16, CellFormat), XlsError> { +fn parse_format(r: &mut Record<'_>, encoding: &XlsEncoding) -> Result<(u16, CellFormat), XlsError> { if r.data.len() < 4 { return Err(XlsError::Len { typ: "format", @@ -835,12 +827,7 @@ fn read_dbcs( Ok(s) } -fn read_unicode_string_no_cch( - encoding: &XlsEncoding, - buf: &[u8], - len: &usize, - s: &mut String, -) { +fn read_unicode_string_no_cch(encoding: &XlsEncoding, buf: &[u8], len: &usize, s: &mut String) { encoding.decode_to(&buf[1..=*len], *len, s, Some(buf[0] & 0x1 != 0)); } From a5dc1d40ceb017e2b5dec9e584c51a833d9ae84f Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 16 Aug 2023 19:58:19 -0400 Subject: [PATCH 08/13] use parse_sheet_metadata --- src/xls.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xls.rs b/src/xls.rs index a882af59..164448d2 100644 --- a/src/xls.rs +++ b/src/xls.rs @@ -300,9 +300,9 @@ impl Xls { } // RRTabId 0x0085 => { - let (pos, name) = parse_sheet_name(&mut r, &encoding)?; - self.metadata.sheets.push(name.clone()); - sheet_names.push((pos, name)); // BoundSheet8 + let (pos, sheet) = parse_sheet_metadata(&mut r, &encoding)?; + self.metadata.sheets.push(sheet.clone()); + sheet_names.push((pos, sheet.name)); // BoundSheet8 } 0x0018 => { // Lbl for defined_names @@ -458,7 +458,7 @@ impl Xls { fn parse_sheet_metadata( r: &mut Record<'_>, encoding: &XlsEncoding, -) -> Result<(usize, String), XlsError> { +) -> Result<(usize, Sheet), XlsError> { let pos = read_u32(r.data) as usize; let visible = match r.data[4] & 0b0011_1111 { 0x00 => SheetVisible::Visible, From 5acf0d4d28bf8d21c75406f0777fb844f47163a7 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:00:55 -0400 Subject: [PATCH 09/13] rust fmt --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ac3bc974..746a082d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -563,7 +563,8 @@ impl Range { pub fn get(&self, relative_position: (usize, usize)) -> Option<&T> { let (row, col) = relative_position; let (height, width) = self.get_size(); - if col >= height { // row is checked implicitly + if col >= height { + // row is checked implicitly None } else { self.inner.get(row * width + col) From a4254b27afe3c81dd29d8505da6bf3ebd2c5b9dc Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:12:14 -0400 Subject: [PATCH 10/13] set edition to 2021 and MSRV to 1.62.1 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ce427adc..a317387a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ readme = "README.md" keywords = ["excel", "ods", "xls", "xlsx", "xlsb"] categories = ["encoding", "parsing", "text-processing"] exclude = ["tests/**/*"] -edition = "2018" -rust-version = "1.60" +edition = "2021" +rust-version = "1.62.1" [dependencies] byteorder = "1.4" From 1c759e6e2b7ed682b162255b6755574c0440a335 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:29:07 -0400 Subject: [PATCH 11/13] derive Default for DataType now that MSRV is 1.62.1 warning: this `impl` can be derived --> src/datatype.rs:42:1 | 42 | / impl Default for DataType { 43 | | fn default() -> DataType { 44 | | DataType::Empty 45 | | } 46 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls = note: `#[warn(clippy::derivable_impls)]` on by default = help: remove the manual implementation... help: ...and instead derive it... | 19 + #[derive(Default)] 20 | pub enum DataType { | help: ...and mark the default variant | 39 ~ #[default] 40 ~ Empty, --- src/datatype.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/datatype.rs b/src/datatype.rs index 447cd46d..9e3fb76c 100644 --- a/src/datatype.rs +++ b/src/datatype.rs @@ -15,7 +15,7 @@ const MS_MULTIPLIER: f64 = 24f64 * 60f64 * 60f64 * 1e+3f64; /// An enum to represent all different data types that can appear as /// a value in a worksheet cell -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Default)] pub enum DataType { /// Signed integer Int(i64), @@ -36,15 +36,10 @@ pub enum DataType { /// Error Error(CellErrorType), /// Empty cell + #[default] Empty, } -impl Default for DataType { - fn default() -> DataType { - DataType::Empty - } -} - impl DataType { /// Assess if datatype is empty pub fn is_empty(&self) -> bool { From 9baa594e097fd868a1eab639dbbb71f970181788 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:04:53 -0400 Subject: [PATCH 12/13] change MSRV to 1.62.1 --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e6e6c2e9..926a8d23 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: toolchain: - - "1.60.0" # MSRV + - "1.62.1" # MSRV - stable - beta - nightly From 26713dd8449bca11a97267403987abe191b8cf0d Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:10:40 -0400 Subject: [PATCH 13/13] bump MSRV to 163.0 as is-terminal requires it is-terminal is a dependency of env-logger --- .github/workflows/rust.yml | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 926a8d23..d05772b6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: toolchain: - - "1.62.1" # MSRV + - "1.63" # MSRV - stable - beta - nightly diff --git a/Cargo.toml b/Cargo.toml index a317387a..5375c24f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["excel", "ods", "xls", "xlsx", "xlsb"] categories = ["encoding", "parsing", "text-processing"] exclude = ["tests/**/*"] edition = "2021" -rust-version = "1.62.1" +rust-version = "1.63" [dependencies] byteorder = "1.4"