Skip to content

Commit

Permalink
Merge pull request #412 from softdevca/pr-oncelock
Browse files Browse the repository at this point in the history
feat: Use std::cell::OnceLock instead of the once_cell crate
  • Loading branch information
tafia authored Mar 8, 2024
2 parents 9a66d53 + aaf297e commit 58c8ba2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
toolchain:
- "1.65" # MSRV
- "1.71" # MSRV
- stable
- beta
- nightly
Expand Down
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ keywords = ["excel", "ods", "xls", "xlsx", "xlsb"]
categories = ["encoding", "parsing", "text-processing"]
exclude = ["tests/**/*"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.71"

[dependencies]
byteorder = "1.4"
byteorder = "1.5"
codepage = "0.1.1"
encoding_rs = "0.8"
log = "0.4"
once_cell = { version = "1.18", optional = true }
serde = "1.0"
quick-xml = { version = "0.31", features = ["encoding"] }
zip = { version = "0.6", default-features = false, features = ["deflate"] }
Expand All @@ -28,11 +27,11 @@ chrono = { version = "0.4", features = [

[dev-dependencies]
glob = "0.3"
env_logger = "0.10"
env_logger = "0.11"
serde_derive = "1.0"
sha256 = "1.3"

[features]
default = []
dates = ["chrono", "once_cell"]
dates = ["chrono"]
picture = []
6 changes: 3 additions & 3 deletions src/datatype.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::fmt;

#[cfg(feature = "dates")]
use once_cell::sync::OnceCell;
use std::sync::OnceLock;

use serde::de::Visitor;
use serde::{self, Deserialize};

use super::CellErrorType;

#[cfg(feature = "dates")]
static EXCEL_EPOCH: OnceCell<chrono::NaiveDateTime> = OnceCell::new();
static EXCEL_EPOCH: OnceLock<chrono::NaiveDateTime> = OnceLock::new();

#[cfg(feature = "dates")]
/// https://learn.microsoft.com/en-us/office/troubleshoot/excel/1900-and-1904-date-system
Expand Down
4 changes: 2 additions & 2 deletions src/xls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,10 @@ fn parse_label(
let row = read_u16(r);
let col = read_u16(&r[2..]);
let _ixfe = read_u16(&r[4..]);
return Ok(Some(Cell::new(
Ok(Some(Cell::new(
(row as u32, col as u32),
Data::String(parse_string(&r[6..], encoding, biff)?),
)));
)))
}

fn parse_label_sst(r: &[u8], strings: &[String]) -> Result<Option<Cell<Data>>, XlsError> {
Expand Down

0 comments on commit 58c8ba2

Please sign in to comment.