FIX: Make clippy happy

This commit is contained in:
Nicolás Hatcher
2025-06-29 10:23:32 +02:00
committed by Nicolás Hatcher Andrés
parent 46ea92966f
commit 0be7d9b85a
39 changed files with 200 additions and 224 deletions

View File

@@ -19,10 +19,9 @@ pub(crate) fn get_app_xml(_: &Workbook) -> String {
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" \
xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">\
<Application>{}</Application>\
<AppVersion>{}</AppVersion>\
</Properties>",
APPLICATION, APP_VERSION
<Application>{APPLICATION}</Application>\
<AppVersion>{APP_VERSION}</AppVersion>\
</Properties>"
)
}
@@ -40,8 +39,7 @@ pub(crate) fn get_core_xml(workbook: &Workbook, milliseconds: i64) -> Result<Str
Some(s) => s,
None => {
return Err(XlsxError::Xml(format!(
"Invalid timestamp: {}",
milliseconds
"Invalid timestamp: {milliseconds}"
)))
}
};
@@ -54,16 +52,15 @@ pub(crate) fn get_core_xml(workbook: &Workbook, milliseconds: i64) -> Result<Str
xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" \
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> \
<dc:title></dc:title><dc:subject></dc:subject>\
<dc:creator>{}</dc:creator>\
<dc:creator>{creator}</dc:creator>\
<cp:keywords></cp:keywords>\
<dc:description></dc:description>\
<cp:lastModifiedBy>{}</cp:lastModifiedBy>\
<cp:lastModifiedBy>{last_modified_by}</cp:lastModifiedBy>\
<cp:revision></cp:revision>\
<dcterms:created xsi:type=\"dcterms:W3CDTF\">{}</dcterms:created>\
<dcterms:modified xsi:type=\"dcterms:W3CDTF\">{}</dcterms:modified>\
<dcterms:created xsi:type=\"dcterms:W3CDTF\">{created}</dcterms:created>\
<dcterms:modified xsi:type=\"dcterms:W3CDTF\">{last_modified}</dcterms:modified>\
<cp:category></cp:category>\
<cp:contentStatus></cp:contentStatus>\
</cp:coreProperties>",
creator, last_modified_by, created, last_modified
</cp:coreProperties>"
))
}

View File

@@ -59,7 +59,7 @@ fn get_content_types_xml(workbook: &Workbook) -> String {
pub fn save_to_xlsx(model: &Model, file_name: &str) -> Result<(), XlsxError> {
let file_path = std::path::Path::new(&file_name);
if file_path.exists() {
return Err(XlsxError::IO(format!("file {} already exists", file_name)));
return Err(XlsxError::IO(format!("file {file_name} already exists")));
}
let file = fs::File::create(file_path).unwrap();
let writer = BufWriter::new(file);
@@ -140,7 +140,7 @@ pub fn save_xlsx_to_writer<W: Write + Seek>(model: &Model, writer: W) -> Result<
pub fn save_to_icalc(model: &Model, file_name: &str) -> Result<(), XlsxError> {
let file_path = std::path::Path::new(&file_name);
if file_path.exists() {
return Err(XlsxError::IO(format!("file {} already exists", file_name)));
return Err(XlsxError::IO(format!("file {file_name} already exists")));
}
let s = bitcode::encode(&model.workbook);
let mut file = fs::File::create(file_path)?;

View File

@@ -35,7 +35,7 @@ fn get_cell_style_attribute(s: i32) -> String {
if s == 0 {
"".to_string()
} else {
format!(" s=\"{}\"", s)
format!(" s=\"{s}\"")
}
}