UPDATE: Update to Rust 2024 edition

This commit is contained in:
Nicolás Hatcher
2025-02-23 12:40:55 +01:00
parent 1ff0c38aa5
commit ce3f0f33c2
77 changed files with 186 additions and 186 deletions

View File

@@ -2,7 +2,7 @@
name = "ironcalc"
version = "0.3.0"
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
edition = "2021"
edition = "2024"
homepage = "https://www.ironcalc.com"
repository = "https://github.com/ironcalc/ironcalc/"
description = "The democratization of spreadsheets"

View File

@@ -1,5 +1,5 @@
use ironcalc::{
base::{expressions::utils::number_to_column, Model},
base::{Model, expressions::utils::number_to_column},
export::save_to_xlsx,
};

View File

@@ -4,7 +4,7 @@ use std::path::Path;
use ironcalc_base::cell::CellValue;
use ironcalc_base::types::*;
use ironcalc_base::{expressions::utils::number_to_column, Model};
use ironcalc_base::{Model, expressions::utils::number_to_column};
use crate::export::save_to_xlsx;
use crate::import::load_from_xlsx;

View File

@@ -1,6 +1,6 @@
use chrono::DateTime;
use ironcalc_base::{
new_empty::{APPLICATION, APP_VERSION, IRONCALC_USER},
new_empty::{APP_VERSION, APPLICATION, IRONCALC_USER},
types::Workbook,
};
@@ -42,7 +42,7 @@ pub(crate) fn get_core_xml(workbook: &Workbook, milliseconds: i64) -> Result<Str
return Err(XlsxError::Xml(format!(
"Invalid timestamp: {}",
milliseconds
)))
)));
}
};
let last_modified = dt.format("%Y-%m-%dT%H:%M:%SZ").to_string();

View File

@@ -18,7 +18,7 @@ use std::{
use ironcalc_base::expressions::utils::number_to_column;
use ironcalc_base::types::Workbook;
use ironcalc_base::{get_milliseconds_since_epoch, Model};
use ironcalc_base::{Model, get_milliseconds_since_epoch};
use self::xml_constants::XML_DECLARATION;

View File

@@ -9,8 +9,12 @@ pub(crate) fn get_shared_strings_xml(model: &Workbook) -> String {
for shared_string in &model.shared_strings {
shared_strings.push(format!("<si><t>{}</t></si>", escape_xml(shared_string)));
}
format!("{}\n\
format!(
"{}\n\
<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"{count}\" uniqueCount=\"{unique_count}\">\
{}\
</sst>", XML_DECLARATION, shared_strings.join(""))
</sst>",
XML_DECLARATION,
shared_strings.join("")
)
}

View File

@@ -158,11 +158,13 @@ fn test_named_styles() {
save_to_xlsx(&model, temp_file_name).unwrap();
let model = load_from_xlsx(temp_file_name, "en", "UTC").unwrap();
assert!(model
.workbook
.styles
.get_style_index_by_name("bold & italics")
.is_ok());
assert!(
model
.workbook
.styles
.get_style_index_by_name("bold & italics")
.is_ok()
);
fs::remove_file(temp_file_name).unwrap();
}

View File

@@ -22,7 +22,7 @@ use itertools::Itertools;
use ironcalc_base::{
expressions::{
parser::{stringify::to_excel_string, Node},
parser::{Node, stringify::to_excel_string},
types::CellReferenceRC,
utils::number_to_column,
},

View File

@@ -16,8 +16,8 @@ use std::{
use roxmltree::Node;
use ironcalc_base::{
types::{Metadata, Workbook, WorkbookSettings, WorkbookView},
Model,
types::{Metadata, Workbook, WorkbookSettings, WorkbookView},
};
use crate::error::XlsxError;
@@ -28,7 +28,7 @@ use metadata::load_metadata;
use styles::load_styles;
use util::get_attribute;
use workbook::load_workbook;
use worksheets::{load_sheets, Relationship};
use worksheets::{Relationship, load_sheets};
fn load_relationships<R: Read + std::io::Seek>(
archive: &mut zip::ZipArchive<R>,

View File

@@ -4,8 +4,8 @@ use std::{collections::HashMap, io::Read, num::ParseIntError};
use ironcalc_base::{
expressions::{
parser::{stringify::to_rc_format, Parser},
token::{get_error_by_english_name, Error},
parser::{Parser, stringify::to_rc_format},
token::{Error, get_error_by_english_name},
types::CellReferenceRC,
utils::{column_to_number, parse_reference_a1},
},