diff --git a/Cargo.toml b/Cargo.toml index ab6c07e8..b5d6e81c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,34 @@ doctest = false [features] js = ["getrandom/js"] default = ["image"] + +[lints] +workspace = true + +[workspace.lints.rust] +explicit_outlives_requirements = "deny" +let-underscore-drop = "deny" +meta-variable-misuse = "deny" +non_ascii_idents = "deny" +non-local-definitions = "deny" +redundant-imports = "deny" +redundant-lifetimes = "deny" +single-use-lifetimes = "deny" +trivial-casts = "deny" +trivial_numeric_casts = "deny" +unit-bindings = "deny" +unsafe-code = "deny" # Will only be allowed in platform-specific modules +unused-import-braces = "deny" +unused-lifetimes = "deny" +unused-macro-rules = "deny" +unused_qualifications = "deny" +variant_size_differences = "deny" + +[workspace.lints.clippy] +correctness = { level = "deny", priority = -1 } +style = { level = "warn", priority = -1 } +complexity = { level = "warn", priority = -1 } +perf = { level = "warn", priority = -1 } +pedantic = { level = "warn", priority = -1 } +cargo = { level = "warn", priority = -1 } +suspicious = { level = "warn", priority = -1 } \ No newline at end of file diff --git a/README.md b/README.md index 90c7e279..fe9b9b5f 100644 --- a/README.md +++ b/README.md @@ -77,17 +77,17 @@ let mut book = umya_spreadsheet::new_file(); ### Write file ```rust let path = std::path::Path::new("./tests/result_files/bbb.xlsx"); -let _ = umya_spreadsheet::writer::xlsx::write(&book, path); +let _unused = umya_spreadsheet::writer::xlsx::write(&book, path); ``` ### Write file with password ```rust let path = std::path::Path::new("./tests/result_files/bbb.xlsx"); -let _ = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password"); +let _unused = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password"); ``` ```rust let from_path = std::path::Path::new("./tests/test_files/aaa.xlsx"); let to_path = std::path::Path::new("./tests/result_files/bbb.xlsx"); -let _ = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password"); +let _unused = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password"); ``` ### Read Value ```rust @@ -147,7 +147,7 @@ Pass the book as a ```Spreadsheet``` to modify it in other functions. ```rust let mut book = umya_spreadsheet::new_file(); -let _ = book.new_sheet("Sheet2"); +let _unused = book.new_sheet("Sheet2"); update_excel(&mut book); fn update_excel(book: &mut Spreadsheet) { diff --git a/src/helper/address.rs b/src/helper/address.rs index 1189d820..eaf852b7 100644 --- a/src/helper/address.rs +++ b/src/helper/address.rs @@ -1,17 +1,20 @@ use fancy_regex::Regex; +#[must_use] pub fn split_address(address: &str) -> (&str, &str) { address .rsplit_once('!') - .map(|(sheet_name, range)| (sheet_name.trim_matches(&['\'', '"'][..]), range)) - .unwrap_or(("", address)) + .map_or(("", address), |(sheet_name, range)| { + (sheet_name.trim_matches(&['\'', '"'][..]), range) + }) } +#[must_use] pub fn join_address(sheet_name: &str, address: &str) -> String { if sheet_name.is_empty() { return address.to_string(); } - format!("{}!{}", sheet_name, address) + format!("{sheet_name}!{address}") } #[test] diff --git a/src/helper/binary.rs b/src/helper/binary.rs index f067e954..d205ebec 100644 --- a/src/helper/binary.rs +++ b/src/helper/binary.rs @@ -4,6 +4,7 @@ use std::io::BufReader; use std::io::Read; #[inline] +#[must_use] pub fn get_binary_data(path: &str) -> Vec { let path = std::path::Path::new(path); let mut buf = Vec::new(); @@ -14,11 +15,12 @@ pub fn get_binary_data(path: &str) -> Vec { } #[inline] +#[must_use] pub fn make_media_object(path: &str) -> MediaObject { - let name = path.split("/").last().unwrap(); + let name = path.split('/').last().unwrap(); let mut obj = MediaObject::default(); obj.set_image_data(get_binary_data(path)); obj.set_image_name(name); - obj.set_image_title(name.split(".").next().unwrap_or("")); + obj.set_image_title(name.split('.').next().unwrap_or("")); obj } diff --git a/src/helper/color.rs b/src/helper/color.rs index dd140396..121a3d06 100644 --- a/src/helper/color.rs +++ b/src/helper/color.rs @@ -1,5 +1,5 @@ /** - * https://ciintelligence.blogspot.com/2012/02/converting-excel-theme-color-and-tint.html + * */ #[derive(Default, Debug, Clone, PartialEq, PartialOrd)] @@ -19,12 +19,14 @@ pub struct MsHlsColor { const RGBMAX: f64 = 255.0; const HLSMAX: f64 = 255.0; +#[must_use] pub fn calc_tint(rgb: &str, tint: f64) -> String { let mut ms_hls = convert_rgb_to_ms_hls(rgb); - ms_hls.l = calculate_final_lum_value(tint, ms_hls.l as f64); + ms_hls.l = calculate_final_lum_value(tint, f64::from(ms_hls.l)); convert_ms_hls_to_rgb(&ms_hls) } +#[must_use] pub fn calculate_final_lum_value(tint: f64, lum: f64) -> i32 { let lum1 = if tint < 0.0 { lum * (1.0 + tint) @@ -35,6 +37,7 @@ pub fn calculate_final_lum_value(tint: f64, lum: f64) -> i32 { to_i32(lum1) } +#[must_use] pub fn split_rgb(rgb: &str) -> (i32, i32, i32) { let r = i32::from_str_radix(&rgb[0..2], 16).unwrap(); let g = i32::from_str_radix(&rgb[2..4], 16).unwrap(); @@ -43,27 +46,30 @@ pub fn split_rgb(rgb: &str) -> (i32, i32, i32) { } #[inline] +#[must_use] pub fn join_rgb(r: i32, g: i32, b: i32) -> String { - format!("{:02X}{:02X}{:02X}", r, g, b) + format!("{r:02X}{g:02X}{b:02X}") } +#[must_use] pub fn convert_rgb_to_ms_hls(rgb: &str) -> MsHlsColor { let hls = convert_rgb_to_hls(rgb); MsHlsColor { - h: to_i32(hls.h * self::HLSMAX), - l: to_i32(hls.l * self::HLSMAX), - s: to_i32(hls.s * self::HLSMAX), + h: to_i32(hls.h * HLSMAX), + l: to_i32(hls.l * HLSMAX), + s: to_i32(hls.s * HLSMAX), } } +#[must_use] pub fn convert_rgb_to_hls(rgb: &str) -> HlsColor { let mut hls = HlsColor::default(); let (r_i, g_i, b_i) = split_rgb(rgb); - let r = r_i as f64 / RGBMAX; - let g = g_i as f64 / RGBMAX; - let b = b_i as f64 / RGBMAX; + let r = f64::from(r_i) / RGBMAX; + let g = f64::from(g_i) / RGBMAX; + let b = f64::from(b_i) / RGBMAX; let mut min = r; if min > g { @@ -115,15 +121,17 @@ pub fn convert_rgb_to_hls(rgb: &str) -> HlsColor { hls } +#[must_use] pub fn convert_ms_hls_to_rgb(ms_hls: &MsHlsColor) -> String { let hls = HlsColor { - h: (ms_hls.h as f64 / self::HLSMAX), - l: (ms_hls.l as f64 / self::HLSMAX), - s: (ms_hls.s as f64 / self::HLSMAX), + h: (f64::from(ms_hls.h) / HLSMAX), + l: (f64::from(ms_hls.l) / HLSMAX), + s: (f64::from(ms_hls.s) / HLSMAX), }; convert_hls_to_rgb(&hls) } +#[must_use] pub fn convert_hls_to_rgb(hls: &HlsColor) -> String { if hls.s == 0.0 { let rtn_l = to_i32(hls.l * RGBMAX); @@ -151,6 +159,7 @@ pub fn convert_hls_to_rgb(hls: &HlsColor) -> String { join_rgb(rtn_r, rtn_g, rtn_b) } +#[must_use] pub fn set_color(t1: f64, t2: f64, t3: f64) -> f64 { let t3 = positive_decimal_part(t3); diff --git a/src/helper/coordinate.rs b/src/helper/coordinate.rs index 96620bb1..a518f8a7 100644 --- a/src/helper/coordinate.rs +++ b/src/helper/coordinate.rs @@ -53,6 +53,7 @@ pub fn column_index_from_string>(column: S) -> u32 { } #[inline] +#[must_use] pub fn string_from_column_index(column_index: u32) -> String { assert!(column_index >= 1u32, "Column number starts from 1."); @@ -94,10 +95,12 @@ where } #[inline] +#[must_use] pub fn coordinate_from_index(col: u32, row: u32) -> String { format!("{}{}", string_from_column_index(col), row) } +#[must_use] pub fn coordinate_from_index_with_lock( col: u32, row: u32, diff --git a/src/helper/crypt.rs b/src/helper/crypt.rs index 8e90d90c..1560a703 100644 --- a/src/helper/crypt.rs +++ b/src/helper/crypt.rs @@ -1,11 +1,10 @@ -use super::const_str::*; +use super::const_str::{CERTIFICATE_NS, ENCRYPTION_NS, PASSWORD_NS}; use crate::structs::SheetProtection; use crate::structs::WorkbookProtection; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_new_line, write_start_tag}; use aes::cipher::{block_padding::NoPadding, BlockEncryptMut, KeyIvInit}; use base64::{engine::general_purpose::STANDARD, Engine as _}; use byteorder::{ByteOrder, LittleEndian}; -use cfb; use hmac::{Hmac, Mac}; use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; @@ -387,7 +386,7 @@ fn hmac(algorithm: &str, key: &[u8], buffers: Vec<&[u8]>) -> Result, Str HmacSha512::new_from_slice(key).unwrap() } _ => { - return Err(format!("algorithm {} not supported!", algorithm)); + return Err(format!("algorithm {algorithm} not supported!")); } }; mac.update(&buffer_concat(buffers)); @@ -470,7 +469,7 @@ fn hash(algorithm: &str, buffers: Vec<&[u8]>) -> Result, String> { let mut digest = match algorithm { "SHA512" | "SHA-512" => Sha512::new(), _ => { - return Err(format!("algorithm {} not supported!", algorithm)); + return Err(format!("algorithm {algorithm} not supported!")); } }; digest.update(&buffer_concat(buffers)[..]); @@ -633,7 +632,7 @@ fn build_encryption_info( write_end_tag(&mut writer, "keyEncryptors"); write_end_tag(&mut writer, "encryption"); - let result = writer.into_inner().into_inner().to_vec(); + let result = writer.into_inner().into_inner().clone(); buffer_concat(vec![ENCRYPTION_INFO_PREFIX, &result]) } @@ -656,7 +655,7 @@ fn buffer_concat(buffers: Vec<&[u8]>) -> Vec { } fn buffer_copy(buffer1: &mut [u8], buffer2: &[u8]) { for (i, byte) in buffer2.iter().enumerate() { - let _ = std::mem::replace(&mut buffer1[i], *byte); + let _unused = std::mem::replace(&mut buffer1[i], *byte); } } @@ -696,7 +695,7 @@ mod tests { fn test_encrypt() { let mut file = File::open("./tests/test_files/aaa.xlsx").unwrap(); let mut data = Vec::new(); - let _ = file.read_to_end(&mut data).unwrap(); + let _unused = file.read_to_end(&mut data).unwrap(); let password = "password"; @@ -869,7 +868,7 @@ mod tests { //assert_eq!(&converted, "0d9c888111b40b630b739c95a5f5b6be67c8f96acdd1bee185bd808b507f652760a2e77f63a6ad0c46f985f2bb8dab4fcf9b86d6a40d9c21299bb4ddf788b250"); // XML - let _ = build_encryption_info( + let _unused = build_encryption_info( &package_salt_value, package_block_size, package_key_bits, diff --git a/src/helper/date.rs b/src/helper/date.rs index c07066c9..d3d3ec43 100644 --- a/src/helper/date.rs +++ b/src/helper/date.rs @@ -3,6 +3,7 @@ use chrono::{Duration, NaiveDateTime}; pub const CALENDAR_WINDOWS_1900: &str = "1900"; pub const CALENDAR_MAC_1904: &str = "1904"; +#[must_use] pub fn excel_to_date_time_object(excel_timestamp: f64, time_zone: Option) -> NaiveDateTime { let _time_zone = match time_zone { Some(v) => v, @@ -42,6 +43,7 @@ fn get_default_timezone() -> String { } #[inline] +#[must_use] pub fn convert_date( year: i32, month: i32, @@ -54,6 +56,7 @@ pub fn convert_date( } #[inline] +#[must_use] pub fn convert_date_windows_1900( year: i32, month: i32, @@ -66,6 +69,7 @@ pub fn convert_date_windows_1900( } #[inline] +#[must_use] pub fn convert_date_mac_1904( year: i32, month: i32, @@ -77,6 +81,7 @@ pub fn convert_date_mac_1904( convert_date_crate(year, month, day, hours, minutes, seconds, false) } +#[must_use] pub fn convert_date_crate( year: i32, month: i32, @@ -114,8 +119,8 @@ pub fn convert_date_crate( + is_leap_year; // Calculate the time portion of the date - let time_in_days = ((hours * 3600 + minutes * 60 + seconds) as f64) / 86400.0; + let time_in_days = f64::from(hours * 3600 + minutes * 60 + seconds) / 86400.0; // Return the final Excel date and time - julian_date as f64 + time_in_days + f64::from(julian_date) + time_in_days } diff --git a/src/helper/formula.rs b/src/helper/formula.rs index 642aebe7..a3051ef6 100644 --- a/src/helper/formula.rs +++ b/src/helper/formula.rs @@ -1,13 +1,16 @@ -use crate::helper::address::*; -use crate::helper::coordinate::*; -use crate::helper::range::*; +use crate::helper::address::{join_address, split_address}; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, coordinate_from_index_with_lock, + index_from_coordinate, +}; +use crate::helper::range::{get_join_range, get_split_range}; use crate::structs::StringValue; use fancy_regex::Regex; /** PARTLY BASED ON: */ /** Copyright (c) 2007 E. W. Bachtal, Inc. */ -/** https://ewbi.blogs.com/develops/2007/03/excel_formula_p.html */ -/** https://ewbi.blogs.com/develops/2004/12/excel_formula_p.html */ +/** */ +/** */ #[derive(Clone, Debug, PartialEq)] pub enum FormulaTokenTypes { @@ -57,6 +60,7 @@ impl Default for FormulaToken { } impl FormulaToken { #[inline] + #[must_use] pub fn get_value(&self) -> &str { self.value.get_value_str() } @@ -68,6 +72,7 @@ impl FormulaToken { } #[inline] + #[must_use] pub fn get_token_type(&self) -> &FormulaTokenTypes { &self.token_type } @@ -79,6 +84,7 @@ impl FormulaToken { } #[inline] + #[must_use] pub fn get_token_sub_type(&self) -> &FormulaTokenSubTypes { &self.token_sub_type } @@ -113,7 +119,7 @@ pub const ERRORS: &[&str] = &[ const COMPARATORS_MULTI: &[&str] = &[">=", "<=", "<>"]; lazy_static! { - pub static ref SCIENTIFIC_REGEX: Regex = Regex::new(r#"/^[1-9]{1}(\\.\\d+)?E{1}$/"#).unwrap(); + pub static ref SCIENTIFIC_REGEX: Regex = Regex::new(r"/^[1-9]{1}(\\.\\d+)?E{1}$/").unwrap(); } pub(crate) fn parse_to_tokens>(formula: S) -> Vec { @@ -136,18 +142,18 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec let mut in_error = false; let mut index = 1; - let mut value = String::from(""); + let mut value = String::new(); while index < formula_length { // double-quoted strings // embeds are doubled // end marks token if in_string { - if formula.chars().nth(index).unwrap() == self::QUOTE_DOUBLE { + if formula.chars().nth(index).unwrap() == QUOTE_DOUBLE { if ((index + 2) <= formula_length) - && (formula.chars().nth(index + 1).unwrap() == self::QUOTE_DOUBLE) + && (formula.chars().nth(index + 1).unwrap() == QUOTE_DOUBLE) { - value = format!("{}{}", value, self::QUOTE_DOUBLE); + value = format!("{value}{QUOTE_DOUBLE}"); index += 1; } else { in_string = false; @@ -156,7 +162,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec obj.set_token_type(FormulaTokenTypes::Operand); obj.set_token_sub_type(FormulaTokenSubTypes::Text); tokens1.push(obj); - value = String::from(""); + value = String::new(); } } else { value = format!("{}{}", value, formula.chars().nth(index).unwrap()); @@ -170,11 +176,11 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec // embeds are double // end does not mark a token if in_path { - if formula.chars().nth(index).unwrap() == self::QUOTE_SINGLE { + if formula.chars().nth(index).unwrap() == QUOTE_SINGLE { if ((index + 2) <= formula_length) - && (formula.chars().nth(index + 1).unwrap() == self::QUOTE_SINGLE) + && (formula.chars().nth(index + 1).unwrap() == QUOTE_SINGLE) { - value = format!("{}{}", value, self::QUOTE_SINGLE); + value = format!("{value}{QUOTE_SINGLE}"); index += 1; } else { in_path = false; @@ -191,7 +197,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec // no embeds (changed to "()" by Excel) // end does not mark a token if in_range { - if formula.chars().nth(index).unwrap() == self::BRACKET_CLOSE { + if formula.chars().nth(index).unwrap() == BRACKET_CLOSE { in_range = false; } value = format!("{}{}", value, formula.chars().nth(index).unwrap()); @@ -204,14 +210,14 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec if in_error { value = format!("{}{}", value, formula.chars().nth(index).unwrap()); index += 1; - if self::ERRORS.iter().any(|&x| x == value.as_str()) { + if ERRORS.iter().any(|&x| x == value.as_str()) { in_error = false; let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); obj.set_token_sub_type(FormulaTokenSubTypes::Error); tokens1.push(obj); - value = String::from(""); + value = String::new(); } continue; @@ -219,7 +225,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec // scientific notation check if let Some(current_char) = formula.chars().nth(index) { - if self::OPERATORS_SN.contains(current_char) + if OPERATORS_SN.contains(current_char) && value.len() > 1 && SCIENTIFIC_REGEX .is_match(¤t_char.to_string()) @@ -234,14 +240,14 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec // independent character evaluation (order not important) // establish state-dependent character evaluations - if formula.chars().nth(index).unwrap() == self::QUOTE_DOUBLE { + if formula.chars().nth(index).unwrap() == QUOTE_DOUBLE { if !value.is_empty() { // unexpected let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Unknown); tokens1.push(obj); - value = String::from(""); + value = String::new(); } in_string = true; index += 1; @@ -249,14 +255,14 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec continue; } - if formula.chars().nth(index).unwrap() == self::QUOTE_SINGLE { + if formula.chars().nth(index).unwrap() == QUOTE_SINGLE { if !value.is_empty() { // unexpected let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Unknown); tokens1.push(obj); - value = String::from(""); + value = String::new(); } in_string = true; index += 1; @@ -264,39 +270,39 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec continue; } - if formula.chars().nth(index).unwrap() == self::BRACKET_OPEN { + if formula.chars().nth(index).unwrap() == BRACKET_OPEN { in_range = true; - value = format!("{}{}", value, self::BRACKET_OPEN); + value = format!("{value}{BRACKET_OPEN}"); index += 1; continue; } - if formula.chars().nth(index).unwrap() == self::ERROR_START { + if formula.chars().nth(index).unwrap() == ERROR_START { if !value.is_empty() { // unexpected let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Unknown); tokens1.push(obj); - value = String::from(""); + value = String::new(); } in_error = true; - value = format!("{}{}", value, self::ERROR_START); + value = format!("{value}{ERROR_START}"); index += 1; continue; } // mark start and end of arrays and array rows - if formula.chars().nth(index).unwrap() == self::BRACE_OPEN { + if formula.chars().nth(index).unwrap() == BRACE_OPEN { if !value.is_empty() { // unexpected let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Unknown); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = FormulaToken::default(); @@ -318,13 +324,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec continue; } - if formula.chars().nth(index).unwrap() == self::SEMICOLON { + if formula.chars().nth(index).unwrap() == SEMICOLON { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = stack.pop().unwrap(); @@ -349,13 +355,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec continue; } - if formula.chars().nth(index).unwrap() == self::BRACE_CLOSE { + if formula.chars().nth(index).unwrap() == BRACE_CLOSE { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = stack.pop().unwrap().clone(); @@ -374,22 +380,20 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // trim white-space - if formula.chars().nth(index).unwrap() == self::WHITESPACE { + if formula.chars().nth(index).unwrap() == WHITESPACE { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = FormulaToken::default(); obj.set_value(""); obj.set_token_type(FormulaTokenTypes::Whitespace); tokens1.push(obj); index += 1; - while (formula.chars().nth(index).unwrap() == self::WHITESPACE) - && (index < formula_length) - { + while (formula.chars().nth(index).unwrap() == WHITESPACE) && (index < formula_length) { index += 1; } @@ -407,7 +411,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = FormulaToken::default(); obj.set_value(formula.chars().skip(index).take(2).collect::()); @@ -420,13 +424,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // standard infix operators - if self::OPERATORS_INFIX.contains(formula.chars().nth(index).unwrap()) { + if OPERATORS_INFIX.contains(formula.chars().nth(index).unwrap()) { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = FormulaToken::default(); obj.set_value(formula.chars().nth(index).unwrap()); @@ -438,13 +442,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // standard postfix operators (only one) - if self::OPERATORS_POSTFIX.contains(formula.chars().nth(index).unwrap()) { + if OPERATORS_POSTFIX.contains(formula.chars().nth(index).unwrap()) { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = FormulaToken::default(); obj.set_value(formula.chars().nth(index).unwrap()); @@ -456,7 +460,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // start subexpression or function - if formula.chars().nth(index).unwrap() == self::PAREN_OPEN { + if formula.chars().nth(index).unwrap() == PAREN_OPEN { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); @@ -464,7 +468,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec obj.set_token_sub_type(FormulaTokenSubTypes::Start); tokens1.push(obj.clone()); stack.push(obj); - value = String::from(""); + value = String::new(); } else { let mut obj = FormulaToken::default(); obj.set_value(""); @@ -479,13 +483,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // function, subexpression, or array parameters, or operand unions - if formula.chars().nth(index).unwrap() == self::COMMA { + if formula.chars().nth(index).unwrap() == COMMA { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = stack.pop().unwrap(); @@ -511,13 +515,13 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } // stop subexpression - if formula.chars().nth(index).unwrap() == self::PAREN_CLOSE { + if formula.chars().nth(index).unwrap() == PAREN_CLOSE { if !value.is_empty() { let mut obj = FormulaToken::default(); obj.set_value(value); obj.set_token_type(FormulaTokenTypes::Operand); tokens1.push(obj); - value = String::from(""); + value = String::new(); } let mut obj = stack.pop().unwrap(); @@ -615,7 +619,7 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec obj.set_token_type(FormulaTokenTypes::OperatorInfix); obj.set_token_sub_type(FormulaTokenSubTypes::Intersection); tokens2.push(obj); - value = String::from(""); + value = String::new(); } // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators @@ -737,35 +741,35 @@ pub(crate) fn parse_to_tokens>(formula: S) -> Vec } pub(crate) fn render(formula_token_list: &[FormulaToken]) -> String { - let mut result = String::from(""); + let mut result = String::new(); for token in formula_token_list { if token.get_token_type() == &FormulaTokenTypes::Function && token.get_token_sub_type() == &FormulaTokenSubTypes::Start { result = format!("{}{}", result, token.get_value()); - result = format!("{}{}", result, self::PAREN_OPEN); + result = format!("{result}{PAREN_OPEN}"); } else if token.get_token_type() == &FormulaTokenTypes::Function && token.get_token_sub_type() == &FormulaTokenSubTypes::Stop { - result = format!("{}{}", result, self::PAREN_CLOSE); + result = format!("{result}{PAREN_CLOSE}"); } else if token.get_token_type() == &FormulaTokenTypes::Subexpression && token.get_token_sub_type() == &FormulaTokenSubTypes::Start { - result = format!("{}{}", result, self::PAREN_OPEN); + result = format!("{result}{PAREN_OPEN}"); } else if token.get_token_type() == &FormulaTokenTypes::Subexpression && token.get_token_sub_type() == &FormulaTokenSubTypes::Stop { - result = format!("{}{}", result, self::PAREN_CLOSE); + result = format!("{result}{PAREN_CLOSE}"); } else if token.get_token_type() == &FormulaTokenTypes::Operand && token.get_token_sub_type() == &FormulaTokenSubTypes::Text { - result = format!("{}{}", result, self::QUOTE_DOUBLE); + result = format!("{result}{QUOTE_DOUBLE}"); result = format!("{}{}", result, token.get_value()); - result = format!("{}{}", result, self::QUOTE_DOUBLE); + result = format!("{result}{QUOTE_DOUBLE}"); } else if token.get_token_type() == &FormulaTokenTypes::OperatorInfix && token.get_token_sub_type() == &FormulaTokenSubTypes::Intersection { - result = format!("{}{}", result, self::WHITESPACE); + result = format!("{result}{WHITESPACE}"); } else { result = format!("{}{}", result, token.get_value()); } @@ -815,7 +819,7 @@ pub fn adjustment_formula_coordinate( coordinate_from_index_with_lock(col_num, row_num, is_lock_col, is_lock_row); coordinate_list_new.push(new_corrdinate); } else { - coordinate_list_new.push(coordinate.to_string()); + coordinate_list_new.push((*coordinate).to_string()); } } if has_error { @@ -874,7 +878,7 @@ pub fn adjustment_insert_formula_coordinate( ); coordinate_list_new.push(new_corrdinate); } else { - coordinate_list_new.push(coordinate.to_string()); + coordinate_list_new.push((*coordinate).to_string()); } } let new_value = join_address(sheet_name, &get_join_range(&coordinate_list_new)); @@ -930,7 +934,7 @@ pub fn adjustment_remove_formula_coordinate( ); coordinate_list_new.push(new_corrdinate); } else { - coordinate_list_new.push(coordinate.to_string()); + coordinate_list_new.push((*coordinate).to_string()); } } let new_value = join_address(sheet_name, &get_join_range(&coordinate_list_new)); diff --git a/src/helper/html.rs b/src/helper/html.rs index 5ea25a92..2ad3239a 100644 --- a/src/helper/html.rs +++ b/src/helper/html.rs @@ -86,7 +86,7 @@ fn read_node(node_list: &Vec, parent_element: &[HfdElement]) -> ThinVec bool { self.name == name } #[inline] + #[must_use] pub fn get_by_name_and_attribute(&self, name: &str, attribute: &str) -> Option<&str> { self.attributes .get(attribute) .and_then(|v| (self.name == name).then_some(v)) - .map(|x| x.as_str()) + .map(String::as_str) } #[inline] + #[must_use] pub fn contains_class(&self, class: &str) -> bool { self.classes.contains(&class.to_string()) } @@ -239,7 +242,7 @@ impl AnalysisMethod for DataAnalysis { html_flat_data .element .iter() - .flat_map(|element| element.get_by_name_and_attribute("font", "color")) + .filter_map(|element| element.get_by_name_and_attribute("font", "color")) .find_map(|v| { let color = v.trim_start_matches('#').to_uppercase(); COLOR_MAP @@ -813,5 +816,5 @@ const COLOR_MAP: &[(&str, &str)] = &[ #[test] fn convert_test() { let html = r#"test
TEST
TEST
"#; - let _ = html_to_richtext(html).unwrap(); + let _unused = html_to_richtext(html).unwrap(); } diff --git a/src/helper/number_format.rs b/src/helper/number_format.rs index 6458ec8d..1d80afcd 100644 --- a/src/helper/number_format.rs +++ b/src/helper/number_format.rs @@ -16,6 +16,7 @@ pub struct Split<'r, 't> { } #[inline] +#[must_use] pub fn split<'r, 't>(regex: &'r Regex, text: &'t str) -> Split<'r, 't> { Split { finder: regex.find_iter(text), @@ -128,18 +129,18 @@ fn split_format(sections: Vec<&str>, value: f64) -> (String, String, String) { let cond_re = Regex::new(cond_regex).unwrap(); let mut colors = [ - String::from(""), - String::from(""), - String::from(""), - String::from(""), - String::from(""), + String::new(), + String::new(), + String::new(), + String::new(), + String::new(), ]; let mut condops = [ - String::from(""), - String::from(""), - String::from(""), - String::from(""), - String::from(""), + String::new(), + String::new(), + String::new(), + String::new(), + String::new(), ]; let mut condvals = [ String::from("0"), diff --git a/src/helper/number_format/date_formater.rs b/src/helper/number_format/date_formater.rs index 383df289..c5d1d5e7 100644 --- a/src/helper/number_format/date_formater.rs +++ b/src/helper/number_format/date_formater.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use crate::helper::date::*; +use crate::helper::date::excel_to_date_time_object; use fancy_regex::Captures; use fancy_regex::Regex; @@ -61,7 +61,7 @@ pub(crate) fn format_as_date(value: f64, format: &str) -> Cow { // language info is in hexadecimal // strip off chinese part like [DBNum1][$-804] let re = Regex::new(r"^(\[[0-9A-Za-z]*\])*(\[\$[A-Z]*-[0-9A-F]*\])").unwrap(); - let format = re.replace_all(&format, r#""#); + let format = re.replace_all(&format, r""); // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case; // but we don't want to change any quoted strings @@ -102,7 +102,7 @@ pub(crate) fn format_as_date(value: f64, format: &str) -> Cow { converted_blocks.push(block); i += 1; } - format = Cow::Owned(converted_blocks.join(r#""#)); + format = Cow::Owned(converted_blocks.join(r"")); // escape any quoted characters so that DateTime format() will render them correctly let re = Regex::new(r#""(.*)""#).unwrap(); diff --git a/src/helper/number_format/fraction_formater.rs b/src/helper/number_format/fraction_formater.rs index 34ac7ea0..48db0cfa 100644 --- a/src/helper/number_format/fraction_formater.rs +++ b/src/helper/number_format/fraction_formater.rs @@ -42,7 +42,7 @@ pub(crate) fn format_as_fraction(value: f64, format: &str) -> String { if check_format == "? ?" { let mut integer_part_str = integer_part.to_string(); if integer_part == 0f64 { - integer_part_str = String::from(""); + integer_part_str = String::new(); } result = format!( "{}{} {}/{}", diff --git a/src/helper/number_format/number_formater.rs b/src/helper/number_format/number_formater.rs index c9631166..7b84fac8 100644 --- a/src/helper/number_format/number_formater.rs +++ b/src/helper/number_format/number_formater.rs @@ -1,12 +1,12 @@ -use super::fraction_formater::*; +use super::fraction_formater::format_as_fraction; use fancy_regex::Regex; use std::borrow::Cow; use thousands::Separable; pub(crate) fn format_as_number(value: f64, format: &str) -> Cow { lazy_static! { - static ref THOUSANDS_SEP_REGEX: Regex = Regex::new(r#"(#,#|0,0)"#).unwrap(); - static ref SCALE_REGEX: Regex = Regex::new(r#"(#|0)(,+)"#).unwrap(); + static ref THOUSANDS_SEP_REGEX: Regex = Regex::new(r"(#,#|0,0)").unwrap(); + static ref SCALE_REGEX: Regex = Regex::new(r"(#|0)(,+)").unwrap(); static ref TRAILING_COMMA_REGEX: Regex = Regex::new("(#|0),+").unwrap(); static ref FRACTION_REGEX: Regex = Regex::new(r"#?.*\?{1,2}\/\?{1,2}").unwrap(); static ref SQUARE_BRACKET_REGEX: Regex = Regex::new(r"\[[^\]]+\]").unwrap(); @@ -45,10 +45,10 @@ pub(crate) fn format_as_number(value: f64, format: &str) -> Cow { for ite in SCALE_REGEX.captures(&format).ok().flatten().unwrap().iter() { matches.push(ite.unwrap().as_str().to_string()); } - scale = 1000i32.pow(matches[2].len() as u32) as f64; + scale = f64::from(1000i32.pow(matches[2].len() as u32)); // strip the commas - format = TRAILING_COMMA_REGEX.replace_all(&format, "$1").into() + format = TRAILING_COMMA_REGEX.replace_all(&format, "$1").into(); } if FRACTION_REGEX.is_match(&format).unwrap_or(false) { if value.parse::().is_err() { @@ -117,9 +117,9 @@ fn format_straight_numeric_value( value = value.parse::().unwrap().separate_with_commas(); } let blocks: Vec<&str> = value.split('.').collect(); - let left_value = blocks.first().unwrap().to_string(); + let left_value = (*blocks.first().unwrap()).to_string(); let mut right_value = match blocks.get(1) { - Some(v) => v.to_string(), + Some(v) => (*v).to_string(), None => String::from("0"), }; if right.is_empty() { @@ -141,7 +141,7 @@ fn format_straight_numeric_value( right_value = right_value_conv; } } - value = format!("{}.{}", left_value, right_value); + value = format!("{left_value}.{right_value}"); value // if use_thousands == true { @@ -189,7 +189,7 @@ fn merge_complex_number_format_masks(numbers: &[String], masks: &[String]) -> Ve fn process_complex_number_format_mask(number: f64, mask: &str) -> String { let mut result = number.to_string(); let mut mask = mask.to_string(); - let re = Regex::new(r#"0+"#).unwrap(); + let re = Regex::new(r"0+").unwrap(); let mut masking_blocks: Vec<(String, usize)> = Vec::new(); let mut masking_str: Vec = Vec::new(); let mut masking_beg: Vec = Vec::new(); diff --git a/src/helper/range.rs b/src/helper/range.rs index 24e29eed..de7c9cee 100644 --- a/src/helper/range.rs +++ b/src/helper/range.rs @@ -1,10 +1,11 @@ -use crate::helper::coordinate::*; +use crate::helper::coordinate::index_from_coordinate; /// `(col, row)` pub type BasicCellIndex = (u32, u32); /// # Returns /// `Vec<(col, row)>` +#[must_use] pub fn get_coordinate_list(range_str: &str) -> Vec { let (row_start, row_end, col_start, col_end) = get_start_and_end_point(range_str); @@ -13,6 +14,7 @@ pub fn get_coordinate_list(range_str: &str) -> Vec { .collect() } +#[must_use] pub fn get_start_and_end_point(range_str: &str) -> (u32, u32, u32, u32) { let coordinate_collection: Vec<&str> = range_str.split(':').collect(); @@ -65,11 +67,13 @@ pub fn get_start_and_end_point(range_str: &str) -> (u32, u32, u32, u32) { } #[inline] +#[must_use] pub fn get_split_range(range: &str) -> Vec<&str> { range.split(':').collect() } #[inline] +#[must_use] pub fn get_join_range(coordinate_list: &[String]) -> String { coordinate_list.join(":") } diff --git a/src/helper/string_helper.rs b/src/helper/string_helper.rs index f35830f8..b10b51c4 100644 --- a/src/helper/string_helper.rs +++ b/src/helper/string_helper.rs @@ -1,6 +1,6 @@ #[inline] pub(crate) fn _get_currency_code() -> String { - String::from("") + String::new() } #[inline] diff --git a/src/lib.rs b/src/lib.rs index 8f58c107..7b377c3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ //! let mut book = new_file(); //! //! // new worksheet -//! let _ = book.new_sheet("Sheet2"); +//! let _unused = book.new_sheet("Sheet2"); //! ``` //! ### Copy worksheet //! ```rust @@ -31,13 +31,13 @@ //! //! let mut clone_sheet = book.get_sheet(0).unwrap().clone(); //! clone_sheet.set_name("New Sheet"); -//! let _ = book.add_sheet(clone_sheet); +//! let _unused = book.add_sheet(clone_sheet); //! ``` //! ### Change value //! ```rust //! use umya_spreadsheet::*; //! let mut book = new_file(); -//! let _ = book.new_sheet("Sheet2"); +//! let _unused = book.new_sheet("Sheet2"); //! //! // change value //! book.get_sheet_by_name_mut("Sheet2").unwrap().get_cell_mut("A1").set_value("TEST1"); @@ -52,7 +52,7 @@ //! ```rust //! use umya_spreadsheet::*; //! let mut book = new_file(); -//! let _ = book.new_sheet("Sheet2"); +//! let _unused = book.new_sheet("Sheet2"); //! book.get_sheet_by_name_mut("Sheet2").unwrap().get_cell_mut("A1").set_value("TEST1"); //! //! // read value @@ -68,7 +68,7 @@ //! ```rust //! use umya_spreadsheet::*; //! let mut book = new_file(); -//! let _ = book.new_sheet("Sheet2"); +//! let _unused = book.new_sheet("Sheet2"); //! //! // add bottom border //! book.get_sheet_by_name_mut("Sheet2").unwrap() @@ -109,16 +109,13 @@ //! ```rust //! use umya_spreadsheet::*; //! let mut book = new_file(); -//! let _ = book.new_sheet("Sheet2"); +//! let _unused = book.new_sheet("Sheet2"); //! //! // writer //! let path = std::path::Path::new("C:/spread_test_data/ccc.xlsx"); -//! let _ = writer::xlsx::write(&book, path); +//! let _unused = writer::xlsx::write(&book, path); //! ``` -#![deny(clippy::correctness)] -#![warn(clippy::style, clippy::complexity, clippy::perf, clippy::trivially_copy_pass_by_ref)] - extern crate chrono; extern crate fancy_regex; #[cfg(feature = "image")] @@ -158,9 +155,10 @@ pub use self::structs::*; /// ``` /// let mut book = umya_spreadsheet::new_file(); /// ``` -pub fn new_file() -> structs::Spreadsheet { - let mut spreadsheet = structs::Spreadsheet::default(); - spreadsheet.set_theme(structs::drawing::Theme::get_default_value()); +#[must_use] +pub fn new_file() -> Spreadsheet { + let mut spreadsheet = Spreadsheet::default(); + spreadsheet.set_theme(drawing::Theme::get_default_value()); spreadsheet.set_stylesheet_defalut_value(); let worksheet = spreadsheet.new_sheet("Sheet1").unwrap(); worksheet.set_active_cell("A1"); @@ -184,9 +182,10 @@ pub fn new_file() -> structs::Spreadsheet { /// ``` /// let mut book = umya_spreadsheet::new_file_empty_worksheet(); /// ``` -pub fn new_file_empty_worksheet() -> structs::Spreadsheet { - let mut spreadsheet = structs::Spreadsheet::default(); - spreadsheet.set_theme(structs::drawing::Theme::get_default_value()); +#[must_use] +pub fn new_file_empty_worksheet() -> Spreadsheet { + let mut spreadsheet = Spreadsheet::default(); + spreadsheet.set_theme(drawing::Theme::get_default_value()); spreadsheet.set_stylesheet_defalut_value(); spreadsheet } diff --git a/src/reader/driver.rs b/src/reader/driver.rs index 6f41b3f1..ffbf1105 100644 --- a/src/reader/driver.rs +++ b/src/reader/driver.rs @@ -38,7 +38,7 @@ pub(crate) use crate::set_string_from_xml; pub(crate) fn normalize_path(path: &str) -> PathBuf { let path = Path::new(path); let mut components = path.components().peekable(); - let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { + let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().copied() { components.next(); PathBuf::from(c.as_os_str()) } else { @@ -67,7 +67,7 @@ pub(crate) fn normalize_path(path: &str) -> PathBuf { pub(crate) fn join_paths(base_path: &str, target: &str) -> String { match target.split_once('/') { Some(("", target)) => normalize_path_to_str(target), - _ => normalize_path_to_str(&format!("{}/{}", base_path, target)), + _ => normalize_path_to_str(&format!("{base_path}/{target}")), } } diff --git a/src/reader/xlsx.rs b/src/reader/xlsx.rs index fe110411..0a1462e6 100644 --- a/src/reader/xlsx.rs +++ b/src/reader/xlsx.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use std::sync::RwLock; use super::driver; -use crate::helper::const_str::*; +use crate::helper::const_str::{COMMENTS_NS, DRAWINGS_NS, TABLE_NS, THEME_NS, VML_DRAWING_NS}; use crate::structs::drawing::Theme; use crate::structs::raw::RawWorksheet; use crate::structs::SharedStringTable; diff --git a/src/reader/xlsx/chart.rs b/src/reader/xlsx/chart.rs index 2d47ba74..638df392 100644 --- a/src/reader/xlsx/chart.rs +++ b/src/reader/xlsx/chart.rs @@ -4,12 +4,8 @@ use crate::structs::raw::RawFile; use crate::xml_read_loop; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; -pub(crate) fn read( - raw_file: &RawFile, - chart_space: &mut ChartSpace, -) -> result::Result<(), XlsxError> { +pub(crate) fn read(raw_file: &RawFile, chart_space: &mut ChartSpace) -> Result<(), XlsxError> { let data = std::io::Cursor::new(raw_file.get_file_data()); let mut reader = Reader::from_reader(data); diff --git a/src/reader/xlsx/comment.rs b/src/reader/xlsx/comment.rs index 7145e3a8..3b471b27 100644 --- a/src/reader/xlsx/comment.rs +++ b/src/reader/xlsx/comment.rs @@ -5,23 +5,19 @@ use crate::structs::Worksheet; use crate::xml_read_loop; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; -pub(crate) fn read( - worksheet: &mut Worksheet, - drawing_file: &RawFile, -) -> result::Result<(), XlsxError> { +pub(crate) fn read(worksheet: &mut Worksheet, drawing_file: &RawFile) -> Result<(), XlsxError> { let data = std::io::Cursor::new(drawing_file.get_file_data()); let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(false); let mut authors: Vec = Vec::new(); - let mut value: String = String::from(""); + let mut value: String = String::new(); xml_read_loop!( reader, Event::Empty(ref e) => { if e.name().into_inner() == b"author" { - authors.push(String::from("")); + authors.push(String::new()); } }, Event::Start(ref e) => { diff --git a/src/reader/xlsx/content_types.rs b/src/reader/xlsx/content_types.rs index 197261ac..c0ee4f06 100644 --- a/src/reader/xlsx/content_types.rs +++ b/src/reader/xlsx/content_types.rs @@ -1,15 +1,15 @@ -use super::driver::*; +use super::driver::{get_attribute, xml_read_loop}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::CONTENT_TYPES; use crate::structs::Spreadsheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(arv.by_name(CONTENT_TYPES)?); let mut reader = Reader::from_reader(r); reader.config_mut().trim_text(true); diff --git a/src/reader/xlsx/doc_props_app.rs b/src/reader/xlsx/doc_props_app.rs index ad8a9263..0b1acb74 100644 --- a/src/reader/xlsx/doc_props_app.rs +++ b/src/reader/xlsx/doc_props_app.rs @@ -1,15 +1,15 @@ use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_APP; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; use crate::structs::Spreadsheet; pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(match arv.by_name(ARC_APP) { Ok(v) => v, Err(zip::result::ZipError::FileNotFound) => { diff --git a/src/reader/xlsx/doc_props_core.rs b/src/reader/xlsx/doc_props_core.rs index 37bdd699..2781b0ad 100644 --- a/src/reader/xlsx/doc_props_core.rs +++ b/src/reader/xlsx/doc_props_core.rs @@ -1,15 +1,15 @@ use super::XlsxError; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_CORE; use crate::structs::Spreadsheet; pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(match arv.by_name(ARC_CORE) { Ok(v) => v, Err(zip::result::ZipError::FileNotFound) => { diff --git a/src/reader/xlsx/doc_props_custom.rs b/src/reader/xlsx/doc_props_custom.rs index 28d3e184..81cc9dcf 100644 --- a/src/reader/xlsx/doc_props_custom.rs +++ b/src/reader/xlsx/doc_props_custom.rs @@ -1,15 +1,15 @@ use super::XlsxError; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_CUSTOM; use crate::structs::Spreadsheet; pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(match arv.by_name(ARC_CUSTOM) { Ok(v) => v, Err(zip::result::ZipError::FileNotFound) => { diff --git a/src/reader/xlsx/drawing.rs b/src/reader/xlsx/drawing.rs index 107a3185..bacee034 100644 --- a/src/reader/xlsx/drawing.rs +++ b/src/reader/xlsx/drawing.rs @@ -6,13 +6,12 @@ use crate::structs::raw::RawRelationships; use crate::structs::Worksheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; pub(crate) fn read( worksheet: &mut Worksheet, drawing_file: &RawFile, drawing_relationships: Option<&RawRelationships>, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let data = std::io::Cursor::new(drawing_file.get_file_data()); let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(true); diff --git a/src/reader/xlsx/pivot_table.rs b/src/reader/xlsx/pivot_table.rs index 38f71b69..b8cd4bdd 100644 --- a/src/reader/xlsx/pivot_table.rs +++ b/src/reader/xlsx/pivot_table.rs @@ -5,13 +5,9 @@ use crate::structs::PivotTableDefinition; use crate::structs::Worksheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; #[allow(dead_code)] -pub(crate) fn read( - worksheet: &mut Worksheet, - pivot_table_file: &RawFile, -) -> result::Result<(), XlsxError> { +pub(crate) fn read(worksheet: &mut Worksheet, pivot_table_file: &RawFile) -> Result<(), XlsxError> { let data = std::io::Cursor::new(pivot_table_file.get_file_data()); let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(false); diff --git a/src/reader/xlsx/shared_strings.rs b/src/reader/xlsx/shared_strings.rs index 03ea1e8e..474d94a4 100644 --- a/src/reader/xlsx/shared_strings.rs +++ b/src/reader/xlsx/shared_strings.rs @@ -1,17 +1,17 @@ use crate::xml_read_loop; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_SHARED_STRINGS; use crate::structs::SharedStringTable; use crate::structs::Spreadsheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(match arv.by_name(PKG_SHARED_STRINGS) { Ok(v) => v, Err(zip::result::ZipError::FileNotFound) => { diff --git a/src/reader/xlsx/styles.rs b/src/reader/xlsx/styles.rs index 57918213..e8f53a2e 100644 --- a/src/reader/xlsx/styles.rs +++ b/src/reader/xlsx/styles.rs @@ -1,17 +1,17 @@ use crate::xml_read_loop; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_STYLES; use crate::structs::Spreadsheet; use crate::structs::Stylesheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; pub fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let r = io::BufReader::new(arv.by_name(PKG_STYLES)?); let mut reader = Reader::from_reader(r); reader.config_mut().trim_text(true); diff --git a/src/reader/xlsx/table.rs b/src/reader/xlsx/table.rs index e530ed93..a6a72125 100644 --- a/src/reader/xlsx/table.rs +++ b/src/reader/xlsx/table.rs @@ -1,23 +1,19 @@ -use super::driver::*; +use super::driver::get_attribute_value; use super::XlsxError; use crate::structs::raw::RawFile; use crate::structs::Worksheet; use crate::structs::{Table, TableColumn, TableStyleInfo}; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; -pub(crate) fn read( - worksheet: &mut Worksheet, - table_file: &RawFile, -) -> result::Result<(), XlsxError> { +pub(crate) fn read(worksheet: &mut Worksheet, table_file: &RawFile) -> Result<(), XlsxError> { let data = std::io::Cursor::new(table_file.get_file_data()); let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(false); let mut buf = Vec::new(); let mut table = Table::default(); let mut table_column = TableColumn::default(); - let mut string_value = String::from(""); + let mut string_value = String::new(); loop { match reader.read_event_into(&mut buf) { Ok(Event::Empty(ref e)) => match e.name().into_inner() { @@ -138,7 +134,7 @@ pub(crate) fn read( Ok(Event::End(ref e)) => match e.name().into_inner() { b"calculatedColumnFormula" => { table_column.set_calculated_column_formula(string_value); - string_value = String::from(""); + string_value = String::new(); } b"tableColumn" => { // add column to table (if it has a name) diff --git a/src/reader/xlsx/theme.rs b/src/reader/xlsx/theme.rs index 0fd302ff..0d067f87 100644 --- a/src/reader/xlsx/theme.rs +++ b/src/reader/xlsx/theme.rs @@ -3,13 +3,13 @@ use crate::structs::drawing::Theme; use crate::xml_read_loop; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; pub fn read( arv: &mut zip::ZipArchive, target: &str, -) -> result::Result { - let r = io::BufReader::new(arv.by_name(&format!("xl/{}", target))?); +) -> Result { + let r = io::BufReader::new(arv.by_name(&format!("xl/{target}"))?); let mut reader = Reader::from_reader(r); reader.config_mut().trim_text(true); diff --git a/src/reader/xlsx/vba_project_bin.rs b/src/reader/xlsx/vba_project_bin.rs index b0b3fd5d..7f1a8e1b 100644 --- a/src/reader/xlsx/vba_project_bin.rs +++ b/src/reader/xlsx/vba_project_bin.rs @@ -1,14 +1,14 @@ use super::XlsxError; +use std::io; use std::io::Read; -use std::{io, result}; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_VBA_PROJECT; use crate::structs::Spreadsheet; -pub(crate) fn read( +pub(crate) fn read( arv: &mut zip::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let mut r = io::BufReader::new(match arv.by_name(PKG_VBA_PROJECT) { Ok(v) => v, Err(zip::result::ZipError::FileNotFound) => { diff --git a/src/reader/xlsx/vml_drawing.rs b/src/reader/xlsx/vml_drawing.rs index 3d2a2875..41d2e759 100644 --- a/src/reader/xlsx/vml_drawing.rs +++ b/src/reader/xlsx/vml_drawing.rs @@ -6,13 +6,12 @@ use crate::structs::Worksheet; use crate::xml_read_loop; use quick_xml::events::Event; use quick_xml::Reader; -use std::result; pub(crate) fn read( worksheet: &mut Worksheet, drawing_file: &RawFile, drawing_relationships: Option<&RawRelationships>, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { let data = std::io::Cursor::new(drawing_file.get_file_data()); let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(true); @@ -26,22 +25,19 @@ pub(crate) fn read( if e.name().into_inner() == b"v:shape" { let mut obj = Shape::default(); obj.set_attributes(&mut reader, e, drawing_relationships); - match obj.get_client_data().get_comment_column_target() { - Some(_) => { - worksheet - .get_comments_mut() - .get_mut(comment_index) - .map(|comment| comment.set_shape(obj)); - comment_index += 1; - } - None => { - worksheet - .get_ole_objects_mut() - .get_ole_object_mut() - .get_mut(ole_index) - .map(|ole_obj| ole_obj.set_shape(obj)); - ole_index += 1; - } + if obj.get_client_data().get_comment_column_target().is_some() { + worksheet + .get_comments_mut() + .get_mut(comment_index) + .map(|comment| comment.set_shape(obj)); + comment_index += 1; + } else { + worksheet + .get_ole_objects_mut() + .get_ole_object_mut() + .get_mut(ole_index) + .map(|ole_obj| ole_obj.set_shape(obj)); + ole_index += 1; } } }, diff --git a/src/reader/xlsx/workbook.rs b/src/reader/xlsx/workbook.rs index 8acb89b6..32414b25 100644 --- a/src/reader/xlsx/workbook.rs +++ b/src/reader/xlsx/workbook.rs @@ -1,13 +1,13 @@ use crate::xml_read_loop; -use super::driver::*; +use super::driver::get_attribute; use super::XlsxError; use quick_xml::escape; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_WORKBOOK; use crate::structs::DefinedName; use crate::structs::Spreadsheet; use crate::structs::WorkbookProtection; @@ -16,7 +16,7 @@ use crate::structs::Worksheet; pub(crate) fn read( arv: &mut zip::read::ZipArchive, -) -> result::Result { +) -> Result { let r = io::BufReader::new(arv.by_name(PKG_WORKBOOK)?); let mut reader = Reader::from_reader(r); reader.config_mut().trim_text(true); @@ -55,7 +55,7 @@ pub(crate) fn read( b"pivotCache" => { let cache_id = get_attribute(e, b"cacheId").unwrap(); let r_id = get_attribute(e, b"r:id").unwrap(); - spreadsheet.add_pivot_caches((r_id, cache_id, String::from(""))); + spreadsheet.add_pivot_caches((r_id, cache_id, String::new())); } _ => (), } diff --git a/src/reader/xlsx/workbook_rels.rs b/src/reader/xlsx/workbook_rels.rs index d1210582..53909f0d 100644 --- a/src/reader/xlsx/workbook_rels.rs +++ b/src/reader/xlsx/workbook_rels.rs @@ -1,15 +1,15 @@ -use super::driver::*; +use super::driver::{get_attribute, xml_read_loop}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{PIVOT_CACHE_DEF_NS, PKG_WORKBOOK_RELS}; use crate::structs::Spreadsheet; use quick_xml::events::Event; use quick_xml::Reader; -use std::{io, result}; +use std::io; pub(crate) fn read( arv: &mut zip::read::ZipArchive, spreadsheet: &mut Spreadsheet, -) -> result::Result, XlsxError> { +) -> Result, XlsxError> { let r = io::BufReader::new(arv.by_name(PKG_WORKBOOK_RELS)?); let mut reader = Reader::from_reader(r); reader.config_mut().trim_text(true); @@ -25,7 +25,7 @@ pub(crate) fn read( let target_value = get_attribute(e, b"Target").unwrap(); let target_value = target_value .strip_prefix("/xl/") - .map(|t| t.to_owned()) + .map(ToOwned::to_owned) .unwrap_or(target_value); if type_value == PIVOT_CACHE_DEF_NS { spreadsheet.update_pivot_caches(id_value, target_value); diff --git a/src/reader/xlsx/worksheet.rs b/src/reader/xlsx/worksheet.rs index 553dfd7c..9c279b7a 100644 --- a/src/reader/xlsx/worksheet.rs +++ b/src/reader/xlsx/worksheet.rs @@ -1,10 +1,10 @@ -use super::driver::*; +use super::driver::{get_attribute, get_attribute_value, xml_read_loop}; use super::XlsxError; use quick_xml::events::Event; use quick_xml::Reader; use std::collections::HashMap; -use crate::helper::formula::*; +use crate::helper::formula::FormulaToken; use crate::structs::office2010::excel::DataValidations as DataValidations2010; use crate::structs::raw::RawRelationships; use crate::structs::raw::RawWorksheet; diff --git a/src/structs/address.rs b/src/structs/address.rs index feaa19f8..b1973046 100644 --- a/src/structs/address.rs +++ b/src/structs/address.rs @@ -1,6 +1,6 @@ use super::Range; -use crate::helper::address::*; -use crate::helper::coordinate::*; +use crate::helper::address::split_address; +use crate::helper::coordinate::index_from_coordinate; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentCoordinateWithSheet; use fancy_regex::Regex; @@ -13,6 +13,7 @@ pub struct Address { impl Address { #[inline] + #[must_use] pub fn get_sheet_name(&self) -> &str { &self.sheet_name } @@ -24,6 +25,7 @@ impl Address { } #[inline] + #[must_use] pub fn get_range(&self) -> &Range { &self.range } @@ -50,6 +52,7 @@ impl Address { } #[inline] + #[must_use] pub fn get_address(&self) -> String { self.get_address_crate(false) } @@ -70,14 +73,14 @@ impl Address { with_space_char = "'"; } if is_ptn2 { - if sheet_name.contains("!") { + if sheet_name.contains('!') { with_space_char = "'"; } - if sheet_name.contains("'") { + if sheet_name.contains('\'') { with_space_char = "'"; - sheet_name = sheet_name.replace("'", "''").into_boxed_str(); + sheet_name = sheet_name.replace('\'', "''").into_boxed_str(); } - if sheet_name.contains(r#"""#) { + if sheet_name.contains('"') { with_space_char = "'"; } if with_space_char.is_empty() { diff --git a/src/structs/alignment.rs b/src/structs/alignment.rs index 91c9cc9c..d664b323 100644 --- a/src/structs/alignment.rs +++ b/src/structs/alignment.rs @@ -4,8 +4,8 @@ use super::EnumValue; use super::HorizontalAlignmentValues; use super::UInt32Value; use super::VerticalAlignmentValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use md5::Digest; use quick_xml::events::BytesStart; use quick_xml::Reader; @@ -22,6 +22,7 @@ pub struct Alignment { impl Alignment { #[inline] + #[must_use] pub fn get_horizontal(&self) -> &HorizontalAlignmentValues { self.horizontal.get_value() } @@ -32,6 +33,7 @@ impl Alignment { } #[inline] + #[must_use] pub fn get_vertical(&self) -> &VerticalAlignmentValues { self.vertical.get_value() } @@ -42,6 +44,7 @@ impl Alignment { } #[inline] + #[must_use] pub fn get_wrap_text(&self) -> bool { self.wrap_text.get_value() } @@ -52,6 +55,7 @@ impl Alignment { } #[inline] + #[must_use] pub fn get_text_rotation(&self) -> u32 { self.text_rotation.get_value() } diff --git a/src/structs/anchor.rs b/src/structs/anchor.rs index f97327f9..f42f5b75 100644 --- a/src/structs/anchor.rs +++ b/src/structs/anchor.rs @@ -12,6 +12,7 @@ pub struct Anchor { impl Anchor { #[inline] + #[must_use] pub fn get_left_column(&self) -> u32 { self.left_column } @@ -22,6 +23,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_left_offset(&self) -> u32 { self.left_offset } @@ -32,6 +34,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_top_row(&self) -> u32 { self.top_row } @@ -42,6 +45,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_top_offset(&self) -> u32 { self.top_offset } @@ -52,6 +56,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_right_column(&self) -> u32 { self.right_column } @@ -62,6 +67,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_right_offset(&self) -> u32 { self.right_offset } @@ -72,6 +78,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_bottom_row(&self) -> u32 { self.bottom_row } @@ -82,6 +89,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_bottom_offset(&self) -> u32 { self.bottom_offset } diff --git a/src/structs/auto_filter.rs b/src/structs/auto_filter.rs index 0051968e..f8f66bc7 100644 --- a/src/structs/auto_filter.rs +++ b/src/structs/auto_filter.rs @@ -8,6 +8,7 @@ pub struct AutoFilter { impl AutoFilter { #[inline] + #[must_use] pub fn get_range(&self) -> &Range { &self.range } diff --git a/src/structs/bold.rs b/src/structs/bold.rs index 9c3f00a9..9148892c 100644 --- a/src/structs/bold.rs +++ b/src/structs/bold.rs @@ -1,7 +1,7 @@ // b use super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Bold { impl Bold { #[inline] + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/border.rs b/src/structs/border.rs index 5e0150d3..fe014201 100644 --- a/src/structs/border.rs +++ b/src/structs/border.rs @@ -2,8 +2,8 @@ use super::BorderStyleValues; use super::Color; use super::EnumValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -18,6 +18,7 @@ pub struct Border { impl Border { #[inline] + #[must_use] pub fn get_color(&self) -> &Color { &self.color } @@ -34,6 +35,7 @@ impl Border { } #[inline] + #[must_use] pub fn get_style(&self) -> &BorderStyleValues { self.style.get_value() } @@ -61,6 +63,7 @@ impl Border { pub const BORDER_THIN: &'static str = "thin"; #[inline] + #[must_use] pub fn get_border_style(&self) -> &str { self.style.get_value_string() } diff --git a/src/structs/borders.rs b/src/structs/borders.rs index e3c19295..6bc23cf1 100644 --- a/src/structs/borders.rs +++ b/src/structs/borders.rs @@ -1,8 +1,8 @@ // border use super::BooleanValue; use super::Border; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; diff --git a/src/structs/borders_crate.rs b/src/structs/borders_crate.rs index 516d1688..ade63bd1 100644 --- a/src/structs/borders_crate.rs +++ b/src/structs/borders_crate.rs @@ -1,8 +1,8 @@ // borders use super::Borders; use super::Style; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/break.rs b/src/structs/break.rs index 0ca210d0..267f42f6 100644 --- a/src/structs/break.rs +++ b/src/structs/break.rs @@ -1,8 +1,8 @@ // brk -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::BooleanValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct Break { impl Break { #[inline] + #[must_use] pub fn get_id(&self) -> u32 { self.id.get_value() } @@ -29,6 +30,7 @@ impl Break { } #[inline] + #[must_use] pub fn get_max(&self) -> u32 { self.max.get_value() } @@ -40,6 +42,7 @@ impl Break { } #[inline] + #[must_use] pub fn get_manual_page_break(&self) -> bool { self.manual_page_break.get_value() } diff --git a/src/structs/cache_field.rs b/src/structs/cache_field.rs index 2ea0cac9..deaeff4f 100644 --- a/src/structs/cache_field.rs +++ b/src/structs/cache_field.rs @@ -1,9 +1,9 @@ // cacheField -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::SharedItems; use crate::structs::StringValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct CacheField { shared_items: SharedItems, } impl CacheField { + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -26,6 +27,7 @@ impl CacheField { self } + #[must_use] pub fn get_number_format_id(&self) -> u32 { self.number_format_id.get_value() } @@ -35,6 +37,7 @@ impl CacheField { self } + #[must_use] pub fn get_shared_items(&self) -> &SharedItems { &self.shared_items } diff --git a/src/structs/cache_fields.rs b/src/structs/cache_fields.rs index 853b8ade..74f89909 100644 --- a/src/structs/cache_fields.rs +++ b/src/structs/cache_fields.rs @@ -1,7 +1,7 @@ // cacheFields -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::CacheField; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct CacheFields { list: Vec, } impl CacheFields { + #[must_use] pub fn get_list(&self) -> &Vec { &self.list } diff --git a/src/structs/cache_source.rs b/src/structs/cache_source.rs index 00a9253e..7c25c370 100644 --- a/src/structs/cache_source.rs +++ b/src/structs/cache_source.rs @@ -3,8 +3,8 @@ use crate::structs::EnumValue; use crate::structs::SourceValues; use crate::structs::WorksheetSource; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct CacheSource { } impl CacheSource { + #[must_use] pub fn get_type(&self) -> &SourceValues { self.r#type.get_value() } @@ -26,6 +27,7 @@ impl CacheSource { self } + #[must_use] pub fn get_worksheet_source(&self) -> Option<&WorksheetSource> { self.worksheet_source.as_ref() } @@ -81,7 +83,7 @@ impl CacheSource { if !empty_flg { // worksheetSource if let Some(v) = &self.worksheet_source { - v.write_to(writer) + v.write_to(writer); } write_end_tag(writer, "cacheSource"); } diff --git a/src/structs/cell.rs b/src/structs/cell.rs index 9b623e60..e232db30 100644 --- a/src/structs/cell.rs +++ b/src/structs/cell.rs @@ -1,7 +1,9 @@ -use crate::helper::coordinate::*; -use crate::helper::formula::*; -use crate::helper::number_format::*; -use crate::reader::driver::*; +use crate::helper::coordinate::CellCoordinates; +use crate::helper::formula::{ + adjustment_formula_coordinate, parse_to_tokens, render, FormulaToken, +}; +use crate::helper::number_format::to_formatted_string; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::CellFormula; use crate::structs::CellFormulaValues; use crate::structs::CellRawValue; @@ -17,7 +19,9 @@ use crate::structs::Stylesheet; use crate::structs::UInt32Value; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentCoordinateWith2Sheet; -use crate::writer::driver::*; +use crate::writer::driver::{ + write_end_tag, write_start_tag, write_text_node, write_text_node_conversion, +}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -36,6 +40,7 @@ pub struct Cell { } impl Cell { #[inline] + #[must_use] pub fn get_cell_value(&self) -> &CellValue { &self.cell_value } @@ -52,6 +57,7 @@ impl Cell { } #[inline] + #[must_use] pub fn get_style(&self) -> &Style { &self.style } @@ -68,6 +74,7 @@ impl Cell { } #[inline] + #[must_use] pub fn get_coordinate(&self) -> &Coordinate { &self.coordinate } @@ -91,7 +98,7 @@ impl Cell { let org_row_num = self.coordinate.get_row_num(); let offset_col_num = col as i32 - org_col_num as i32; let offset_row_num = row as i32 - org_row_num as i32; - let mut tokens = parse_to_tokens(format!("={}", formula)); + let mut tokens = parse_to_tokens(format!("={formula}")); adjustment_formula_coordinate(&mut tokens, offset_col_num, offset_row_num); let result_formula = render(tokens.as_ref()); self.cell_value.set_formula(result_formula); @@ -102,6 +109,7 @@ impl Cell { } #[inline] + #[must_use] pub fn get_hyperlink(&self) -> Option<&Hyperlink> { self.hyperlink.as_deref() } @@ -122,6 +130,7 @@ impl Cell { } #[inline] + #[must_use] pub fn get_cell_meta_index(&self) -> u32 { self.cell_meta_index.get_value() } @@ -133,11 +142,13 @@ impl Cell { } #[inline] + #[must_use] pub fn get_value(&self) -> Cow<'static, str> { self.cell_value.get_value() } #[inline] + #[must_use] pub fn get_value_number(&self) -> Option { self.cell_value.get_value_number() } @@ -243,11 +254,13 @@ impl Cell { } #[inline] + #[must_use] pub fn get_data_type(&self) -> &str { self.cell_value.get_data_type() } #[inline] + #[must_use] pub fn get_raw_value(&self) -> &CellRawValue { self.cell_value.get_raw_value() } @@ -258,21 +271,25 @@ impl Cell { } #[inline] + #[must_use] pub fn is_formula(&self) -> bool { self.cell_value.is_formula() } #[inline] + #[must_use] pub fn get_formula(&self) -> &str { self.cell_value.get_formula() } #[inline] + #[must_use] pub fn get_formula_obj(&self) -> Option<&CellFormula> { self.cell_value.get_formula_obj() } #[inline] + #[must_use] pub fn get_formula_shared_index(&self) -> Option { if let Some(v) = self.get_formula_obj() { if v.get_formula_type() == &CellFormulaValues::Shared { @@ -315,6 +332,7 @@ impl Cell { }) } + #[must_use] pub fn get_formatted_value(&self) -> String { let value = self.get_value(); @@ -351,8 +369,8 @@ impl Cell { empty_flag: bool, formula_shared_list: &mut HashMap)>, ) { - let mut type_value: String = String::from(""); - let mut cell_reference: String = String::from(""); + let mut type_value: String = String::new(); + let mut cell_reference: String = String::new(); if let Some(v) = get_attribute(e, b"r") { cell_reference = v; @@ -374,7 +392,7 @@ impl Cell { return; } - let mut string_value: String = String::from(""); + let mut string_value: String = String::new(); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { diff --git a/src/structs/cell_format.rs b/src/structs/cell_format.rs index 0f3d00c8..a115c479 100644 --- a/src/structs/cell_format.rs +++ b/src/structs/cell_format.rs @@ -3,8 +3,8 @@ use super::Alignment; use super::BooleanValue; use super::Protection; use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/cell_formats.rs b/src/structs/cell_formats.rs index df1a70b4..9bf3213b 100644 --- a/src/structs/cell_formats.rs +++ b/src/structs/cell_formats.rs @@ -1,7 +1,7 @@ // cellXfs use super::CellFormat; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/cell_formula.rs b/src/structs/cell_formula.rs index 6ae7a71a..c91bee15 100644 --- a/src/structs/cell_formula.rs +++ b/src/structs/cell_formula.rs @@ -1,13 +1,16 @@ -use crate::helper::coordinate::*; -use crate::helper::formula::*; -use crate::reader::driver::*; +use crate::helper::coordinate::index_from_coordinate; +use crate::helper::formula::{ + adjustment_insert_formula_coordinate, adjustment_remove_formula_coordinate, parse_to_tokens, + FormulaToken, +}; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::BooleanValue; use crate::structs::CellFormulaValues; use crate::structs::EnumValue; use crate::structs::StringValue; use crate::structs::UInt32Value; use crate::traits::AdjustmentCoordinateWith2Sheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node_conversion}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -31,6 +34,7 @@ pub struct CellFormula { } impl CellFormula { #[inline] + #[must_use] pub fn get_bx(&self) -> bool { self.bx.get_value() } @@ -42,6 +46,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_data_table_2d(&self) -> bool { self.data_table_2d.get_value() } @@ -53,6 +58,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_data_table_row(&self) -> bool { self.data_table_row.get_value() } @@ -64,6 +70,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_formula_type(&self) -> &CellFormulaValues { self.formula_type.get_value() } @@ -74,6 +81,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_input_1deleted(&self) -> bool { self.input_1deleted.get_value() } @@ -85,6 +93,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_input_2deleted(&self) -> bool { self.input_2deleted.get_value() } @@ -96,6 +105,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_r1(&self) -> &str { self.r1.get_value_str() } @@ -107,6 +117,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_r2(&self) -> &str { self.r2.get_value_str() } @@ -118,6 +129,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_reference(&self) -> &str { self.reference.get_value_str() } @@ -129,6 +141,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_shared_index(&self) -> u32 { self.shared_index.get_value() } @@ -140,6 +153,7 @@ impl CellFormula { } #[inline] + #[must_use] pub fn get_text(&self) -> &str { if self.text_view.has_value() { return self.text_view.get_value_str(); @@ -285,13 +299,13 @@ impl CellFormula { } #[allow(unused_assignments)] - let mut reference_str = String::from(""); + let mut reference_str = String::new(); if let Some((start_col, end_col)) = formula_shared_list.get(&self.shared_index.get_value()) { if coordinate == start_col { reference_str = match end_col { Some(v) => { - format!("{}:{}", start_col, v) + format!("{start_col}:{v}") } None => start_col.to_string(), }; @@ -321,7 +335,7 @@ impl AdjustmentCoordinateWith2Sheet for CellFormula { ) { if let Some(v) = self.text.get_value() { let formula = adjustment_insert_formula_coordinate( - &mut parse_to_tokens(format!("={}", v)), + &mut parse_to_tokens(format!("={v}")), root_col_num, offset_col_num, root_row_num, @@ -334,7 +348,7 @@ impl AdjustmentCoordinateWith2Sheet for CellFormula { } if let Some(v) = self.text_view.get_value() { let formula = adjustment_insert_formula_coordinate( - &mut parse_to_tokens(format!("={}", v)), + &mut parse_to_tokens(format!("={v}")), root_col_num, offset_col_num, root_row_num, @@ -358,7 +372,7 @@ impl AdjustmentCoordinateWith2Sheet for CellFormula { ) { if let Some(v) = self.text.get_value() { let formula = adjustment_remove_formula_coordinate( - &mut parse_to_tokens(format!("={}", v)), + &mut parse_to_tokens(format!("={v}")), root_col_num, offset_col_num, root_row_num, @@ -371,7 +385,7 @@ impl AdjustmentCoordinateWith2Sheet for CellFormula { } if let Some(v) = self.text_view.get_value() { let formula = adjustment_remove_formula_coordinate( - &mut parse_to_tokens(format!("={}", v)), + &mut parse_to_tokens(format!("={v}")), root_col_num, offset_col_num, root_row_num, diff --git a/src/structs/cell_raw_value.rs b/src/structs/cell_raw_value.rs index 907bdeed..42809239 100644 --- a/src/structs/cell_raw_value.rs +++ b/src/structs/cell_raw_value.rs @@ -30,6 +30,7 @@ impl fmt::Display for CellRawValue { impl CellRawValue { #[inline] + #[must_use] pub fn get_data_type(&self) -> &str { match self { Self::String(_) => "s", @@ -64,6 +65,7 @@ impl CellRawValue { } #[inline] + #[must_use] pub fn get_rich_text(&self) -> Option { match self { Self::RichText(v) => Some(v.clone()), @@ -72,11 +74,13 @@ impl CellRawValue { } #[inline] + #[must_use] pub fn is_error(&self) -> bool { matches!(*self, CellRawValue::Error(_)) } #[inline] + #[must_use] pub fn is_empty(&self) -> bool { matches!(*self, CellRawValue::Empty) } diff --git a/src/structs/cell_style.rs b/src/structs/cell_style.rs index 78844c1e..52a160d2 100644 --- a/src/structs/cell_style.rs +++ b/src/structs/cell_style.rs @@ -1,8 +1,8 @@ // cellStyle -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::StringValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct CellStyle { impl CellStyle { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -28,6 +29,7 @@ impl CellStyle { } #[inline] + #[must_use] pub fn get_builtin_id(&self) -> u32 { self.builtin_id.get_value() } @@ -39,6 +41,7 @@ impl CellStyle { } #[inline] + #[must_use] pub fn get_format_id(&self) -> u32 { self.format_id.get_value() } diff --git a/src/structs/cell_style_formats.rs b/src/structs/cell_style_formats.rs index 53376106..5706cc26 100644 --- a/src/structs/cell_style_formats.rs +++ b/src/structs/cell_style_formats.rs @@ -1,7 +1,7 @@ // cellStyleXfs use super::CellFormat; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/cell_styles.rs b/src/structs/cell_styles.rs index aada1437..997f4c8a 100644 --- a/src/structs/cell_styles.rs +++ b/src/structs/cell_styles.rs @@ -1,7 +1,7 @@ // cellStyles use super::CellStyle; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/cell_value.rs b/src/structs/cell_value.rs index 23958d6d..2761e6d9 100644 --- a/src/structs/cell_value.rs +++ b/src/structs/cell_value.rs @@ -15,11 +15,13 @@ pub struct CellValue { } impl CellValue { #[inline] + #[must_use] pub fn get_data_type(&self) -> &str { self.raw_value.get_data_type() } #[inline] + #[must_use] pub fn get_raw_value(&self) -> &CellRawValue { &self.raw_value } @@ -33,11 +35,13 @@ impl CellValue { } #[inline] + #[must_use] pub fn get_value(&self) -> Cow<'static, str> { self.raw_value.to_string().into() } #[inline] + #[must_use] pub fn get_value_number(&self) -> Option { self.raw_value.get_number() } @@ -139,11 +143,13 @@ impl CellValue { } #[inline] + #[must_use] pub fn is_formula(&self) -> bool { self.formula.is_some() } #[inline] + #[must_use] pub fn get_formula(&self) -> &str { match &self.formula { Some(v) => v.get_text(), @@ -152,6 +158,7 @@ impl CellValue { } #[inline] + #[must_use] pub fn get_formula_obj(&self) -> Option<&CellFormula> { self.formula.as_deref() } @@ -189,6 +196,7 @@ impl CellValue { } #[inline] + #[must_use] pub fn is_error(&self) -> bool { self.raw_value.is_error() } @@ -225,6 +233,7 @@ impl CellValue { } #[inline] + #[must_use] pub fn is_empty(&self) -> bool { self.is_value_empty() && self.is_formula_empty() } diff --git a/src/structs/cells.rs b/src/structs/cells.rs index 706ead7a..01f576e5 100644 --- a/src/structs/cells.rs +++ b/src/structs/cells.rs @@ -1,8 +1,8 @@ use super::Cell; use super::CellValue; use super::Style; -use crate::helper::coordinate::*; -use crate::helper::range::*; +use crate::helper::coordinate::CellCoordinates; +use crate::helper::range::get_coordinate_list; use crate::structs::Column; use crate::structs::Row; use crate::traits::AdjustmentCoordinate; @@ -21,6 +21,7 @@ impl Cells { self.map.values().map(Box::as_ref).collect() } + #[must_use] pub fn get_collection_sorted(&self) -> Vec<&Cell> { let mut cells = self.get_collection(); cells.sort_by(|a, b| { @@ -42,6 +43,7 @@ impl Cells { } #[inline] + #[must_use] pub fn get_collection_to_hashmap(&self) -> &HashMap<(u32, u32), Box> { &self.map } @@ -65,6 +67,7 @@ impl Cells { } #[inline] + #[must_use] pub fn get_collection_by_column_to_hashmap(&self, column_num: u32) -> HashMap { self.map .iter() @@ -74,6 +77,7 @@ impl Cells { } #[inline] + #[must_use] pub fn get_collection_by_row_to_hashmap(&self, row_num: u32) -> HashMap { self.map .iter() @@ -87,6 +91,7 @@ impl Cells { &mut self.map } + #[must_use] pub fn get_highest_column_and_row(&self) -> (u32, u32) { let mut col_max: u32 = 0; let mut row_max: u32 = 0; @@ -103,6 +108,7 @@ impl Cells { /// Has Hyperlink #[inline] + #[must_use] pub fn has_hyperlink(&self) -> bool { self.map.values().any(|c| c.get_hyperlink().is_some()) } @@ -152,8 +158,7 @@ impl Cells { let CellCoordinates { col, row } = coordinate.into(); self.map .get(&(row.to_owned(), col.to_owned())) - .map(|c| c.get_cell_value()) - .unwrap_or(&self.default_cell_value) + .map_or(&self.default_cell_value, |c| c.get_cell_value()) } #[inline] @@ -164,8 +169,7 @@ impl Cells { let CellCoordinates { col, row } = coordinate.into(); self.map .get(&(row.to_owned(), col.to_owned())) - .map(|c| c.get_style()) - .unwrap_or(&self.default_style) + .map_or(&self.default_style, |c| c.get_style()) } #[inline] @@ -202,6 +206,7 @@ impl Cells { self.map.remove(&k).is_some() } + #[must_use] pub fn get_cell_by_range(&self, range: &str) -> Vec> { let mut result: Vec> = Vec::new(); let range_upper = range.to_uppercase(); @@ -212,6 +217,7 @@ impl Cells { result } + #[must_use] pub fn get_cell_value_by_range(&self, range: &str) -> Vec<&CellValue> { let mut result: Vec<&CellValue> = Vec::new(); let range_upper = range.to_uppercase(); @@ -223,10 +229,11 @@ impl Cells { } #[inline] + #[must_use] pub fn get_formatted_value_by_column_and_row(&self, col_num: u32, row_num: u32) -> String { match self.get((col_num, row_num)) { Some(v) => v.get_formatted_value(), - None => "".into(), + None => String::new(), } } @@ -243,7 +250,7 @@ impl Cells { std::mem::take(cell), ) }) - .collect() + .collect(); } } impl AdjustmentCoordinate for Cells { diff --git a/src/structs/chart.rs b/src/structs/chart.rs index 84cd5f98..173e0c22 100644 --- a/src/structs/chart.rs +++ b/src/structs/chart.rs @@ -63,18 +63,18 @@ use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentCoordinateWithSheet; /// ## Supported chart types -/// * AreaChart -/// * Area3DChart -/// * BarChart -/// * Bar3DChart -/// * BubbleChart -/// * DoughnutChart -/// * LineChart -/// * Line3DChart -/// * OfPieChart -/// * PieChart -/// * RadarChart -/// * ScatterChart +/// * `AreaChart` +/// * `Area3DChart` +/// * `BarChart` +/// * `Bar3DChart` +/// * `BubbleChart` +/// * `DoughnutChart` +/// * `LineChart` +/// * `Line3DChart` +/// * `OfPieChart` +/// * `PieChart` +/// * `RadarChart` +/// * `ScatterChart` /// /// Other types will be supported sequentially. /// @@ -224,16 +224,13 @@ impl Chart { .get_area_chart_series_list_mut() .get_area_chart_series_mut() { - match series.get_category_axis_data_mut() { - Some(v) => { - v.remove_string_reference(); - v.set_string_literal(string_literal.clone()); - } - None => { - let mut obj = CategoryAxisData::default(); - obj.set_string_literal(string_literal.clone()); - series.set_category_axis_data(obj); - } + if let Some(v) = series.get_category_axis_data_mut() { + v.remove_string_reference(); + v.set_string_literal(string_literal.clone()); + } else { + let mut obj = CategoryAxisData::default(); + obj.set_string_literal(string_literal.clone()); + series.set_category_axis_data(obj); } } self @@ -255,6 +252,7 @@ impl Chart { } #[inline] + #[must_use] pub fn get_two_cell_anchor(&self) -> &TwoCellAnchor { &self.two_cell_anchor } @@ -276,6 +274,7 @@ impl Chart { self } + #[must_use] pub fn get_chart_space(&self) -> &ChartSpace { match self.two_cell_anchor.get_graphic_frame() { Some(v) => v.get_graphic().get_graphic_data().get_chart_space(), @@ -353,6 +352,7 @@ impl Chart { } #[inline] + #[must_use] pub fn get_coordinate(&self) -> String { self.two_cell_anchor.get_from_marker().get_coordinate() } diff --git a/src/structs/color.rs b/src/structs/color.rs index 385f04de..0ab34ade 100644 --- a/src/structs/color.rs +++ b/src/structs/color.rs @@ -2,10 +2,10 @@ use super::DoubleValue; use super::StringValue; use super::UInt32Value; -use crate::helper::color::*; -use crate::reader::driver::*; +use crate::helper::color::calc_tint; +use crate::reader::driver::get_attribute_value; use crate::structs::drawing::Theme; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -98,7 +98,8 @@ impl Color { /// Get Argb. /// If the color is based on the theme, it cannot be obtained with this function. - /// In that case, use get_argb_with_theme(&self, theme: &Theme). + /// In that case, use `get_argb_with_theme(&self`, theme: &Theme). + #[must_use] pub fn get_argb(&self) -> &str { if self.indexed.has_value() { if let Some(v) = INDEXED_COLORS.get(self.indexed.get_value() as usize) { @@ -115,6 +116,7 @@ impl Color { /// let mut book = umya_spreadsheet::new_file(); /// let theme = book.get_theme(); /// ``` + #[must_use] pub fn get_argb_with_theme(&self, theme: &Theme) -> Cow<'static, str> { if self.indexed.has_value() { return self.get_argb().to_owned().into(); @@ -139,21 +141,19 @@ impl Color { pub fn set_argb>(&mut self, value: S) -> &mut Self { let argb = value.into(); let indexed = INDEXED_COLORS.iter().position(|&r| r == argb); - match indexed { - Some(v) => { - self.indexed.set_value(v as u32); - self.argb.remove_value(); - } - None => { - self.indexed.remove_value(); - self.argb.set_value(argb); - } + if let Some(v) = indexed { + self.indexed.set_value(v as u32); + self.argb.remove_value(); + } else { + self.indexed.remove_value(); + self.argb.set_value(argb); } self.theme_index.remove_value(); self } #[inline] + #[must_use] pub fn get_indexed(&self) -> u32 { self.indexed.get_value() } @@ -167,6 +167,7 @@ impl Color { } #[inline] + #[must_use] pub fn get_theme_index(&self) -> u32 { self.theme_index.get_value() } @@ -180,6 +181,7 @@ impl Color { } #[inline] + #[must_use] pub fn get_tint(&self) -> f64 { self.tint.get_value() } diff --git a/src/structs/color_scale.rs b/src/structs/color_scale.rs index 8e007105..7c7f9056 100644 --- a/src/structs/color_scale.rs +++ b/src/structs/color_scale.rs @@ -1,7 +1,7 @@ use super::Color; use super::ConditionalFormatValueObject; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct ColorScale { impl ColorScale { #[inline] + #[must_use] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } @@ -37,6 +38,7 @@ impl ColorScale { } #[inline] + #[must_use] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } diff --git a/src/structs/colors.rs b/src/structs/colors.rs index f1b58510..51b5f841 100644 --- a/src/structs/colors.rs +++ b/src/structs/colors.rs @@ -1,7 +1,7 @@ // colors use super::MruColors; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/column.rs b/src/structs/column.rs index 9852a6af..e6709412 100644 --- a/src/structs/column.rs +++ b/src/structs/column.rs @@ -3,7 +3,7 @@ use super::DoubleValue; use super::Style; use super::Stylesheet; use super::UInt32Value; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::Cells; use crate::traits::AdjustmentValue; use md5::Digest; @@ -53,6 +53,7 @@ impl Default for Column { impl Column { #[inline] + #[must_use] pub fn get_col_num(&self) -> u32 { self.col_num.get_value() } @@ -64,6 +65,7 @@ impl Column { } #[inline] + #[must_use] pub fn get_width(&self) -> f64 { self.width.get_value() } @@ -75,6 +77,7 @@ impl Column { } #[inline] + #[must_use] pub fn get_hidden(&self) -> bool { self.hidden.get_value() } @@ -86,6 +89,7 @@ impl Column { } #[inline] + #[must_use] pub fn get_best_fit(&self) -> bool { self.best_fit.get_value() } @@ -97,6 +101,7 @@ impl Column { } #[inline] + #[must_use] pub fn get_style(&self) -> &Style { &self.style } @@ -113,6 +118,7 @@ impl Column { } #[inline] + #[must_use] pub fn get_auto_width(&self) -> bool { self.auto_width.get_value() } diff --git a/src/structs/column_breaks.rs b/src/structs/column_breaks.rs index dbf55227..14368311 100644 --- a/src/structs/column_breaks.rs +++ b/src/structs/column_breaks.rs @@ -1,7 +1,7 @@ // colBreaks -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Break; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct ColumnBreaks { impl ColumnBreaks { #[inline] + #[must_use] pub fn get_break_list(&self) -> &[Break] { &self.break_list } diff --git a/src/structs/column_fields.rs b/src/structs/column_fields.rs index 988433bf..71931653 100644 --- a/src/structs/column_fields.rs +++ b/src/structs/column_fields.rs @@ -1,7 +1,7 @@ // colFields -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Field; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ColumnFields { } impl ColumnFields { #[inline] + #[must_use] pub fn get_list(&self) -> &[Field] { &self.list } diff --git a/src/structs/column_items.rs b/src/structs/column_items.rs index 1b01e71d..63ced6d4 100644 --- a/src/structs/column_items.rs +++ b/src/structs/column_items.rs @@ -1,7 +1,7 @@ // colItems -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::RowItem; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ColumnItems { } impl ColumnItems { #[inline] + #[must_use] pub fn get_list(&self) -> &[RowItem] { &self.list } diff --git a/src/structs/column_reference.rs b/src/structs/column_reference.rs index 5c65f7aa..2d033417 100644 --- a/src/structs/column_reference.rs +++ b/src/structs/column_reference.rs @@ -1,4 +1,7 @@ -use crate::helper::coordinate::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, is_remove_coordinate, + string_from_column_index, +}; use crate::traits::AdjustmentValue; #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] @@ -19,6 +22,7 @@ impl Default for ColumnReference { impl ColumnReference { #[inline] + #[must_use] pub fn get_num(&self) -> u32 { self.num } @@ -53,6 +57,7 @@ impl ColumnReference { } #[inline] + #[must_use] pub fn get_is_lock(&self) -> bool { self.is_lock } diff --git a/src/structs/columns.rs b/src/structs/columns.rs index cc39df44..7ddf6765 100644 --- a/src/structs/columns.rs +++ b/src/structs/columns.rs @@ -1,11 +1,11 @@ // fills -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::structs::Cells; use crate::structs::Column; use crate::structs::MergeCells; use crate::structs::Stylesheet; use crate::traits::AdjustmentValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -114,7 +114,7 @@ impl Columns { // col let mut column_copy = self.column.clone(); - column_copy.sort_by_key(|a| a.get_col_num()); + column_copy.sort_by_key(Column::get_col_num); let mut column_iter = column_copy.iter(); let mut column_raw = column_iter.next(); let mut obj = column_raw.unwrap(); @@ -123,24 +123,21 @@ impl Columns { loop { column_raw = column_iter.next(); - match column_raw { - Some(column) => { - if column.get_col_num() == max + 1 - && column.get_hash_code() == obj.get_hash_code() - && column.get_style() == obj.get_style() - { - max += 1; - } else { - self.write_to_column(writer, min, max, obj, stylesheet); - obj = column; - min = obj.get_col_num(); - max = min; - } - } - None => { + if let Some(column) = column_raw { + if column.get_col_num() == max + 1 + && column.get_hash_code() == obj.get_hash_code() + && column.get_style() == obj.get_style() + { + max += 1; + } else { self.write_to_column(writer, min, max, obj, stylesheet); - break; + obj = column; + min = obj.get_col_num(); + max = min; } + } else { + self.write_to_column(writer, min, max, obj, stylesheet); + break; } } diff --git a/src/structs/comment.rs b/src/structs/comment.rs index cced0222..87cf8c95 100644 --- a/src/structs/comment.rs +++ b/src/structs/comment.rs @@ -12,8 +12,8 @@ use super::vml::Shadow; use super::vml::TextBox; use super::Coordinate; use super::RichText; -use crate::helper::coordinate::*; -use crate::reader::driver::*; +use crate::helper::coordinate::CellCoordinates; +use crate::reader::driver::get_attribute; use crate::structs::vml::Shape; use crate::traits::AdjustmentCoordinate; use quick_xml::events::{BytesStart, Event}; @@ -29,6 +29,7 @@ pub struct Comment { impl Comment { #[inline] + #[must_use] pub fn get_coordinate(&self) -> &Coordinate { &self.coordinate } @@ -39,6 +40,7 @@ impl Comment { } #[inline] + #[must_use] pub fn get_author(&self) -> &str { &self.author } @@ -50,6 +52,7 @@ impl Comment { } #[inline] + #[must_use] pub fn get_text(&self) -> &RichText { &self.text } @@ -72,6 +75,7 @@ impl Comment { } #[inline] + #[must_use] pub fn get_anchor(&self) -> &Anchor { self.shape.get_client_data().get_anchor() } @@ -88,6 +92,7 @@ impl Comment { } #[inline] + #[must_use] pub fn get_shape(&self) -> &Shape { &self.shape } diff --git a/src/structs/conditional_format_value_object.rs b/src/structs/conditional_format_value_object.rs index 9e34186f..26ea7ec8 100644 --- a/src/structs/conditional_format_value_object.rs +++ b/src/structs/conditional_format_value_object.rs @@ -1,8 +1,8 @@ use super::ConditionalFormatValueObjectValues; use super::EnumValue; use super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::write_start_tag; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct ConditionalFormatValueObject { impl ConditionalFormatValueObject { #[inline] + #[must_use] pub fn get_type(&self) -> &ConditionalFormatValueObjectValues { self.r#type.get_value() } @@ -27,6 +28,7 @@ impl ConditionalFormatValueObject { } #[inline] + #[must_use] pub fn get_val(&self) -> &str { self.val.get_value_str() } diff --git a/src/structs/conditional_formatting.rs b/src/structs/conditional_formatting.rs index 1d39b95a..5b89f108 100644 --- a/src/structs/conditional_formatting.rs +++ b/src/structs/conditional_formatting.rs @@ -1,9 +1,9 @@ use super::ConditionalFormattingRule; use super::DifferentialFormats; use super::SequenceOfReferences; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::traits::AdjustmentCoordinate; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -19,6 +19,7 @@ pub struct ConditionalFormatting { impl ConditionalFormatting { #[inline] + #[must_use] pub fn get_sequence_of_references(&self) -> &SequenceOfReferences { &self.sequence_of_references } @@ -35,6 +36,7 @@ impl ConditionalFormatting { } #[inline] + #[must_use] pub fn get_conditional_collection(&self) -> &[ConditionalFormattingRule] { &self.conditional_collection } diff --git a/src/structs/conditional_formatting_rule.rs b/src/structs/conditional_formatting_rule.rs index 6e029032..39393a10 100644 --- a/src/structs/conditional_formatting_rule.rs +++ b/src/structs/conditional_formatting_rule.rs @@ -12,8 +12,8 @@ use super::StringValue; use super::Style; use super::TimePeriodValues; use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -43,6 +43,7 @@ pub struct ConditionalFormattingRule { impl ConditionalFormattingRule { #[inline] + #[must_use] pub fn get_type(&self) -> &ConditionalFormatValues { self.r#type.get_value() } @@ -54,6 +55,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_operator(&self) -> &ConditionalFormattingOperatorValues { self.operator.get_value() } @@ -65,6 +67,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_text(&self) -> &str { self.text.get_value_str() } @@ -76,6 +79,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_priority(&self) -> i32 { self.priority.get_value() } @@ -87,6 +91,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_percent(&self) -> bool { self.percent.get_value() } @@ -98,6 +103,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_bottom(&self) -> bool { self.bottom.get_value() } @@ -109,6 +115,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_rank(&self) -> u32 { self.rank.get_value() } @@ -120,6 +127,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_stop_if_true(&self) -> bool { self.stop_if_true.get_value() } @@ -131,6 +139,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_std_dev(&self) -> i32 { self.std_dev.get_value() } @@ -142,6 +151,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_above_average(&self) -> bool { self.above_average.get_value() } @@ -153,6 +163,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_equal_average(&self) -> bool { self.equal_average.get_value() } @@ -164,6 +175,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_time_period(&self) -> &TimePeriodValues { self.time_period.get_value() } @@ -175,6 +187,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_style(&self) -> Option<&Style> { self.style.as_deref() } @@ -192,6 +205,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_color_scale(&self) -> Option<&ColorScale> { self.color_scale.as_ref() } @@ -209,6 +223,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_data_bar(&self) -> Option<&DataBar> { self.data_bar.as_ref() } @@ -226,6 +241,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_icon_set(&self) -> Option<&IconSet> { self.icon_set.as_ref() } @@ -243,6 +259,7 @@ impl ConditionalFormattingRule { } #[inline] + #[must_use] pub fn get_formula(&self) -> Option<&Formula> { self.formula.as_deref() } @@ -405,22 +422,22 @@ impl ConditionalFormattingRule { if is_inner { // colorScale if let Some(v) = &self.color_scale { - v.write_to(writer) + v.write_to(writer); } // dataBar if let Some(v) = &self.data_bar { - v.write_to(writer) + v.write_to(writer); } // iconSet if let Some(v) = &self.icon_set { - v.write_to(writer) + v.write_to(writer); } // formula if let Some(v) = &self.formula { - v.write_to(writer) + v.write_to(writer); } write_end_tag(writer, "cfRule"); diff --git a/src/structs/coordinate.rs b/src/structs/coordinate.rs index c34f2033..0d9173ec 100644 --- a/src/structs/coordinate.rs +++ b/src/structs/coordinate.rs @@ -2,7 +2,7 @@ use std::fmt; use super::ColumnReference; use super::RowReference; -use crate::helper::coordinate::*; +use crate::helper::coordinate::{coordinate_from_index_with_lock, index_from_coordinate}; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentValue; @@ -30,6 +30,7 @@ impl fmt::Display for Coordinate { impl Coordinate { #[inline] + #[must_use] pub fn get_col_num(&self) -> u32 { self.column.get_num() } @@ -47,6 +48,7 @@ impl Coordinate { } #[inline] + #[must_use] pub fn get_row_num(&self) -> u32 { self.row.get_num() } @@ -64,6 +66,7 @@ impl Coordinate { } #[inline] + #[must_use] pub fn get_is_lock_col(&self) -> bool { self.column.get_is_lock() } @@ -75,6 +78,7 @@ impl Coordinate { } #[inline] + #[must_use] pub fn get_is_lock_row(&self) -> bool { self.row.get_is_lock() } @@ -100,6 +104,7 @@ impl Coordinate { } #[inline] + #[must_use] pub fn get_coordinate(&self) -> String { coordinate_from_index_with_lock( self.column.get_num(), diff --git a/src/structs/csv_writer_option.rs b/src/structs/csv_writer_option.rs index 1e74239b..be843304 100644 --- a/src/structs/csv_writer_option.rs +++ b/src/structs/csv_writer_option.rs @@ -9,6 +9,7 @@ pub struct CsvWriterOption { } impl CsvWriterOption { #[inline] + #[must_use] pub fn get_csv_encode_value(&self) -> &CsvEncodeValues { self.csv_encode_values.get_value() } @@ -20,6 +21,7 @@ impl CsvWriterOption { } #[inline] + #[must_use] pub fn get_wrap_with_char(&self) -> &str { &self.wrap_with_char } @@ -31,6 +33,7 @@ impl CsvWriterOption { } #[inline] + #[must_use] pub fn get_do_trim(&self) -> bool { self.do_trim } diff --git a/src/structs/custom_properties/custom_document_property.rs b/src/structs/custom_properties/custom_document_property.rs index 7241d400..2404547d 100644 --- a/src/structs/custom_properties/custom_document_property.rs +++ b/src/structs/custom_properties/custom_document_property.rs @@ -1,7 +1,7 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::custom_properties::CustomDocumentPropertyValue; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -18,6 +18,7 @@ pub struct CustomDocumentProperty { impl CustomDocumentProperty { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -29,6 +30,7 @@ impl CustomDocumentProperty { } #[inline] + #[must_use] pub fn get_link_target(&self) -> &str { self.link_target.get_value_str() } @@ -40,16 +42,19 @@ impl CustomDocumentProperty { } #[inline] + #[must_use] pub fn get_value(&self) -> Cow<'static, str> { self.custom_document_property_value.to_string().into() } #[inline] + #[must_use] pub fn get_value_number(&self) -> Option { self.custom_document_property_value.get_number() } #[inline] + #[must_use] pub fn get_value_bool(&self) -> Option { self.custom_document_property_value.get_bool() } @@ -72,7 +77,7 @@ impl CustomDocumentProperty { #[inline] pub fn set_value_date(&mut self, year: i32, month: i32, day: i32) -> &mut Self { - let value = format!("{:>04}-{:>02}-{:>02}T10:00:00Z", year, month, day); + let value = format!("{year:>04}-{month:>02}-{day:>02}T10:00:00Z"); self.custom_document_property_value = CustomDocumentPropertyValue::Date(value.into_boxed_str()); self @@ -104,7 +109,7 @@ impl CustomDocumentProperty { return; } - let mut value: String = String::from(""); + let mut value: String = String::new(); xml_read_loop!( reader, Event::Text(e) => { @@ -130,7 +135,7 @@ impl CustomDocumentProperty { // property let mut attributes: Vec<(&str, &str)> = Vec::new(); - attributes.push(("fmtid", r#"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"#)); + attributes.push(("fmtid", r"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")); let pid_str = pid.to_string(); attributes.push(("pid", &pid_str)); diff --git a/src/structs/custom_properties/custom_document_property_value.rs b/src/structs/custom_properties/custom_document_property_value.rs index ef42a7b0..935cdfbc 100644 --- a/src/structs/custom_properties/custom_document_property_value.rs +++ b/src/structs/custom_properties/custom_document_property_value.rs @@ -12,8 +12,8 @@ impl fmt::Display for CustomDocumentPropertyValue { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::String(v) => write!(f, "{}", v), - Self::Date(v) => write!(f, "{}", v), + Self::String(v) => write!(f, "{v}"), + Self::Date(v) => write!(f, "{v}"), Self::Numeric(v) => write!(f, "{}", &v), Self::Bool(v) => write!(f, "{}", if *v { "true" } else { "false" }), _ => write!(f, ""), diff --git a/src/structs/custom_properties/properties.rs b/src/structs/custom_properties/properties.rs index 885ef447..cc9304ab 100644 --- a/src/structs/custom_properties/properties.rs +++ b/src/structs/custom_properties/properties.rs @@ -1,7 +1,7 @@ -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{CUSTOM_PROPS_NS, VTYPES_NS}; +use crate::reader::driver::xml_read_loop; use crate::structs::custom_properties::CustomDocumentProperty; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -16,6 +16,7 @@ pub struct Properties { impl Properties { #[inline] + #[must_use] pub fn get_custom_document_property_list(&self) -> &[CustomDocumentProperty] { &self.custom_document_property_list } diff --git a/src/structs/data_bar.rs b/src/structs/data_bar.rs index d05257fd..c5a89b9f 100644 --- a/src/structs/data_bar.rs +++ b/src/structs/data_bar.rs @@ -1,7 +1,7 @@ use super::Color; use super::ConditionalFormatValueObject; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct DataBar { impl DataBar { #[inline] + #[must_use] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } @@ -37,6 +38,7 @@ impl DataBar { } #[inline] + #[must_use] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } diff --git a/src/structs/data_field.rs b/src/structs/data_field.rs index af81a301..8badf534 100644 --- a/src/structs/data_field.rs +++ b/src/structs/data_field.rs @@ -1,9 +1,9 @@ // dataField -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::Int32Value; use crate::structs::StringValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct DataField { } impl DataField { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -30,6 +31,7 @@ impl DataField { } #[inline] + #[must_use] pub fn get_fie_id(&self) -> u32 { self.fie_id.get_value() } @@ -41,6 +43,7 @@ impl DataField { } #[inline] + #[must_use] pub fn get_base_fie_id(&self) -> i32 { self.base_fie_id.get_value() } @@ -52,6 +55,7 @@ impl DataField { } #[inline] + #[must_use] pub fn get_base_item(&self) -> u32 { self.base_item.get_value() } diff --git a/src/structs/data_fields.rs b/src/structs/data_fields.rs index 145d5d58..0d476602 100644 --- a/src/structs/data_fields.rs +++ b/src/structs/data_fields.rs @@ -1,7 +1,7 @@ // dataFields -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::DataField; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct DataFields { } impl DataFields { #[inline] + #[must_use] pub fn get_list(&self) -> &[DataField] { &self.list } diff --git a/src/structs/data_validation.rs b/src/structs/data_validation.rs index 6b3c2ef1..e8f9a4cf 100644 --- a/src/structs/data_validation.rs +++ b/src/structs/data_validation.rs @@ -5,8 +5,8 @@ use super::DataValidationValues; use super::EnumValue; use super::SequenceOfReferences; use super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -28,6 +28,7 @@ pub struct DataValidation { } impl DataValidation { #[inline] + #[must_use] pub fn get_type(&self) -> &DataValidationValues { self.r#type.get_value() } @@ -39,6 +40,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_operator(&self) -> &DataValidationOperatorValues { self.operator.get_value() } @@ -50,6 +52,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_allow_blank(&self) -> bool { self.allow_blank.get_value() } @@ -61,6 +64,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_show_input_message(&self) -> bool { self.show_input_message.get_value() } @@ -72,6 +76,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_show_error_message(&self) -> bool { self.show_error_message.get_value() } @@ -83,6 +88,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_prompt_title(&self) -> &str { self.prompt_title.get_value_str() } @@ -94,6 +100,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_prompt(&self) -> &str { self.prompt.get_value_str() } @@ -105,6 +112,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_sequence_of_references(&self) -> &SequenceOfReferences { &self.sequence_of_references } @@ -121,6 +129,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_formula1(&self) -> &str { self.formula1.get_value_str() } @@ -132,6 +141,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_formula2(&self) -> &str { self.formula2.get_value_str() } diff --git a/src/structs/data_validations.rs b/src/structs/data_validations.rs index 8b5c339d..71cdfd60 100644 --- a/src/structs/data_validations.rs +++ b/src/structs/data_validations.rs @@ -1,7 +1,7 @@ // dataValidations use super::DataValidation; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct DataValidations { impl DataValidations { #[inline] + #[must_use] pub fn get_data_validation_list(&self) -> &[DataValidation] { &self.data_validation_list } diff --git a/src/structs/defined_name.rs b/src/structs/defined_name.rs index 16acfa8e..10502902 100644 --- a/src/structs/defined_name.rs +++ b/src/structs/defined_name.rs @@ -2,10 +2,10 @@ use super::Address; use super::BooleanValue; use super::StringValue; use super::UInt32Value; -use crate::helper::address::*; -use crate::reader::driver::*; +use crate::helper::address::is_address; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node_conversion}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -22,6 +22,7 @@ pub struct DefinedName { } impl DefinedName { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -32,6 +33,7 @@ impl DefinedName { self } + #[must_use] pub fn get_address(&self) -> String { if self.string_value.has_value() { return self.string_value.get_value_str().to_string(); @@ -67,7 +69,7 @@ impl DefinedName { #[allow(dead_code)] pub(crate) fn get_sheet_name_crate(&self) -> String { if self.string_value.has_value() { - return String::from(""); + return String::new(); } self.address .first() @@ -95,11 +97,13 @@ impl DefinedName { } #[inline] + #[must_use] pub fn has_local_sheet_id(&self) -> bool { self.local_sheet_id.has_value() } #[inline] + #[must_use] pub fn get_local_sheet_id(&self) -> u32 { self.local_sheet_id.get_value() } @@ -110,6 +114,7 @@ impl DefinedName { } #[inline] + #[must_use] pub fn get_hidden(&self) -> bool { self.hidden.get_value() } @@ -126,7 +131,7 @@ impl DefinedName { let mut is_pass_d = false; let mut is_pass_b = 0; let mut result: Vec = Vec::new(); - let mut string = String::from(""); + let mut string = String::new(); for c in &char_list { match c { '(' => { @@ -182,7 +187,7 @@ impl DefinedName { set_string_from_xml!(self, e, local_sheet_id, "localSheetId"); set_string_from_xml!(self, e, hidden, "hidden"); - let mut value: String = String::from(""); + let mut value: String = String::new(); xml_read_loop!( reader, Event::Text(e) => { diff --git a/src/structs/differential_format.rs b/src/structs/differential_format.rs index c2e45165..22f1df5b 100644 --- a/src/structs/differential_format.rs +++ b/src/structs/differential_format.rs @@ -4,8 +4,8 @@ use super::Borders; use super::Fill; use super::Font; use super::Style; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; diff --git a/src/structs/differential_formats.rs b/src/structs/differential_formats.rs index bda8a29f..a6e4d0d8 100644 --- a/src/structs/differential_formats.rs +++ b/src/structs/differential_formats.rs @@ -1,8 +1,8 @@ // dxfs use super::DifferentialFormat; use super::Style; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/adjust_value_list.rs b/src/structs/drawing/adjust_value_list.rs index 4615cf13..aa766779 100644 --- a/src/structs/drawing/adjust_value_list.rs +++ b/src/structs/drawing/adjust_value_list.rs @@ -1,7 +1,7 @@ // a:avLst use super::shape_guide::ShapeGuide; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct AdjustValueList { impl AdjustValueList { #[inline] + #[must_use] pub fn get_shape_guide_collection(&self) -> &[ShapeGuide] { &self.shape_guide_collection } diff --git a/src/structs/drawing/alpha.rs b/src/structs/drawing/alpha.rs index d493bd16..61059784 100644 --- a/src/structs/drawing/alpha.rs +++ b/src/structs/drawing/alpha.rs @@ -1,6 +1,6 @@ // a:alpha -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Alpha { } impl Alpha { #[inline] + #[must_use] pub fn get_val(&self) -> &str { &self.val } diff --git a/src/structs/drawing/background_color.rs b/src/structs/drawing/background_color.rs index ee116662..29f5d94e 100644 --- a/src/structs/drawing/background_color.rs +++ b/src/structs/drawing/background_color.rs @@ -1,7 +1,7 @@ // a:bgClr use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct BackgroundColor { impl BackgroundColor { #[inline] + #[must_use] pub fn get_scheme_color(&self) -> &SchemeColor { &self.scheme_color } diff --git a/src/structs/drawing/background_fill_style_list.rs b/src/structs/drawing/background_fill_style_list.rs index 7537a3b4..c34fc996 100644 --- a/src/structs/drawing/background_fill_style_list.rs +++ b/src/structs/drawing/background_fill_style_list.rs @@ -1,7 +1,7 @@ use super::GradientFill; use super::SolidFill; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct BackgroundFillStyleList { impl BackgroundFillStyleList { #[inline] + #[must_use] pub fn get_solid_fill(&self) -> &[SolidFill] { &self.solid_fill } @@ -38,6 +39,7 @@ impl BackgroundFillStyleList { } #[inline] + #[must_use] pub fn get_gradient_fill_collection(&self) -> &[GradientFill] { &self.gradient_fill_collection } diff --git a/src/structs/drawing/bevel.rs b/src/structs/drawing/bevel.rs index 72889188..88bff51e 100644 --- a/src/structs/drawing/bevel.rs +++ b/src/structs/drawing/bevel.rs @@ -1,5 +1,5 @@ // a:bevel -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/bevel_bottom.rs b/src/structs/drawing/bevel_bottom.rs index c2ece966..5ae7cc90 100644 --- a/src/structs/drawing/bevel_bottom.rs +++ b/src/structs/drawing/bevel_bottom.rs @@ -2,8 +2,8 @@ use super::super::EnumValue; use super::super::Int64Value; use super::BevelPresetValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct BevelBottom { impl BevelBottom { #[inline] + #[must_use] pub fn get_width(&self) -> i64 { self.width.get_value() } @@ -29,6 +30,7 @@ impl BevelBottom { } #[inline] + #[must_use] pub fn get_height(&self) -> i64 { self.height.get_value() } @@ -40,6 +42,7 @@ impl BevelBottom { } #[inline] + #[must_use] pub fn get_preset(&self) -> &BevelPresetValues { self.preset.get_value() } diff --git a/src/structs/drawing/bevel_top.rs b/src/structs/drawing/bevel_top.rs index 1f71ca5a..20880cb2 100644 --- a/src/structs/drawing/bevel_top.rs +++ b/src/structs/drawing/bevel_top.rs @@ -2,8 +2,8 @@ use super::super::EnumValue; use super::super::Int64Value; use super::BevelPresetValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct BevelTop { impl BevelTop { #[inline] + #[must_use] pub fn get_width(&self) -> i64 { self.width.get_value() } @@ -29,6 +30,7 @@ impl BevelTop { } #[inline] + #[must_use] pub fn get_height(&self) -> i64 { self.height.get_value() } @@ -40,6 +42,7 @@ impl BevelTop { } #[inline] + #[must_use] pub fn get_preset(&self) -> &BevelPresetValues { self.preset.get_value() } diff --git a/src/structs/drawing/blip.rs b/src/structs/drawing/blip.rs index 061c1d3a..3f55b638 100644 --- a/src/structs/drawing/blip.rs +++ b/src/structs/drawing/blip.rs @@ -1,9 +1,9 @@ // a:blip -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{DRAWING_MAIN_NS, REL_OFC_NS}; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::structs::raw::RawRelationships; use crate::structs::MediaObject; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct Blip { impl Blip { #[inline] + #[must_use] pub fn get_image(&self) -> &MediaObject { &self.image } @@ -33,6 +34,7 @@ impl Blip { } #[inline] + #[must_use] pub fn get_cstate(&self) -> &str { &self.cstate } @@ -83,7 +85,7 @@ impl Blip { ) { // a:blip let r_id = self.image.get_rid(rel_list); - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); let mut attributes: Vec<(&str, &str)> = Vec::new(); attributes.push(("xmlns:r", REL_OFC_NS)); attributes.push(("r:embed", r_id_str.as_str())); diff --git a/src/structs/drawing/blip_fill.rs b/src/structs/drawing/blip_fill.rs index a7c3b9a2..e81cd41b 100644 --- a/src/structs/drawing/blip_fill.rs +++ b/src/structs/drawing/blip_fill.rs @@ -3,9 +3,9 @@ use super::super::super::BooleanValue; use super::Blip; use super::SourceRectangle; use super::Stretch; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct BlipFill { impl BlipFill { #[inline] + #[must_use] pub fn get_rotate_with_shape(&self) -> bool { self.rotate_with_shape.get_value() } @@ -32,6 +33,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_source_rectangle(&self) -> Option<&SourceRectangle> { self.source_rectangle.as_deref() } @@ -48,6 +50,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_blip(&self) -> &Blip { &self.blip } @@ -64,6 +67,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_stretch(&self) -> &Stretch { &self.stretch } @@ -132,7 +136,7 @@ impl BlipFill { // a:blipFill let mut attributes: Vec<(&str, &str)> = Vec::new(); if self.rotate_with_shape.has_value() { - attributes.push(("rotWithShape", self.rotate_with_shape.get_value_string())) + attributes.push(("rotWithShape", self.rotate_with_shape.get_value_string())); } write_start_tag(writer, "a:blipFill", attributes, false); diff --git a/src/structs/drawing/body_properties.rs b/src/structs/drawing/body_properties.rs index fe696a65..58279be1 100644 --- a/src/structs/drawing/body_properties.rs +++ b/src/structs/drawing/body_properties.rs @@ -3,8 +3,8 @@ use super::super::EnumValue; use super::super::Int32Value; use super::ShapeAutoFit; use super::TextWrappingValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute_value, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -27,6 +27,7 @@ pub struct BodyProperties { impl BodyProperties { #[inline] + #[must_use] pub fn get_vert_overflow(&self) -> Option<&str> { self.vert_overflow.get_value() } @@ -38,6 +39,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_horz_overflow(&self) -> Option<&str> { self.horz_overflow.get_value() } @@ -49,6 +51,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_rtl_col(&self) -> Option<&str> { self.rtl_col.get_value() } @@ -60,6 +63,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_anchor(&self) -> Option<&str> { self.anchor.get_value() } @@ -71,6 +75,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_wrap(&self) -> &TextWrappingValues { self.wrap.get_value() } @@ -82,6 +87,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_left_inset(&self) -> i32 { self.left_inset.get_value() } @@ -92,6 +98,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_top_inset(&self) -> i32 { self.top_inset.get_value() } @@ -102,6 +109,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_right_inset(&self) -> i32 { self.right_inset.get_value() } @@ -112,6 +120,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_bottom_inset(&self) -> i32 { self.bottom_inset.get_value() } @@ -122,6 +131,7 @@ impl BodyProperties { } #[inline] + #[must_use] pub fn get_shape_auto_fit(&self) -> Option<&ShapeAutoFit> { self.shape_auto_fit.as_ref() } diff --git a/src/structs/drawing/camera.rs b/src/structs/drawing/camera.rs index b3a5025d..10c2db43 100644 --- a/src/structs/drawing/camera.rs +++ b/src/structs/drawing/camera.rs @@ -2,8 +2,8 @@ use super::super::EnumValue; use super::PresetCameraValues; use super::Rotation; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct Camera { impl Camera { #[inline] + #[must_use] pub fn get_preset(&self) -> &PresetCameraValues { self.preset.get_value() } @@ -28,6 +29,7 @@ impl Camera { } #[inline] + #[must_use] pub fn get_rotation(&self) -> Option<&Rotation> { self.rotation.as_deref() } diff --git a/src/structs/drawing/charts/area_3d_chart.rs b/src/structs/drawing/charts/area_3d_chart.rs index 6cf7e5cf..0e4400e8 100644 --- a/src/structs/drawing/charts/area_3d_chart.rs +++ b/src/structs/drawing/charts/area_3d_chart.rs @@ -5,9 +5,9 @@ use super::AxisId; use super::DataLabels; use super::Grouping; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct Area3DChart { } impl Area3DChart { + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -37,6 +38,7 @@ impl Area3DChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -50,6 +52,7 @@ impl Area3DChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -63,6 +66,7 @@ impl Area3DChart { self } + #[must_use] pub fn get_data_labels(&self) -> Option<&DataLabels> { self.data_labels.as_deref() } @@ -76,6 +80,7 @@ impl Area3DChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/area_chart.rs b/src/structs/drawing/charts/area_chart.rs index 7351abec..a2597b41 100644 --- a/src/structs/drawing/charts/area_chart.rs +++ b/src/structs/drawing/charts/area_chart.rs @@ -5,9 +5,9 @@ use super::AxisId; use super::DataLabels; use super::Grouping; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct AreaChart { } impl AreaChart { + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -37,6 +38,7 @@ impl AreaChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -50,6 +52,7 @@ impl AreaChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -63,6 +66,7 @@ impl AreaChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -76,6 +80,7 @@ impl AreaChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/area_chart_series.rs b/src/structs/drawing/charts/area_chart_series.rs index 8085b7e7..8dadb60b 100644 --- a/src/structs/drawing/charts/area_chart_series.rs +++ b/src/structs/drawing/charts/area_chart_series.rs @@ -16,7 +16,7 @@ use super::Values; use super::XValues; use super::YValues; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -43,6 +43,7 @@ pub struct AreaChartSeries { } impl AreaChartSeries { + #[must_use] pub fn get_index(&self) -> &Index { &self.index } @@ -56,6 +57,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_order(&self) -> &Order { &self.order } @@ -69,6 +71,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_series_text(&self) -> Option<&SeriesText> { self.series_text.as_ref() } @@ -82,6 +85,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_explosion(&self) -> Option<&Explosion> { self.explosion.as_ref() } @@ -95,6 +99,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_invert_if_negative(&self) -> Option<&InvertIfNegative> { self.invert_if_negative.as_ref() } @@ -108,6 +113,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_marker(&self) -> Option<&Marker> { self.marker.as_ref() } @@ -121,6 +127,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } @@ -134,6 +141,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_category_axis_data(&self) -> Option<&CategoryAxisData> { self.category_axis_data.as_ref() } @@ -147,6 +155,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_values(&self) -> Option<&Values> { self.values.as_ref() } @@ -160,6 +169,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_x_values(&self) -> Option<&XValues> { self.x_values.as_ref() } @@ -173,6 +183,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_y_values(&self) -> Option<&YValues> { self.y_values.as_ref() } @@ -186,6 +197,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_bubble_size(&self) -> Option<&BubbleSize> { self.bubble_size.as_ref() } @@ -199,6 +211,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_bubble_3d(&self) -> Option<&Bubble3D> { self.bubble_3d.as_ref() } @@ -212,6 +225,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_smooth(&self) -> Option<&Smooth> { self.smooth.as_ref() } @@ -225,6 +239,7 @@ impl AreaChartSeries { self } + #[must_use] pub fn get_data_labels(&self) -> Option<&DataLabels> { self.data_labels.as_ref() } diff --git a/src/structs/drawing/charts/area_chart_series_list.rs b/src/structs/drawing/charts/area_chart_series_list.rs index 855eb33a..30d5b4b6 100644 --- a/src/structs/drawing/charts/area_chart_series_list.rs +++ b/src/structs/drawing/charts/area_chart_series_list.rs @@ -6,6 +6,7 @@ pub struct AreaChartSeriesList { area_chart_series: ThinVec, } impl AreaChartSeriesList { + #[must_use] pub fn get_area_chart_series(&self) -> &[AreaChartSeries] { &self.area_chart_series } diff --git a/src/structs/drawing/charts/auto_labeled.rs b/src/structs/drawing/charts/auto_labeled.rs index e05bb02d..17bfcca2 100644 --- a/src/structs/drawing/charts/auto_labeled.rs +++ b/src/structs/drawing/charts/auto_labeled.rs @@ -1,7 +1,7 @@ // c:auto use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct AutoLabeled { val: BooleanValue, } impl AutoLabeled { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/auto_title_deleted.rs b/src/structs/drawing/charts/auto_title_deleted.rs index 16345cbf..cc6afe0d 100644 --- a/src/structs/drawing/charts/auto_title_deleted.rs +++ b/src/structs/drawing/charts/auto_title_deleted.rs @@ -1,7 +1,7 @@ // c:autoTitleDeleted use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct AutoTitleDeleted { val: BooleanValue, } impl AutoTitleDeleted { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/axis_id.rs b/src/structs/drawing/charts/axis_id.rs index 159b7e83..da74cbd6 100644 --- a/src/structs/drawing/charts/axis_id.rs +++ b/src/structs/drawing/charts/axis_id.rs @@ -1,7 +1,7 @@ // c:axId use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct AxisId { val: UInt32Value, } impl AxisId { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/axis_position.rs b/src/structs/drawing/charts/axis_position.rs index 819503e6..23187083 100644 --- a/src/structs/drawing/charts/axis_position.rs +++ b/src/structs/drawing/charts/axis_position.rs @@ -1,8 +1,8 @@ // c:axPos use super::super::super::EnumValue; use super::AxisPositionValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct AxisPosition { val: EnumValue, } impl AxisPosition { + #[must_use] pub fn get_val(&self) -> &AxisPositionValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/back_wall.rs b/src/structs/drawing/charts/back_wall.rs index 7210bb23..bfc35ceb 100644 --- a/src/structs/drawing/charts/back_wall.rs +++ b/src/structs/drawing/charts/back_wall.rs @@ -1,8 +1,8 @@ // c:backWall use super::ShapeProperties; use super::Thickness; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct BackWall { } impl BackWall { + #[must_use] pub fn get_thickness(&self) -> Option<&Thickness> { self.thickness.as_ref() } @@ -28,6 +29,7 @@ impl BackWall { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } diff --git a/src/structs/drawing/charts/bar_3d_chart.rs b/src/structs/drawing/charts/bar_3d_chart.rs index 93e7a8af..81fcc311 100644 --- a/src/structs/drawing/charts/bar_3d_chart.rs +++ b/src/structs/drawing/charts/bar_3d_chart.rs @@ -8,9 +8,9 @@ use super::GapWidth; use super::Grouping; use super::Shape; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -30,6 +30,7 @@ pub struct Bar3DChart { } impl Bar3DChart { + #[must_use] pub fn get_bar_direction(&self) -> &BarDirection { &self.bar_direction } @@ -43,6 +44,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -56,6 +58,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -69,6 +72,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -82,6 +86,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -95,6 +100,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_gap_width(&self) -> &GapWidth { &self.gap_width } @@ -108,6 +114,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_shape(&self) -> &Shape { &self.shape } @@ -121,6 +128,7 @@ impl Bar3DChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/bar_chart.rs b/src/structs/drawing/charts/bar_chart.rs index c3c06279..3747cc5b 100644 --- a/src/structs/drawing/charts/bar_chart.rs +++ b/src/structs/drawing/charts/bar_chart.rs @@ -8,9 +8,9 @@ use super::GapWidth; use super::Grouping; use super::Overlap; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -30,6 +30,7 @@ pub struct BarChart { } impl BarChart { + #[must_use] pub fn get_bar_direction(&self) -> &BarDirection { &self.bar_direction } @@ -43,6 +44,7 @@ impl BarChart { self } + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -56,6 +58,7 @@ impl BarChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -69,6 +72,7 @@ impl BarChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -82,6 +86,7 @@ impl BarChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -95,6 +100,7 @@ impl BarChart { self } + #[must_use] pub fn get_gap_width(&self) -> &GapWidth { &self.gap_width } @@ -108,6 +114,7 @@ impl BarChart { self } + #[must_use] pub fn get_overlap(&self) -> &Overlap { &self.overlap } @@ -121,6 +128,7 @@ impl BarChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/bar_direction.rs b/src/structs/drawing/charts/bar_direction.rs index 81434780..d474da4b 100644 --- a/src/structs/drawing/charts/bar_direction.rs +++ b/src/structs/drawing/charts/bar_direction.rs @@ -1,8 +1,8 @@ // c:barDir use super::super::super::EnumValue; use super::BarDirectionValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct BarDirection { val: EnumValue, } impl BarDirection { + #[must_use] pub fn get_val(&self) -> &BarDirectionValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/bubble_3d.rs b/src/structs/drawing/charts/bubble_3d.rs index 417ee1ad..eb35c8f3 100644 --- a/src/structs/drawing/charts/bubble_3d.rs +++ b/src/structs/drawing/charts/bubble_3d.rs @@ -1,7 +1,7 @@ // c:bubble3D use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Bubble3D { val: BooleanValue, } impl Bubble3D { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/bubble_chart.rs b/src/structs/drawing/charts/bubble_chart.rs index 5f14e444..46386f33 100644 --- a/src/structs/drawing/charts/bubble_chart.rs +++ b/src/structs/drawing/charts/bubble_chart.rs @@ -6,9 +6,9 @@ use super::BubbleScale; use super::DataLabels; use super::ShowNegativeBubbles; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -26,6 +26,7 @@ pub struct BubbleChart { } impl BubbleChart { + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -39,6 +40,7 @@ impl BubbleChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -52,6 +54,7 @@ impl BubbleChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -65,6 +68,7 @@ impl BubbleChart { self } + #[must_use] pub fn get_bubble_scale(&self) -> &BubbleScale { &self.bubble_scale } @@ -78,6 +82,7 @@ impl BubbleChart { self } + #[must_use] pub fn get_show_negative_bubbles(&self) -> &ShowNegativeBubbles { &self.show_negative_bubbles } @@ -91,6 +96,7 @@ impl BubbleChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/bubble_scale.rs b/src/structs/drawing/charts/bubble_scale.rs index 39107b3b..334e6747 100644 --- a/src/structs/drawing/charts/bubble_scale.rs +++ b/src/structs/drawing/charts/bubble_scale.rs @@ -1,7 +1,7 @@ // c:bubbleScale use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct BubbleScale { val: UInt32Value, } impl BubbleScale { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/bubble_size.rs b/src/structs/drawing/charts/bubble_size.rs index 04d11029..ff1d74bf 100644 --- a/src/structs/drawing/charts/bubble_size.rs +++ b/src/structs/drawing/charts/bubble_size.rs @@ -1,8 +1,8 @@ // c:bubbleSize use super::NumberReference; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct BubbleSize { } impl BubbleSize { + #[must_use] pub fn get_number_reference(&self) -> &NumberReference { &self.number_reference } diff --git a/src/structs/drawing/charts/category_axis.rs b/src/structs/drawing/charts/category_axis.rs index 8ecaff2b..eb90d491 100644 --- a/src/structs/drawing/charts/category_axis.rs +++ b/src/structs/drawing/charts/category_axis.rs @@ -18,7 +18,7 @@ use super::ShapeProperties; use super::TextProperties; use super::TickLabelPosition; use super::Title; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -46,6 +46,7 @@ pub struct CategoryAxis { } impl CategoryAxis { + #[must_use] pub fn get_axis_id(&self) -> &AxisId { &self.axis_id } @@ -59,6 +60,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_scaling(&self) -> &Scaling { &self.scaling } @@ -72,6 +74,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_delete(&self) -> &Delete { &self.delete } @@ -85,6 +88,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_axis_position(&self) -> &AxisPosition { &self.axis_position } @@ -98,6 +102,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_title(&self) -> Option<&Title> { self.title.as_ref() } @@ -111,6 +116,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_major_gridlines(&self) -> Option<&MajorGridlines> { self.major_gridlines.as_ref() } @@ -124,6 +130,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_major_tick_mark(&self) -> &MajorTickMark { &self.major_tick_mark } @@ -137,6 +144,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_minor_tick_mark(&self) -> &MinorTickMark { &self.minor_tick_mark } @@ -150,6 +158,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_tick_label_position(&self) -> &TickLabelPosition { &self.tick_label_position } @@ -163,6 +172,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_tick_crossing_axis(&self) -> &CrossingAxis { &self.crossing_axis } @@ -176,6 +186,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_crosses(&self) -> &Crosses { &self.crosses } @@ -189,6 +200,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_auto_labeled(&self) -> &AutoLabeled { &self.auto_labeled } @@ -202,6 +214,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_label_alignment(&self) -> &LabelAlignment { &self.label_alignment } @@ -215,6 +228,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_label_offset(&self) -> &LabelOffset { &self.label_offset } @@ -228,6 +242,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_no_multi_level_labels(&self) -> &NoMultiLevelLabels { &self.no_multi_level_labels } @@ -241,6 +256,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } @@ -254,6 +270,7 @@ impl CategoryAxis { self } + #[must_use] pub fn get_text_properties(&self) -> Option<&TextProperties> { self.text_properties.as_ref() } diff --git a/src/structs/drawing/charts/category_axis_data.rs b/src/structs/drawing/charts/category_axis_data.rs index 40ab62eb..c05e2166 100644 --- a/src/structs/drawing/charts/category_axis_data.rs +++ b/src/structs/drawing/charts/category_axis_data.rs @@ -1,9 +1,9 @@ // c:cat use super::StringLiteral; use super::StringReference; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct CategoryAxisData { } impl CategoryAxisData { + #[must_use] pub fn get_string_reference(&self) -> Option<&StringReference> { self.string_reference.as_ref() } @@ -34,6 +35,7 @@ impl CategoryAxisData { self } + #[must_use] pub fn get_string_literal(&self) -> Option<&StringLiteral> { self.string_literal.as_ref() } diff --git a/src/structs/drawing/charts/chart.rs b/src/structs/drawing/charts/chart.rs index 39288e06..bf32fcfa 100644 --- a/src/structs/drawing/charts/chart.rs +++ b/src/structs/drawing/charts/chart.rs @@ -12,7 +12,7 @@ use super::Title; use super::View3D; use crate::structs::Spreadsheet; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -38,6 +38,7 @@ impl Chart { pub const LANG_EN_GB: &'static str = "en_GB"; pub const LANG_JA_JP: &'static str = "ja-JP"; + #[must_use] pub fn get_title(&self) -> Option<&Title> { self.title.as_ref() } @@ -51,6 +52,7 @@ impl Chart { self } + #[must_use] pub fn get_auto_title_deleted(&self) -> &AutoTitleDeleted { &self.auto_title_deleted } @@ -64,6 +66,7 @@ impl Chart { self } + #[must_use] pub fn get_view_3d(&self) -> Option<&View3D> { self.view_3d.as_ref() } @@ -77,6 +80,7 @@ impl Chart { self } + #[must_use] pub fn get_floor(&self) -> Option<&Floor> { self.floor.as_ref() } @@ -90,6 +94,7 @@ impl Chart { self } + #[must_use] pub fn get_side_wall(&self) -> Option<&SideWall> { self.side_wall.as_ref() } @@ -103,6 +108,7 @@ impl Chart { self } + #[must_use] pub fn get_back_wall(&self) -> Option<&BackWall> { self.back_wall.as_ref() } @@ -116,6 +122,7 @@ impl Chart { self } + #[must_use] pub fn get_plot_area(&self) -> &PlotArea { &self.plot_area } @@ -129,6 +136,7 @@ impl Chart { self } + #[must_use] pub fn get_legend(&self) -> &Legend { &self.legend } @@ -142,6 +150,7 @@ impl Chart { self } + #[must_use] pub fn get_plot_visible_only(&self) -> &PlotVisibleOnly { &self.plot_visible_only } @@ -155,6 +164,7 @@ impl Chart { self } + #[must_use] pub fn get_display_blanks_as(&self) -> &DisplayBlanksAs { &self.display_blanks_as } @@ -168,6 +178,7 @@ impl Chart { self } + #[must_use] pub fn get_show_data_labels_over_maximum(&self) -> &ShowDataLabelsOverMaximum { &self.show_data_labels_over_maximum } diff --git a/src/structs/drawing/charts/chart_space.rs b/src/structs/drawing/charts/chart_space.rs index b229aa47..3a234b66 100644 --- a/src/structs/drawing/charts/chart_space.rs +++ b/src/structs/drawing/charts/chart_space.rs @@ -7,11 +7,11 @@ use super::EditingLanguage; use super::PrintSettings; use super::RoundedCorners; use super::ShapeProperties; -use crate::helper::const_str::*; +use crate::helper::const_str::{DRAWINGML_CHART_NS, DRAWINGML_MAIN_NS, REL_OFC_NS}; use crate::structs::office2010::drawing::charts::Style; use crate::structs::Spreadsheet; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -29,6 +29,7 @@ pub struct ChartSpace { } impl ChartSpace { + #[must_use] pub fn get_date1904(&self) -> &Date1904 { &self.date1904 } @@ -42,6 +43,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_editing_language(&self) -> &EditingLanguage { &self.editing_language } @@ -55,6 +57,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_rounded_corners(&self) -> &RoundedCorners { &self.rounded_corners } @@ -68,6 +71,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_style(&self) -> &Style { &self.style } @@ -81,6 +85,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_chart(&self) -> &Chart { &self.chart } @@ -94,6 +99,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } @@ -107,6 +113,7 @@ impl ChartSpace { self } + #[must_use] pub fn get_print_settings(&self) -> Option<&PrintSettings> { self.print_settings.as_ref() } diff --git a/src/structs/drawing/charts/chart_text.rs b/src/structs/drawing/charts/chart_text.rs index 31a60732..3cf5ba4c 100644 --- a/src/structs/drawing/charts/chart_text.rs +++ b/src/structs/drawing/charts/chart_text.rs @@ -1,6 +1,6 @@ // c:tx use super::RichText; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -13,6 +13,7 @@ pub struct ChartText { } impl ChartText { + #[must_use] pub fn get_rich_text(&self) -> &RichText { &self.rich_text } diff --git a/src/structs/drawing/charts/cross_between.rs b/src/structs/drawing/charts/cross_between.rs index 850a55bb..01315aaf 100644 --- a/src/structs/drawing/charts/cross_between.rs +++ b/src/structs/drawing/charts/cross_between.rs @@ -1,8 +1,8 @@ // c:crossBetween use super::super::super::EnumValue; use super::CrossBetweenValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct CrossBetween { val: EnumValue, } impl CrossBetween { + #[must_use] pub fn get_val(&self) -> &CrossBetweenValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/crosses.rs b/src/structs/drawing/charts/crosses.rs index 785aab13..b98eb7f1 100644 --- a/src/structs/drawing/charts/crosses.rs +++ b/src/structs/drawing/charts/crosses.rs @@ -1,8 +1,8 @@ // c:crosses use super::super::super::EnumValue; use super::CrossesValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Crosses { val: EnumValue, } impl Crosses { + #[must_use] pub fn get_val(&self) -> &CrossesValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/crossing_axis.rs b/src/structs/drawing/charts/crossing_axis.rs index fb576309..bb40bf14 100644 --- a/src/structs/drawing/charts/crossing_axis.rs +++ b/src/structs/drawing/charts/crossing_axis.rs @@ -1,7 +1,7 @@ // c:crossAx use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct CrossingAxis { val: UInt32Value, } impl CrossingAxis { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/data_labels.rs b/src/structs/drawing/charts/data_labels.rs index eb4a8bdb..235d431b 100644 --- a/src/structs/drawing/charts/data_labels.rs +++ b/src/structs/drawing/charts/data_labels.rs @@ -7,8 +7,8 @@ use super::ShowPercent; use super::ShowSeriesName; use super::ShowValue; use super::TextProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -27,6 +27,7 @@ pub struct DataLabels { } impl DataLabels { + #[must_use] pub fn get_show_legend_key(&self) -> &ShowLegendKey { &self.show_legend_key } @@ -40,6 +41,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_value(&self) -> &ShowValue { &self.show_value } @@ -53,6 +55,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_category_name(&self) -> &ShowCategoryName { &self.show_category_name } @@ -66,6 +69,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_series_name(&self) -> &ShowSeriesName { &self.show_series_name } @@ -79,6 +83,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_percent(&self) -> &ShowPercent { &self.show_percent } @@ -92,6 +97,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_bubble_size(&self) -> &ShowBubbleSize { &self.show_bubble_size } @@ -105,6 +111,7 @@ impl DataLabels { self } + #[must_use] pub fn get_show_leader_lines(&self) -> Option<&ShowLeaderLines> { self.show_leader_lines.as_ref() } @@ -118,6 +125,7 @@ impl DataLabels { self } + #[must_use] pub fn get_text_properties(&self) -> Option<&TextProperties> { self.text_properties.as_ref() } diff --git a/src/structs/drawing/charts/date1904.rs b/src/structs/drawing/charts/date1904.rs index fabc9b09..5ffc7994 100644 --- a/src/structs/drawing/charts/date1904.rs +++ b/src/structs/drawing/charts/date1904.rs @@ -1,7 +1,7 @@ // c:h use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Date1904 { val: BooleanValue, } impl Date1904 { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/delete.rs b/src/structs/drawing/charts/delete.rs index 54d12f55..40dd1441 100644 --- a/src/structs/drawing/charts/delete.rs +++ b/src/structs/drawing/charts/delete.rs @@ -1,7 +1,7 @@ // c:delete use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Delete { val: BooleanValue, } impl Delete { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/display_blanks_as.rs b/src/structs/drawing/charts/display_blanks_as.rs index b44c202f..bd4d67e3 100644 --- a/src/structs/drawing/charts/display_blanks_as.rs +++ b/src/structs/drawing/charts/display_blanks_as.rs @@ -1,8 +1,8 @@ // c:dispBlanksAs use super::super::super::EnumValue; use super::DisplayBlanksAsValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct DisplayBlanksAs { val: EnumValue, } impl DisplayBlanksAs { + #[must_use] pub fn get_val(&self) -> &DisplayBlanksAsValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/doughnut_chart.rs b/src/structs/drawing/charts/doughnut_chart.rs index 53d510e6..ee61060f 100644 --- a/src/structs/drawing/charts/doughnut_chart.rs +++ b/src/structs/drawing/charts/doughnut_chart.rs @@ -5,9 +5,9 @@ use super::DataLabels; use super::FirstSliceAngle; use super::HoleSize; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ pub struct DoughnutChart { } impl DoughnutChart { + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -36,6 +37,7 @@ impl DoughnutChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -49,6 +51,7 @@ impl DoughnutChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -62,6 +65,7 @@ impl DoughnutChart { self } + #[must_use] pub fn get_first_slice_angle(&self) -> &FirstSliceAngle { &self.first_slice_angle } @@ -75,6 +79,7 @@ impl DoughnutChart { self } + #[must_use] pub fn get_hole_size(&self) -> &HoleSize { &self.hole_size } diff --git a/src/structs/drawing/charts/editing_language.rs b/src/structs/drawing/charts/editing_language.rs index 5bc17cad..bc124d5e 100644 --- a/src/structs/drawing/charts/editing_language.rs +++ b/src/structs/drawing/charts/editing_language.rs @@ -1,7 +1,7 @@ // c:lang use super::super::super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct EditingLanguage { val: StringValue, } impl EditingLanguage { + #[must_use] pub fn get_val(&self) -> &str { self.val.get_value_str() } diff --git a/src/structs/drawing/charts/explosion.rs b/src/structs/drawing/charts/explosion.rs index 4c95d3c7..7c067d51 100644 --- a/src/structs/drawing/charts/explosion.rs +++ b/src/structs/drawing/charts/explosion.rs @@ -1,7 +1,7 @@ // c:explosion use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Explosion { val: UInt32Value, } impl Explosion { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/first_slice_angle.rs b/src/structs/drawing/charts/first_slice_angle.rs index 71721f7a..f0683da0 100644 --- a/src/structs/drawing/charts/first_slice_angle.rs +++ b/src/structs/drawing/charts/first_slice_angle.rs @@ -1,7 +1,7 @@ // c:firstSliceAng use super::super::super::UInt16Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct FirstSliceAngle { val: UInt16Value, } impl FirstSliceAngle { + #[must_use] pub fn get_val(&self) -> u16 { self.val.get_value() } diff --git a/src/structs/drawing/charts/floor.rs b/src/structs/drawing/charts/floor.rs index 4ed34d78..12bba039 100644 --- a/src/structs/drawing/charts/floor.rs +++ b/src/structs/drawing/charts/floor.rs @@ -1,8 +1,8 @@ // c:marker use super::ShapeProperties; use super::Thickness; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct Floor { } impl Floor { + #[must_use] pub fn get_thickness(&self) -> Option<&Thickness> { self.thickness.as_ref() } @@ -28,6 +29,7 @@ impl Floor { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_deref() } diff --git a/src/structs/drawing/charts/format_code.rs b/src/structs/drawing/charts/format_code.rs index d5b1f478..4142a0c5 100644 --- a/src/structs/drawing/charts/format_code.rs +++ b/src/structs/drawing/charts/format_code.rs @@ -1,5 +1,5 @@ // c:formatCode -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct FormatCode { } impl FormatCode { + #[must_use] pub fn get_text(&self) -> &str { &self.text } diff --git a/src/structs/drawing/charts/formula.rs b/src/structs/drawing/charts/formula.rs index 568fa1af..b2e8d24f 100644 --- a/src/structs/drawing/charts/formula.rs +++ b/src/structs/drawing/charts/formula.rs @@ -3,9 +3,9 @@ use crate::xml_read_loop; // c:f use super::super::super::Address; use super::super::super::StringValue; -use crate::helper::address::*; +use crate::helper::address::is_address; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node_no_escape}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct Formula { } impl Formula { + #[must_use] pub fn get_address(&self) -> &Address { &self.address } @@ -26,6 +27,7 @@ impl Formula { &mut self.address } + #[must_use] pub fn get_address_str(&self) -> String { if self.string_value.has_value() { return self.string_value.get_value_str().to_string(); diff --git a/src/structs/drawing/charts/gap_width.rs b/src/structs/drawing/charts/gap_width.rs index 77c784a3..10ed3f32 100644 --- a/src/structs/drawing/charts/gap_width.rs +++ b/src/structs/drawing/charts/gap_width.rs @@ -1,7 +1,7 @@ // c:gapWidth use super::super::super::UInt16Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct GapWidth { val: UInt16Value, } impl GapWidth { + #[must_use] pub fn get_val(&self) -> u16 { self.val.get_value() } diff --git a/src/structs/drawing/charts/grouping.rs b/src/structs/drawing/charts/grouping.rs index 78576e9e..fb17ce42 100644 --- a/src/structs/drawing/charts/grouping.rs +++ b/src/structs/drawing/charts/grouping.rs @@ -1,8 +1,8 @@ // c:grouping use super::super::super::EnumValue; use super::GroupingValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Grouping { val: EnumValue, } impl Grouping { + #[must_use] pub fn get_val(&self) -> &GroupingValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/header_footer.rs b/src/structs/drawing/charts/header_footer.rs index 601e905b..750d07a3 100644 --- a/src/structs/drawing/charts/header_footer.rs +++ b/src/structs/drawing/charts/header_footer.rs @@ -1,5 +1,5 @@ // c:headerFooter -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/charts/height.rs b/src/structs/drawing/charts/height.rs index 675d1a4a..b70c37de 100644 --- a/src/structs/drawing/charts/height.rs +++ b/src/structs/drawing/charts/height.rs @@ -1,7 +1,7 @@ // c:h use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Height { val: DoubleValue, } impl Height { + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/drawing/charts/height_mode.rs b/src/structs/drawing/charts/height_mode.rs index 5ddd6f52..e7518e66 100644 --- a/src/structs/drawing/charts/height_mode.rs +++ b/src/structs/drawing/charts/height_mode.rs @@ -1,8 +1,8 @@ // c:hMode use super::super::super::EnumValue; use super::LayoutModeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct HeightMode { val: EnumValue, } impl HeightMode { + #[must_use] pub fn get_val(&self) -> &LayoutModeValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/hole_size.rs b/src/structs/drawing/charts/hole_size.rs index e791dfe8..67d8f9db 100644 --- a/src/structs/drawing/charts/hole_size.rs +++ b/src/structs/drawing/charts/hole_size.rs @@ -1,7 +1,7 @@ // c:holeSize use super::super::super::ByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct HoleSize { val: ByteValue, } impl HoleSize { + #[must_use] pub fn get_val(&self) -> u8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/index.rs b/src/structs/drawing/charts/index.rs index cbd4cd0d..c86b79f1 100644 --- a/src/structs/drawing/charts/index.rs +++ b/src/structs/drawing/charts/index.rs @@ -1,7 +1,7 @@ // c:idx use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Index { val: UInt32Value, } impl Index { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/invert_if_negative.rs b/src/structs/drawing/charts/invert_if_negative.rs index 03f3644a..61ab6db1 100644 --- a/src/structs/drawing/charts/invert_if_negative.rs +++ b/src/structs/drawing/charts/invert_if_negative.rs @@ -1,7 +1,7 @@ // c:invertIfNegative use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct InvertIfNegative { val: DoubleValue, } impl InvertIfNegative { + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/drawing/charts/label_alignment.rs b/src/structs/drawing/charts/label_alignment.rs index db8bd280..8e7ef8a2 100644 --- a/src/structs/drawing/charts/label_alignment.rs +++ b/src/structs/drawing/charts/label_alignment.rs @@ -1,8 +1,8 @@ // c:lblAlgn use super::super::super::EnumValue; use super::LabelAlignmentValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct LabelAlignment { val: EnumValue, } impl LabelAlignment { + #[must_use] pub fn get_val(&self) -> &LabelAlignmentValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/label_offset.rs b/src/structs/drawing/charts/label_offset.rs index 259831ad..580775f6 100644 --- a/src/structs/drawing/charts/label_offset.rs +++ b/src/structs/drawing/charts/label_offset.rs @@ -1,7 +1,7 @@ // c:lblOffset use super::super::super::UInt16Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct LabelOffset { val: UInt16Value, } impl LabelOffset { + #[must_use] pub fn get_val(&self) -> u16 { self.val.get_value() } diff --git a/src/structs/drawing/charts/layout.rs b/src/structs/drawing/charts/layout.rs index 74b249fc..1f6af069 100644 --- a/src/structs/drawing/charts/layout.rs +++ b/src/structs/drawing/charts/layout.rs @@ -1,6 +1,6 @@ // c:layout use super::ManualLayout; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -13,6 +13,7 @@ pub struct Layout { } impl Layout { + #[must_use] pub fn get_manual_layout(&self) -> Option<&ManualLayout> { self.manual_layout.as_ref() } @@ -26,6 +27,7 @@ impl Layout { self } + #[must_use] pub fn is_empty(&self) -> bool { self.manual_layout.is_none() } diff --git a/src/structs/drawing/charts/layout_target.rs b/src/structs/drawing/charts/layout_target.rs index f7538a47..0e8c26aa 100644 --- a/src/structs/drawing/charts/layout_target.rs +++ b/src/structs/drawing/charts/layout_target.rs @@ -1,8 +1,8 @@ // c:layoutTarget use super::super::super::EnumValue; use super::LayoutTargetValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct LayoutTarget { val: EnumValue, } impl LayoutTarget { + #[must_use] pub fn get_val(&self) -> &LayoutTargetValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/left.rs b/src/structs/drawing/charts/left.rs index bd34445f..69feab44 100644 --- a/src/structs/drawing/charts/left.rs +++ b/src/structs/drawing/charts/left.rs @@ -1,7 +1,7 @@ // c:x use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Left { val: DoubleValue, } impl Left { + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/drawing/charts/left_mode.rs b/src/structs/drawing/charts/left_mode.rs index 55b2e43c..82ae92e9 100644 --- a/src/structs/drawing/charts/left_mode.rs +++ b/src/structs/drawing/charts/left_mode.rs @@ -1,8 +1,8 @@ // c:xMode use super::super::super::EnumValue; use super::LayoutModeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct LeftMode { val: EnumValue, } impl LeftMode { + #[must_use] pub fn get_val(&self) -> &LayoutModeValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/legend.rs b/src/structs/drawing/charts/legend.rs index a2963ea9..a4650984 100644 --- a/src/structs/drawing/charts/legend.rs +++ b/src/structs/drawing/charts/legend.rs @@ -5,7 +5,7 @@ use super::LegendPosition; use super::Overlay; use super::ShapeProperties; use super::TextProperties; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct Legend { } impl Legend { + #[must_use] pub fn get_legend_position(&self) -> &LegendPosition { &self.legend_position } @@ -34,6 +35,7 @@ impl Legend { self } + #[must_use] pub fn get_layout(&self) -> Option<&Layout> { self.layout.as_deref() } @@ -47,6 +49,7 @@ impl Legend { self } + #[must_use] pub fn get_overlay(&self) -> &Overlay { &self.overlay } @@ -60,6 +63,7 @@ impl Legend { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_deref() } @@ -73,6 +77,7 @@ impl Legend { self } + #[must_use] pub fn get_text_properties(&self) -> Option<&TextProperties> { self.text_properties.as_deref() } diff --git a/src/structs/drawing/charts/legend_position.rs b/src/structs/drawing/charts/legend_position.rs index 75cf8133..66253417 100644 --- a/src/structs/drawing/charts/legend_position.rs +++ b/src/structs/drawing/charts/legend_position.rs @@ -1,8 +1,8 @@ // c:legendPos use super::super::super::EnumValue; use super::LegendPositionValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct LegendPosition { val: EnumValue, } impl LegendPosition { + #[must_use] pub fn get_val(&self) -> &LegendPositionValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/line_3d_chart.rs b/src/structs/drawing/charts/line_3d_chart.rs index d1ba58d6..bd69e9ed 100644 --- a/src/structs/drawing/charts/line_3d_chart.rs +++ b/src/structs/drawing/charts/line_3d_chart.rs @@ -5,9 +5,9 @@ use super::AxisId; use super::DataLabels; use super::Grouping; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct Line3DChart { } impl Line3DChart { + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -37,6 +38,7 @@ impl Line3DChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -50,6 +52,7 @@ impl Line3DChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -63,6 +66,7 @@ impl Line3DChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -76,6 +80,7 @@ impl Line3DChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/line_chart.rs b/src/structs/drawing/charts/line_chart.rs index e4cf015b..64709541 100644 --- a/src/structs/drawing/charts/line_chart.rs +++ b/src/structs/drawing/charts/line_chart.rs @@ -10,7 +10,7 @@ use super::ShowMarker; use super::Smooth; use super::VaryColors; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -29,6 +29,7 @@ pub struct LineChart { } impl LineChart { + #[must_use] pub fn get_grouping(&self) -> &Grouping { &self.grouping } @@ -42,6 +43,7 @@ impl LineChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -55,6 +57,7 @@ impl LineChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -68,6 +71,7 @@ impl LineChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -81,6 +85,7 @@ impl LineChart { self } + #[must_use] pub fn get_show_marker(&self) -> &ShowMarker { &self.show_marker } @@ -94,6 +99,7 @@ impl LineChart { self } + #[must_use] pub fn get_smooth(&self) -> &Smooth { &self.smooth } @@ -107,6 +113,7 @@ impl LineChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/major_gridlines.rs b/src/structs/drawing/charts/major_gridlines.rs index ff8ecba6..7ec0c955 100644 --- a/src/structs/drawing/charts/major_gridlines.rs +++ b/src/structs/drawing/charts/major_gridlines.rs @@ -1,7 +1,7 @@ // c:majorGridlines use super::ShapeProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct MajorGridlines { } impl MajorGridlines { + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } diff --git a/src/structs/drawing/charts/major_tick_mark.rs b/src/structs/drawing/charts/major_tick_mark.rs index a1dfebbb..f77773b5 100644 --- a/src/structs/drawing/charts/major_tick_mark.rs +++ b/src/structs/drawing/charts/major_tick_mark.rs @@ -1,8 +1,8 @@ // c:majorTickMark use super::super::super::EnumValue; use super::TickMarkValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct MajorTickMark { val: EnumValue, } impl MajorTickMark { + #[must_use] pub fn get_val(&self) -> &TickMarkValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/manual_layout.rs b/src/structs/drawing/charts/manual_layout.rs index e085de8b..5e732f6d 100644 --- a/src/structs/drawing/charts/manual_layout.rs +++ b/src/structs/drawing/charts/manual_layout.rs @@ -8,7 +8,7 @@ use super::Top; use super::TopMode; use super::Width; use super::WidthMode; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -29,6 +29,7 @@ pub struct ManualLayout { } impl ManualLayout { + #[must_use] pub fn get_height(&self) -> Option<&Height> { self.height.as_ref() } @@ -42,6 +43,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_height_mode(&self) -> Option<&HeightMode> { self.height_mode.as_ref() } @@ -55,6 +57,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_layout_target(&self) -> Option<&LayoutTarget> { self.layout_target.as_ref() } @@ -68,6 +71,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_left(&self) -> Option<&Left> { self.left.as_ref() } @@ -81,6 +85,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_left_mode(&self) -> Option<&LeftMode> { self.left_mode.as_ref() } @@ -94,6 +99,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_top(&self) -> Option<&Top> { self.top.as_ref() } @@ -107,6 +113,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_top_mode(&self) -> Option<&TopMode> { self.top_mode.as_ref() } @@ -120,6 +127,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_width(&self) -> Option<&Width> { self.width.as_ref() } @@ -133,6 +141,7 @@ impl ManualLayout { self } + #[must_use] pub fn get_width_mode(&self) -> Option<&WidthMode> { self.width_mode.as_ref() } @@ -146,6 +155,7 @@ impl ManualLayout { self } + #[must_use] pub fn is_empty(&self) -> bool { self.height.is_none() && self.height_mode.is_none() diff --git a/src/structs/drawing/charts/marker.rs b/src/structs/drawing/charts/marker.rs index 9ec960b8..ce043735 100644 --- a/src/structs/drawing/charts/marker.rs +++ b/src/structs/drawing/charts/marker.rs @@ -1,7 +1,7 @@ // c:marker use super::Symbol; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Marker { } impl Marker { + #[must_use] pub fn get_symbol(&self) -> Option<&Symbol> { self.symbol.as_ref() } diff --git a/src/structs/drawing/charts/minor_tick_mark.rs b/src/structs/drawing/charts/minor_tick_mark.rs index 6b7db178..c9d828f5 100644 --- a/src/structs/drawing/charts/minor_tick_mark.rs +++ b/src/structs/drawing/charts/minor_tick_mark.rs @@ -1,8 +1,8 @@ // c:minorTickMark use super::super::super::EnumValue; use super::TickMarkValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct MinorTickMark { val: EnumValue, } impl MinorTickMark { + #[must_use] pub fn get_val(&self) -> &TickMarkValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/no_multi_level_labels.rs b/src/structs/drawing/charts/no_multi_level_labels.rs index 71294dd9..0a5af9f5 100644 --- a/src/structs/drawing/charts/no_multi_level_labels.rs +++ b/src/structs/drawing/charts/no_multi_level_labels.rs @@ -1,7 +1,7 @@ // c:noMultiLvlLbl use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct NoMultiLevelLabels { val: BooleanValue, } impl NoMultiLevelLabels { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/number_reference.rs b/src/structs/drawing/charts/number_reference.rs index 39096718..fcce0d3d 100644 --- a/src/structs/drawing/charts/number_reference.rs +++ b/src/structs/drawing/charts/number_reference.rs @@ -4,7 +4,7 @@ use crate::xml_read_loop; use super::Formula; use super::NumberingCache; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct NumberReference { } impl NumberReference { + #[must_use] pub fn get_formula(&self) -> &Formula { &self.formula } @@ -30,6 +31,7 @@ impl NumberReference { self } + #[must_use] pub fn get_numbering_cache(&self) -> &NumberingCache { &self.numbering_cache } diff --git a/src/structs/drawing/charts/numbering_cache.rs b/src/structs/drawing/charts/numbering_cache.rs index c46ff165..d3feb67b 100644 --- a/src/structs/drawing/charts/numbering_cache.rs +++ b/src/structs/drawing/charts/numbering_cache.rs @@ -2,7 +2,7 @@ use super::FormatCode; use crate::structs::Address; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -15,6 +15,7 @@ pub struct NumberingCache { } impl NumberingCache { + #[must_use] pub fn get_format_code(&self) -> &FormatCode { &self.format_code } diff --git a/src/structs/drawing/charts/numbering_format.rs b/src/structs/drawing/charts/numbering_format.rs index 2416654c..c7890392 100644 --- a/src/structs/drawing/charts/numbering_format.rs +++ b/src/structs/drawing/charts/numbering_format.rs @@ -1,8 +1,8 @@ // c:numFmt use super::super::super::BooleanValue; use super::super::super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct NumberingFormat { source_linked: BooleanValue, } impl NumberingFormat { + #[must_use] pub fn get_format_code(&self) -> &str { self.format_code.get_value_str() } @@ -23,6 +24,7 @@ impl NumberingFormat { self } + #[must_use] pub fn get_source_linked(&self) -> bool { self.source_linked.get_value() } diff --git a/src/structs/drawing/charts/numeric_value.rs b/src/structs/drawing/charts/numeric_value.rs index fb339abb..a9eb2824 100644 --- a/src/structs/drawing/charts/numeric_value.rs +++ b/src/structs/drawing/charts/numeric_value.rs @@ -1,5 +1,5 @@ // c:v -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -12,6 +12,7 @@ pub struct NumericValue { } impl NumericValue { + #[must_use] pub fn get_text(&self) -> &str { &self.text } diff --git a/src/structs/drawing/charts/of_pie_chart.rs b/src/structs/drawing/charts/of_pie_chart.rs index d36eae28..4a002e7c 100644 --- a/src/structs/drawing/charts/of_pie_chart.rs +++ b/src/structs/drawing/charts/of_pie_chart.rs @@ -7,9 +7,9 @@ use super::OfPieType; use super::SecondPieSize; use super::SeriesLines; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -27,6 +27,7 @@ pub struct OfPieChart { } impl OfPieChart { + #[must_use] pub fn get_of_pie_type(&self) -> &OfPieType { &self.of_pie_type } @@ -40,6 +41,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -53,6 +55,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -66,6 +69,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -79,6 +83,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_gap_width(&self) -> &GapWidth { &self.gap_width } @@ -92,6 +97,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_second_pie_size(&self) -> &SecondPieSize { &self.second_pie_size } @@ -105,6 +111,7 @@ impl OfPieChart { self } + #[must_use] pub fn get_series_lines(&self) -> &SeriesLines { &self.series_lines } diff --git a/src/structs/drawing/charts/of_pie_type.rs b/src/structs/drawing/charts/of_pie_type.rs index 685b7c31..d7b8ea70 100644 --- a/src/structs/drawing/charts/of_pie_type.rs +++ b/src/structs/drawing/charts/of_pie_type.rs @@ -1,8 +1,8 @@ // c:ofPieType use super::super::super::EnumValue; use super::OfPieValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct OfPieType { val: EnumValue, } impl OfPieType { + #[must_use] pub fn get_val(&self) -> &OfPieValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/order.rs b/src/structs/drawing/charts/order.rs index 64064aa9..da4bb16c 100644 --- a/src/structs/drawing/charts/order.rs +++ b/src/structs/drawing/charts/order.rs @@ -1,7 +1,7 @@ // c:order use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Order { val: UInt32Value, } impl Order { + #[must_use] pub fn get_val(&self) -> u32 { self.val.get_value() } diff --git a/src/structs/drawing/charts/orientation.rs b/src/structs/drawing/charts/orientation.rs index 2ffa934a..54d91f10 100644 --- a/src/structs/drawing/charts/orientation.rs +++ b/src/structs/drawing/charts/orientation.rs @@ -1,8 +1,8 @@ // c:orientation use super::super::super::EnumValue; use super::OrientationValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Orientation { val: EnumValue, } impl Orientation { + #[must_use] pub fn get_val(&self) -> &OrientationValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/overlap.rs b/src/structs/drawing/charts/overlap.rs index c48edb57..61562fa8 100644 --- a/src/structs/drawing/charts/overlap.rs +++ b/src/structs/drawing/charts/overlap.rs @@ -1,7 +1,7 @@ // c:overlap use super::super::super::SByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Overlap { val: SByteValue, } impl Overlap { + #[must_use] pub fn get_val(&self) -> i8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/overlay.rs b/src/structs/drawing/charts/overlay.rs index 81a30815..07213163 100644 --- a/src/structs/drawing/charts/overlay.rs +++ b/src/structs/drawing/charts/overlay.rs @@ -1,7 +1,7 @@ // c:overlay use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Overlay { val: BooleanValue, } impl Overlay { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/page_margins.rs b/src/structs/drawing/charts/page_margins.rs index 918ad2ec..7e758add 100644 --- a/src/structs/drawing/charts/page_margins.rs +++ b/src/structs/drawing/charts/page_margins.rs @@ -1,7 +1,7 @@ // c:pageMargins use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct PageMargins { footer: DoubleValue, } impl PageMargins { + #[must_use] pub fn get_bottom(&self) -> f64 { self.bottom.get_value() } @@ -26,6 +27,7 @@ impl PageMargins { self } + #[must_use] pub fn get_left(&self) -> f64 { self.left.get_value() } @@ -35,6 +37,7 @@ impl PageMargins { self } + #[must_use] pub fn get_right(&self) -> f64 { self.right.get_value() } @@ -44,6 +47,7 @@ impl PageMargins { self } + #[must_use] pub fn get_top(&self) -> f64 { self.top.get_value() } @@ -53,6 +57,7 @@ impl PageMargins { self } + #[must_use] pub fn get_header(&self) -> f64 { self.header.get_value() } @@ -62,6 +67,7 @@ impl PageMargins { self } + #[must_use] pub fn get_footer(&self) -> f64 { self.footer.get_value() } diff --git a/src/structs/drawing/charts/page_setup.rs b/src/structs/drawing/charts/page_setup.rs index 5114e6c4..3896e3a6 100644 --- a/src/structs/drawing/charts/page_setup.rs +++ b/src/structs/drawing/charts/page_setup.rs @@ -1,5 +1,5 @@ // c:pageSetup -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/charts/perspective.rs b/src/structs/drawing/charts/perspective.rs index 688456d3..36ac88cf 100644 --- a/src/structs/drawing/charts/perspective.rs +++ b/src/structs/drawing/charts/perspective.rs @@ -1,7 +1,7 @@ // c:perspective use super::super::super::ByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Perspective { val: ByteValue, } impl Perspective { + #[must_use] pub fn get_val(&self) -> u8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/pie_3d_chart.rs b/src/structs/drawing/charts/pie_3d_chart.rs index d8333140..eb6761d5 100644 --- a/src/structs/drawing/charts/pie_3d_chart.rs +++ b/src/structs/drawing/charts/pie_3d_chart.rs @@ -3,9 +3,9 @@ use super::AreaChartSeries; use super::AreaChartSeriesList; use super::DataLabels; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct Pie3DChart { } impl Pie3DChart { + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -32,6 +33,7 @@ impl Pie3DChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -45,6 +47,7 @@ impl Pie3DChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } diff --git a/src/structs/drawing/charts/pie_chart.rs b/src/structs/drawing/charts/pie_chart.rs index 8f26a5fa..4e0f3459 100644 --- a/src/structs/drawing/charts/pie_chart.rs +++ b/src/structs/drawing/charts/pie_chart.rs @@ -4,9 +4,9 @@ use super::AreaChartSeriesList; use super::DataLabels; use super::FirstSliceAngle; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct PieChart { } impl PieChart { + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -34,6 +35,7 @@ impl PieChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -47,6 +49,7 @@ impl PieChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -60,6 +63,7 @@ impl PieChart { self } + #[must_use] pub fn get_first_slice_angle(&self) -> &FirstSliceAngle { &self.first_slice_angle } diff --git a/src/structs/drawing/charts/plot_area.rs b/src/structs/drawing/charts/plot_area.rs index cd75887a..b507a7b5 100644 --- a/src/structs/drawing/charts/plot_area.rs +++ b/src/structs/drawing/charts/plot_area.rs @@ -22,7 +22,7 @@ use super::ShapeProperties; use super::ValueAxis; use crate::structs::Spreadsheet; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -53,6 +53,7 @@ pub struct PlotArea { } impl PlotArea { + #[must_use] pub fn get_layout(&self) -> &Layout { &self.layout } @@ -66,6 +67,7 @@ impl PlotArea { self } + #[must_use] pub fn get_line_chart(&self) -> Option<&LineChart> { self.line_chart.as_ref() } @@ -79,6 +81,7 @@ impl PlotArea { self } + #[must_use] pub fn get_line_3d_chart(&self) -> Option<&Line3DChart> { self.line_3d_chart.as_ref() } @@ -92,6 +95,7 @@ impl PlotArea { self } + #[must_use] pub fn get_pie_chart(&self) -> Option<&PieChart> { self.pie_chart.as_ref() } @@ -105,6 +109,7 @@ impl PlotArea { self } + #[must_use] pub fn get_pie_3d_chart(&self) -> Option<&Pie3DChart> { self.pie_3d_chart.as_ref() } @@ -118,6 +123,7 @@ impl PlotArea { self } + #[must_use] pub fn get_doughnut_chart(&self) -> Option<&DoughnutChart> { self.doughnut_chart.as_ref() } @@ -131,6 +137,7 @@ impl PlotArea { self } + #[must_use] pub fn get_scatter_chart(&self) -> Option<&ScatterChart> { self.scatter_chart.as_ref() } @@ -144,6 +151,7 @@ impl PlotArea { self } + #[must_use] pub fn get_bar_chart(&self) -> Option<&BarChart> { self.bar_chart.as_ref() } @@ -157,6 +165,7 @@ impl PlotArea { self } + #[must_use] pub fn get_bar_3d_chart(&self) -> Option<&Bar3DChart> { self.bar_3d_chart.as_ref() } @@ -170,6 +179,7 @@ impl PlotArea { self } + #[must_use] pub fn get_radar_chart(&self) -> Option<&RadarChart> { self.radar_chart.as_ref() } @@ -183,6 +193,7 @@ impl PlotArea { self } + #[must_use] pub fn get_bubble_chart(&self) -> Option<&BubbleChart> { self.bubble_chart.as_ref() } @@ -196,6 +207,7 @@ impl PlotArea { self } + #[must_use] pub fn get_area_chart(&self) -> Option<&AreaChart> { self.area_chart.as_ref() } @@ -209,6 +221,7 @@ impl PlotArea { self } + #[must_use] pub fn get_area_3d_chart(&self) -> Option<&Area3DChart> { self.area_3d_chart.as_ref() } @@ -222,6 +235,7 @@ impl PlotArea { self } + #[must_use] pub fn get_of_pie_chart(&self) -> Option<&OfPieChart> { self.of_pie_chart.as_ref() } @@ -235,6 +249,7 @@ impl PlotArea { self } + #[must_use] pub fn get_category_axis(&self) -> &[CategoryAxis] { &self.category_axis } @@ -253,6 +268,7 @@ impl PlotArea { self } + #[must_use] pub fn get_value_axis(&self) -> &[ValueAxis] { &self.value_axis } @@ -271,6 +287,7 @@ impl PlotArea { self } + #[must_use] pub fn get_series_axis(&self) -> &[SeriesAxis] { &self.series_axis } @@ -289,6 +306,7 @@ impl PlotArea { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } diff --git a/src/structs/drawing/charts/plot_visible_only.rs b/src/structs/drawing/charts/plot_visible_only.rs index d0000904..057672a0 100644 --- a/src/structs/drawing/charts/plot_visible_only.rs +++ b/src/structs/drawing/charts/plot_visible_only.rs @@ -1,7 +1,7 @@ // c:plotVisOnly use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct PlotVisibleOnly { val: BooleanValue, } impl PlotVisibleOnly { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/print_settings.rs b/src/structs/drawing/charts/print_settings.rs index d8042d65..b90b8bef 100644 --- a/src/structs/drawing/charts/print_settings.rs +++ b/src/structs/drawing/charts/print_settings.rs @@ -2,8 +2,8 @@ use super::HeaderFooter; use super::PageMargins; use super::PageSetup; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct PrintSettings { } impl PrintSettings { + #[must_use] pub fn get_header_footer(&self) -> &HeaderFooter { &self.header_footer } @@ -30,6 +31,7 @@ impl PrintSettings { self } + #[must_use] pub fn get_page_margins(&self) -> &PageMargins { &self.page_margins } @@ -43,6 +45,7 @@ impl PrintSettings { self } + #[must_use] pub fn get_page_setup(&self) -> &PageSetup { &self.page_setup } diff --git a/src/structs/drawing/charts/radar_chart.rs b/src/structs/drawing/charts/radar_chart.rs index 60d53dc5..3e753cc9 100644 --- a/src/structs/drawing/charts/radar_chart.rs +++ b/src/structs/drawing/charts/radar_chart.rs @@ -5,9 +5,9 @@ use super::AxisId; use super::DataLabels; use super::RadarStyle; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct RadarChart { } impl RadarChart { + #[must_use] pub fn get_radar_style(&self) -> &RadarStyle { &self.radar_style } @@ -37,6 +38,7 @@ impl RadarChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -50,6 +52,7 @@ impl RadarChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -63,6 +66,7 @@ impl RadarChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -76,6 +80,7 @@ impl RadarChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/radar_style.rs b/src/structs/drawing/charts/radar_style.rs index 148fda9f..29d7466b 100644 --- a/src/structs/drawing/charts/radar_style.rs +++ b/src/structs/drawing/charts/radar_style.rs @@ -1,8 +1,8 @@ // c:radarStyle use super::super::super::EnumValue; use super::RadarStyleValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct RadarStyle { val: EnumValue, } impl RadarStyle { + #[must_use] pub fn get_val(&self) -> &RadarStyleValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/rich_text.rs b/src/structs/drawing/charts/rich_text.rs index e22cca13..90bed6af 100644 --- a/src/structs/drawing/charts/rich_text.rs +++ b/src/structs/drawing/charts/rich_text.rs @@ -2,7 +2,7 @@ use super::super::BodyProperties; use super::super::ListStyle; use super::super::Paragraph; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -18,6 +18,7 @@ pub struct RichText { } impl RichText { + #[must_use] pub fn get_body_properties(&self) -> &BodyProperties { &self.body_properties } @@ -30,6 +31,7 @@ impl RichText { self.body_properties = value; } + #[must_use] pub fn get_list_style(&self) -> &ListStyle { &self.list_style } @@ -42,6 +44,7 @@ impl RichText { self.list_style = value; } + #[must_use] pub fn get_paragraph(&self) -> &[Paragraph] { &self.paragraph } diff --git a/src/structs/drawing/charts/right_angle_axes.rs b/src/structs/drawing/charts/right_angle_axes.rs index ca627150..a56a9031 100644 --- a/src/structs/drawing/charts/right_angle_axes.rs +++ b/src/structs/drawing/charts/right_angle_axes.rs @@ -1,7 +1,7 @@ // c:rAngAx use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct RightAngleAxes { val: BooleanValue, } impl RightAngleAxes { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/rotate_x.rs b/src/structs/drawing/charts/rotate_x.rs index 8f8cd58d..5b63e7dc 100644 --- a/src/structs/drawing/charts/rotate_x.rs +++ b/src/structs/drawing/charts/rotate_x.rs @@ -1,7 +1,7 @@ // c:rotX use super::super::super::SByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct RotateX { val: SByteValue, } impl RotateX { + #[must_use] pub fn get_val(&self) -> i8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/rotate_y.rs b/src/structs/drawing/charts/rotate_y.rs index 76071e7f..c7dd49ab 100644 --- a/src/structs/drawing/charts/rotate_y.rs +++ b/src/structs/drawing/charts/rotate_y.rs @@ -1,7 +1,7 @@ // c:rotY use super::super::super::UInt16Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct RotateY { val: UInt16Value, } impl RotateY { + #[must_use] pub fn get_val(&self) -> u16 { self.val.get_value() } diff --git a/src/structs/drawing/charts/rounded_corners.rs b/src/structs/drawing/charts/rounded_corners.rs index f0551ee7..44b70d58 100644 --- a/src/structs/drawing/charts/rounded_corners.rs +++ b/src/structs/drawing/charts/rounded_corners.rs @@ -1,7 +1,7 @@ // c:roundedCorners use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct RoundedCorners { val: BooleanValue, } impl RoundedCorners { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/scaling.rs b/src/structs/drawing/charts/scaling.rs index bc803aac..8f12ffe7 100644 --- a/src/structs/drawing/charts/scaling.rs +++ b/src/structs/drawing/charts/scaling.rs @@ -1,7 +1,7 @@ // c:scaling use super::Orientation; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Scaling { } impl Scaling { + #[must_use] pub fn get_orientation(&self) -> &Orientation { &self.orientation } diff --git a/src/structs/drawing/charts/scatter_chart.rs b/src/structs/drawing/charts/scatter_chart.rs index 669f9fce..a22216b7 100644 --- a/src/structs/drawing/charts/scatter_chart.rs +++ b/src/structs/drawing/charts/scatter_chart.rs @@ -5,9 +5,9 @@ use super::AxisId; use super::DataLabels; use super::ScatterStyle; use super::VaryColors; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct ScatterChart { } impl ScatterChart { + #[must_use] pub fn get_scatter_style(&self) -> &ScatterStyle { &self.scatter_style } @@ -37,6 +38,7 @@ impl ScatterChart { self } + #[must_use] pub fn get_vary_colors(&self) -> &VaryColors { &self.vary_colors } @@ -50,6 +52,7 @@ impl ScatterChart { self } + #[must_use] pub fn get_area_chart_series_list(&self) -> &AreaChartSeriesList { &self.area_chart_series_list } @@ -63,6 +66,7 @@ impl ScatterChart { self } + #[must_use] pub fn get_data_labels(&self) -> &DataLabels { &self.data_labels } @@ -76,6 +80,7 @@ impl ScatterChart { self } + #[must_use] pub fn get_axis_id(&self) -> &[AxisId] { &self.axis_id } diff --git a/src/structs/drawing/charts/scatter_style.rs b/src/structs/drawing/charts/scatter_style.rs index 9c1427fd..a9b82158 100644 --- a/src/structs/drawing/charts/scatter_style.rs +++ b/src/structs/drawing/charts/scatter_style.rs @@ -1,8 +1,8 @@ // c:scatterStyle use super::super::super::EnumValue; use super::ScatterStyleValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct ScatterStyle { val: EnumValue, } impl ScatterStyle { + #[must_use] pub fn get_val(&self) -> &ScatterStyleValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/second_pie_size.rs b/src/structs/drawing/charts/second_pie_size.rs index dbedca60..0cb35d72 100644 --- a/src/structs/drawing/charts/second_pie_size.rs +++ b/src/structs/drawing/charts/second_pie_size.rs @@ -1,7 +1,7 @@ // c:secondPieSize use super::super::super::UInt16Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct SecondPieSize { val: UInt16Value, } impl SecondPieSize { + #[must_use] pub fn get_val(&self) -> u16 { self.val.get_value() } diff --git a/src/structs/drawing/charts/series_axis.rs b/src/structs/drawing/charts/series_axis.rs index 7021ccd7..b3eb6a78 100644 --- a/src/structs/drawing/charts/series_axis.rs +++ b/src/structs/drawing/charts/series_axis.rs @@ -10,8 +10,8 @@ use super::MinorTickMark; use super::Scaling; use super::TickLabelPosition; use super::Title; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -33,6 +33,7 @@ pub struct SeriesAxis { } impl SeriesAxis { + #[must_use] pub fn get_axis_id(&self) -> &AxisId { &self.axis_id } @@ -46,6 +47,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_scaling(&self) -> &Scaling { &self.scaling } @@ -59,6 +61,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_delete(&self) -> &Delete { &self.delete } @@ -72,6 +75,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_axis_position(&self) -> &AxisPosition { &self.axis_position } @@ -85,6 +89,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_major_gridlines(&self) -> Option<&MajorGridlines> { self.major_gridlines.as_deref() } @@ -98,6 +103,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_title(&self) -> Option<&Title> { self.title.as_ref() } @@ -111,6 +117,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_major_tick_mark(&self) -> &MajorTickMark { &self.major_tick_mark } @@ -124,6 +131,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_minor_tick_mark(&self) -> &MinorTickMark { &self.minor_tick_mark } @@ -137,6 +145,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_tick_label_position(&self) -> &TickLabelPosition { &self.tick_label_position } @@ -150,6 +159,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_tick_crossing_axis(&self) -> &CrossingAxis { &self.crossing_axis } @@ -163,6 +173,7 @@ impl SeriesAxis { self } + #[must_use] pub fn get_crosses(&self) -> &Crosses { &self.crosses } diff --git a/src/structs/drawing/charts/series_lines.rs b/src/structs/drawing/charts/series_lines.rs index 5e05c65e..d930b5be 100644 --- a/src/structs/drawing/charts/series_lines.rs +++ b/src/structs/drawing/charts/series_lines.rs @@ -1,5 +1,5 @@ // c:serLines -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/charts/series_text.rs b/src/structs/drawing/charts/series_text.rs index 75fb7bb5..fe6dacd0 100644 --- a/src/structs/drawing/charts/series_text.rs +++ b/src/structs/drawing/charts/series_text.rs @@ -1,7 +1,7 @@ // c:tx -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct SeriesText { } impl SeriesText { + #[must_use] pub fn get_value(&self) -> &str { self.value.get_value_str() } diff --git a/src/structs/drawing/charts/shape.rs b/src/structs/drawing/charts/shape.rs index c40012fc..9ddb9b14 100644 --- a/src/structs/drawing/charts/shape.rs +++ b/src/structs/drawing/charts/shape.rs @@ -1,8 +1,8 @@ // c:shape use super::super::super::EnumValue; use super::ShapeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Shape { val: EnumValue, } impl Shape { + #[must_use] pub fn get_val(&self) -> &ShapeValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/shape_properties.rs b/src/structs/drawing/charts/shape_properties.rs index 115331be..b1b8c77e 100644 --- a/src/structs/drawing/charts/shape_properties.rs +++ b/src/structs/drawing/charts/shape_properties.rs @@ -8,8 +8,8 @@ use super::super::Scene3DType; use super::super::Shape3DType; use super::super::SolidFill; use super::super::Transform2D; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -29,6 +29,7 @@ pub struct ShapeProperties { } impl ShapeProperties { + #[must_use] pub fn get_pattern_fill(&self) -> Option<&PatternFill> { self.pattern_fill.as_ref() } @@ -42,6 +43,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_transform2d(&self) -> Option<&Transform2D> { self.transform2d.as_ref() } @@ -55,6 +57,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_geometry(&self) -> Option<&PresetGeometry> { self.preset_geometry.as_ref() } @@ -68,6 +71,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_ref() } @@ -81,6 +85,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } @@ -94,6 +99,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_outline(&self) -> Option<&Outline> { self.outline.as_ref() } @@ -107,6 +113,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_ref() } @@ -120,6 +127,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_scene_3d_type(&self) -> Option<&Scene3DType> { self.scene_3d_type.as_ref() } @@ -133,6 +141,7 @@ impl ShapeProperties { self } + #[must_use] pub fn get_shape_3d_type(&self) -> Option<&Shape3DType> { self.shape_3d_type.as_ref() } diff --git a/src/structs/drawing/charts/show_bubble_size.rs b/src/structs/drawing/charts/show_bubble_size.rs index 5cf0dbe5..f092c806 100644 --- a/src/structs/drawing/charts/show_bubble_size.rs +++ b/src/structs/drawing/charts/show_bubble_size.rs @@ -1,7 +1,7 @@ // c:showBubbleSize use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowBubbleSize { val: BooleanValue, } impl ShowBubbleSize { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_category_name.rs b/src/structs/drawing/charts/show_category_name.rs index 2d7d4705..d5b7ac22 100644 --- a/src/structs/drawing/charts/show_category_name.rs +++ b/src/structs/drawing/charts/show_category_name.rs @@ -1,7 +1,7 @@ // c:showCatName use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowCategoryName { val: BooleanValue, } impl ShowCategoryName { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_data_labels_over_maximum.rs b/src/structs/drawing/charts/show_data_labels_over_maximum.rs index 9fc2b5b6..3093aea0 100644 --- a/src/structs/drawing/charts/show_data_labels_over_maximum.rs +++ b/src/structs/drawing/charts/show_data_labels_over_maximum.rs @@ -1,7 +1,7 @@ // c:showDLblsOverMax use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowDataLabelsOverMaximum { val: BooleanValue, } impl ShowDataLabelsOverMaximum { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_leader_lines.rs b/src/structs/drawing/charts/show_leader_lines.rs index b15be991..c5dc21af 100644 --- a/src/structs/drawing/charts/show_leader_lines.rs +++ b/src/structs/drawing/charts/show_leader_lines.rs @@ -1,7 +1,7 @@ // c:showLeaderLines use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowLeaderLines { val: BooleanValue, } impl ShowLeaderLines { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_legend_key.rs b/src/structs/drawing/charts/show_legend_key.rs index b4a28eb2..b3aacb85 100644 --- a/src/structs/drawing/charts/show_legend_key.rs +++ b/src/structs/drawing/charts/show_legend_key.rs @@ -1,7 +1,7 @@ // c:showLegendKey use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowLegendKey { val: BooleanValue, } impl ShowLegendKey { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_marker.rs b/src/structs/drawing/charts/show_marker.rs index 901ad61f..b6359fdb 100644 --- a/src/structs/drawing/charts/show_marker.rs +++ b/src/structs/drawing/charts/show_marker.rs @@ -1,7 +1,7 @@ // c:marker use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowMarker { val: BooleanValue, } impl ShowMarker { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_negative_bubbles.rs b/src/structs/drawing/charts/show_negative_bubbles.rs index 8ed58dfc..c0777320 100644 --- a/src/structs/drawing/charts/show_negative_bubbles.rs +++ b/src/structs/drawing/charts/show_negative_bubbles.rs @@ -1,7 +1,7 @@ // c:showNegBubbles use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowNegativeBubbles { val: BooleanValue, } impl ShowNegativeBubbles { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_percent.rs b/src/structs/drawing/charts/show_percent.rs index 94654381..8b4ef6e5 100644 --- a/src/structs/drawing/charts/show_percent.rs +++ b/src/structs/drawing/charts/show_percent.rs @@ -1,7 +1,7 @@ // c:showPercent use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowPercent { val: BooleanValue, } impl ShowPercent { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_series_name.rs b/src/structs/drawing/charts/show_series_name.rs index e33ab0ab..70e843a9 100644 --- a/src/structs/drawing/charts/show_series_name.rs +++ b/src/structs/drawing/charts/show_series_name.rs @@ -1,7 +1,7 @@ // c:showSerName use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowSeriesName { val: BooleanValue, } impl ShowSeriesName { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/show_value.rs b/src/structs/drawing/charts/show_value.rs index b7cb86a6..49e25b30 100644 --- a/src/structs/drawing/charts/show_value.rs +++ b/src/structs/drawing/charts/show_value.rs @@ -1,7 +1,7 @@ // c:showVal use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct ShowValue { val: BooleanValue, } impl ShowValue { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/side_wall.rs b/src/structs/drawing/charts/side_wall.rs index 513b6b5a..a11aa50d 100644 --- a/src/structs/drawing/charts/side_wall.rs +++ b/src/structs/drawing/charts/side_wall.rs @@ -1,8 +1,8 @@ // c:sideWall use super::ShapeProperties; use super::Thickness; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct SideWall { } impl SideWall { + #[must_use] pub fn get_thickness(&self) -> Option<&Thickness> { self.thickness.as_ref() } @@ -28,6 +29,7 @@ impl SideWall { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } diff --git a/src/structs/drawing/charts/smooth.rs b/src/structs/drawing/charts/smooth.rs index b6875119..3e4fdc43 100644 --- a/src/structs/drawing/charts/smooth.rs +++ b/src/structs/drawing/charts/smooth.rs @@ -1,7 +1,7 @@ // c:smooth use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Smooth { val: BooleanValue, } impl Smooth { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/string_cache.rs b/src/structs/drawing/charts/string_cache.rs index 5b8f4522..a12206eb 100644 --- a/src/structs/drawing/charts/string_cache.rs +++ b/src/structs/drawing/charts/string_cache.rs @@ -1,8 +1,8 @@ // c:strCache -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Address; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/charts/string_literal.rs b/src/structs/drawing/charts/string_literal.rs index 906930b2..4d1eb416 100644 --- a/src/structs/drawing/charts/string_literal.rs +++ b/src/structs/drawing/charts/string_literal.rs @@ -1,7 +1,7 @@ // c:strLit use super::StringPoint; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct StringLiteral { } impl StringLiteral { + #[must_use] pub fn get_string_point_list(&self) -> &[StringPoint] { &self.string_point_list } diff --git a/src/structs/drawing/charts/string_point.rs b/src/structs/drawing/charts/string_point.rs index c5654f80..7010bd21 100644 --- a/src/structs/drawing/charts/string_point.rs +++ b/src/structs/drawing/charts/string_point.rs @@ -2,7 +2,7 @@ use crate::xml_read_loop; // c:pt use super::NumericValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct StringPoint { } impl StringPoint { + #[must_use] pub fn get_numeric_value(&self) -> &NumericValue { &self.numeric_value } diff --git a/src/structs/drawing/charts/string_reference.rs b/src/structs/drawing/charts/string_reference.rs index b4c528b6..e646057b 100644 --- a/src/structs/drawing/charts/string_reference.rs +++ b/src/structs/drawing/charts/string_reference.rs @@ -4,7 +4,7 @@ use crate::xml_read_loop; use super::Formula; use super::StringCache; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct StringReference { } impl StringReference { + #[must_use] pub fn get_formula(&self) -> &Formula { &self.formula } @@ -30,6 +31,7 @@ impl StringReference { self } + #[must_use] pub fn get_string_cache(&self) -> &StringCache { &self.string_cache } diff --git a/src/structs/drawing/charts/style.rs b/src/structs/drawing/charts/style.rs index a612d2a3..6ae18f68 100644 --- a/src/structs/drawing/charts/style.rs +++ b/src/structs/drawing/charts/style.rs @@ -1,7 +1,7 @@ // c:style use super::super::super::ByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Style { } impl Style { + #[must_use] pub fn get_val(&self) -> u8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/symbol.rs b/src/structs/drawing/charts/symbol.rs index 0850ba4e..0550ea89 100644 --- a/src/structs/drawing/charts/symbol.rs +++ b/src/structs/drawing/charts/symbol.rs @@ -1,8 +1,8 @@ // c:symbol use super::super::super::EnumValue; use super::MarkerStyleValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Symbol { val: EnumValue, } impl Symbol { + #[must_use] pub fn get_val(&self) -> &MarkerStyleValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/text_properties.rs b/src/structs/drawing/charts/text_properties.rs index f47190d6..74ad8fc7 100644 --- a/src/structs/drawing/charts/text_properties.rs +++ b/src/structs/drawing/charts/text_properties.rs @@ -2,8 +2,8 @@ use super::super::BodyProperties; use super::super::ListStyle; use super::super::Paragraph; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct TextProperties { } impl TextProperties { + #[must_use] pub fn get_body_properties(&self) -> &BodyProperties { &self.body_properties } @@ -31,6 +32,7 @@ impl TextProperties { self } + #[must_use] pub fn get_list_style(&self) -> &ListStyle { &self.list_style } @@ -44,6 +46,7 @@ impl TextProperties { self } + #[must_use] pub fn get_paragraph(&self) -> &[Paragraph] { &self.paragraph } diff --git a/src/structs/drawing/charts/thickness.rs b/src/structs/drawing/charts/thickness.rs index 828e19ac..99918663 100644 --- a/src/structs/drawing/charts/thickness.rs +++ b/src/structs/drawing/charts/thickness.rs @@ -1,7 +1,7 @@ // c:thickness use super::super::super::ByteValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Thickness { val: ByteValue, } impl Thickness { + #[must_use] pub fn get_val(&self) -> u8 { self.val.get_value() } diff --git a/src/structs/drawing/charts/tick_label_position.rs b/src/structs/drawing/charts/tick_label_position.rs index c9f79524..903b1446 100644 --- a/src/structs/drawing/charts/tick_label_position.rs +++ b/src/structs/drawing/charts/tick_label_position.rs @@ -1,8 +1,8 @@ // c:tickLblPos use super::super::super::EnumValue; use super::TickLabelPositionValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct TickLabelPosition { val: EnumValue, } impl TickLabelPosition { + #[must_use] pub fn get_val(&self) -> &TickLabelPositionValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/title.rs b/src/structs/drawing/charts/title.rs index 039d2622..036c9832 100644 --- a/src/structs/drawing/charts/title.rs +++ b/src/structs/drawing/charts/title.rs @@ -2,7 +2,7 @@ use super::ChartText; use super::Layout; use super::Overlay; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct Title { } impl Title { + #[must_use] pub fn get_chart_text(&self) -> Option<&ChartText> { self.chart_text.as_ref() } @@ -30,6 +31,7 @@ impl Title { self } + #[must_use] pub fn get_layout(&self) -> Option<&Layout> { self.layout.as_ref() } @@ -43,6 +45,7 @@ impl Title { self } + #[must_use] pub fn get_overlay(&self) -> &Overlay { &self.overlay } diff --git a/src/structs/drawing/charts/top.rs b/src/structs/drawing/charts/top.rs index 1d699953..1397dec8 100644 --- a/src/structs/drawing/charts/top.rs +++ b/src/structs/drawing/charts/top.rs @@ -1,7 +1,7 @@ // c:y use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Top { val: DoubleValue, } impl Top { + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/drawing/charts/top_mode.rs b/src/structs/drawing/charts/top_mode.rs index 88c0ed93..9eb495a1 100644 --- a/src/structs/drawing/charts/top_mode.rs +++ b/src/structs/drawing/charts/top_mode.rs @@ -1,8 +1,8 @@ // c:yMode use super::super::super::EnumValue; use super::LayoutModeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct TopMode { val: EnumValue, } impl TopMode { + #[must_use] pub fn get_val(&self) -> &LayoutModeValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/value_axis.rs b/src/structs/drawing/charts/value_axis.rs index e72ba44e..7846a3f9 100644 --- a/src/structs/drawing/charts/value_axis.rs +++ b/src/structs/drawing/charts/value_axis.rs @@ -14,8 +14,8 @@ use super::ShapeProperties; use super::TextProperties; use super::TickLabelPosition; use super::Title; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -41,6 +41,7 @@ pub struct ValueAxis { } impl ValueAxis { + #[must_use] pub fn get_axis_id(&self) -> &AxisId { &self.axis_id } @@ -54,6 +55,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_scaling(&self) -> &Scaling { &self.scaling } @@ -67,6 +69,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_delete(&self) -> &Delete { &self.delete } @@ -80,6 +83,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_axis_position(&self) -> &AxisPosition { &self.axis_position } @@ -93,6 +97,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_major_gridlines(&self) -> Option<&MajorGridlines> { self.major_gridlines.as_ref() } @@ -106,6 +111,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_title(&self) -> Option<&Title> { self.title.as_ref() } @@ -119,6 +125,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_numbering_format(&self) -> &NumberingFormat { &self.numbering_format } @@ -132,6 +139,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_major_tick_mark(&self) -> &MajorTickMark { &self.major_tick_mark } @@ -145,6 +153,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_minor_tick_mark(&self) -> &MinorTickMark { &self.minor_tick_mark } @@ -158,6 +167,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_tick_label_position(&self) -> &TickLabelPosition { &self.tick_label_position } @@ -171,6 +181,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_tick_crossing_axis(&self) -> &CrossingAxis { &self.crossing_axis } @@ -184,6 +195,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_crosses(&self) -> &Crosses { &self.crosses } @@ -197,6 +209,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_cross_between(&self) -> &CrossBetween { &self.cross_between } @@ -210,6 +223,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_shape_properties(&self) -> Option<&ShapeProperties> { self.shape_properties.as_ref() } @@ -223,6 +237,7 @@ impl ValueAxis { self } + #[must_use] pub fn get_text_properties(&self) -> Option<&TextProperties> { self.text_properties.as_ref() } diff --git a/src/structs/drawing/charts/values.rs b/src/structs/drawing/charts/values.rs index 69b9af68..e18f178f 100644 --- a/src/structs/drawing/charts/values.rs +++ b/src/structs/drawing/charts/values.rs @@ -3,7 +3,7 @@ use crate::xml_read_loop; // c:val use super::NumberReference; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct Values { } impl Values { + #[must_use] pub fn get_number_reference(&self) -> &NumberReference { &self.number_reference } diff --git a/src/structs/drawing/charts/vary_colors.rs b/src/structs/drawing/charts/vary_colors.rs index 90eeab14..e6fadff1 100644 --- a/src/structs/drawing/charts/vary_colors.rs +++ b/src/structs/drawing/charts/vary_colors.rs @@ -1,7 +1,7 @@ // c:varyColors use super::super::super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct VaryColors { val: BooleanValue, } impl VaryColors { + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/drawing/charts/view_3d.rs b/src/structs/drawing/charts/view_3d.rs index 085ddf1a..842c7e67 100644 --- a/src/structs/drawing/charts/view_3d.rs +++ b/src/structs/drawing/charts/view_3d.rs @@ -3,8 +3,8 @@ use super::Perspective; use super::RightAngleAxes; use super::RotateX; use super::RotateY; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct View3D { } impl View3D { + #[must_use] pub fn get_rotate_x(&self) -> Option<&RotateX> { self.rotate_x.as_ref() } @@ -32,6 +33,7 @@ impl View3D { self } + #[must_use] pub fn get_rotate_y(&self) -> Option<&RotateY> { self.rotate_y.as_ref() } @@ -45,6 +47,7 @@ impl View3D { self } + #[must_use] pub fn get_right_angle_axes(&self) -> Option<&RightAngleAxes> { self.right_angle_axes.as_ref() } @@ -58,6 +61,7 @@ impl View3D { self } + #[must_use] pub fn get_perspective(&self) -> Option<&Perspective> { self.perspective.as_ref() } diff --git a/src/structs/drawing/charts/width.rs b/src/structs/drawing/charts/width.rs index a7d71fe6..d80d809d 100644 --- a/src/structs/drawing/charts/width.rs +++ b/src/structs/drawing/charts/width.rs @@ -1,7 +1,7 @@ // c:w use super::super::super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Width { val: DoubleValue, } impl Width { + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/drawing/charts/width_mode.rs b/src/structs/drawing/charts/width_mode.rs index e06fdcd3..a5e538b0 100644 --- a/src/structs/drawing/charts/width_mode.rs +++ b/src/structs/drawing/charts/width_mode.rs @@ -1,8 +1,8 @@ // c:wMode use super::super::super::EnumValue; use super::LayoutModeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct WidthMode { val: EnumValue, } impl WidthMode { + #[must_use] pub fn get_val(&self) -> &LayoutModeValues { self.val.get_value() } diff --git a/src/structs/drawing/charts/x_values.rs b/src/structs/drawing/charts/x_values.rs index d955a595..7d5351c2 100644 --- a/src/structs/drawing/charts/x_values.rs +++ b/src/structs/drawing/charts/x_values.rs @@ -1,8 +1,8 @@ // c:xVal use super::NumberReference; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct XValues { } impl XValues { + #[must_use] pub fn get_number_reference(&self) -> &NumberReference { &self.number_reference } diff --git a/src/structs/drawing/charts/y_values.rs b/src/structs/drawing/charts/y_values.rs index 97b1e4b8..548bb9b3 100644 --- a/src/structs/drawing/charts/y_values.rs +++ b/src/structs/drawing/charts/y_values.rs @@ -1,8 +1,8 @@ // c:yVal use super::NumberReference; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Spreadsheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct YValues { } impl YValues { + #[must_use] pub fn get_number_reference(&self) -> &NumberReference { &self.number_reference } diff --git a/src/structs/drawing/color2_type.rs b/src/structs/drawing/color2_type.rs index 7922bbb0..d4b96d15 100644 --- a/src/structs/drawing/color2_type.rs +++ b/src/structs/drawing/color2_type.rs @@ -1,7 +1,7 @@ use super::RgbColorModelHex; use super::SystemColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -20,6 +20,7 @@ impl Color2Type { } #[inline] + #[must_use] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } @@ -35,6 +36,7 @@ impl Color2Type { } #[inline] + #[must_use] pub fn get_system_color(&self) -> Option<&SystemColor> { self.system_color.as_deref() } @@ -45,6 +47,7 @@ impl Color2Type { } #[inline] + #[must_use] pub fn get_val(&self) -> String { if let Some(v) = &self.rgb_color_model_hex { return v.get_val().to_string(); @@ -52,7 +55,7 @@ impl Color2Type { if let Some(v) = &self.system_color { return v.get_last_color().to_string(); } - String::from("") + String::new() } pub(crate) fn set_attributes( diff --git a/src/structs/drawing/color_scheme.rs b/src/structs/drawing/color_scheme.rs index 9ca2dd01..20919beb 100644 --- a/src/structs/drawing/color_scheme.rs +++ b/src/structs/drawing/color_scheme.rs @@ -1,8 +1,8 @@ // a:clrScheme use super::super::StringValue; use super::Color2Type; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -27,6 +27,7 @@ pub struct ColorScheme { impl ColorScheme { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -43,6 +44,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent1(&self) -> &Color2Type { &self.accent1 } @@ -58,6 +60,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent2(&self) -> &Color2Type { &self.accent2 } @@ -73,6 +76,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent3(&self) -> &Color2Type { &self.accent3 } @@ -88,6 +92,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent4(&self) -> &Color2Type { &self.accent4 } @@ -103,6 +108,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent5(&self) -> &Color2Type { &self.accent5 } @@ -118,6 +124,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_accent6(&self) -> &Color2Type { &self.accent6 } @@ -133,6 +140,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_dk1(&self) -> &Color2Type { &self.dk1 } @@ -148,6 +156,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_dk2(&self) -> &Color2Type { &self.dk2 } @@ -163,6 +172,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_fol_hlink(&self) -> &Color2Type { &self.fol_hlink } @@ -178,6 +188,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_hlink(&self) -> &Color2Type { &self.hlink } @@ -193,6 +204,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_lt1(&self) -> &Color2Type { &self.lt1 } @@ -208,6 +220,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_lt2(&self) -> &Color2Type { &self.lt2 } @@ -218,6 +231,7 @@ impl ColorScheme { } #[inline] + #[must_use] pub fn get_color_map(&self) -> Vec { vec![ self.lt1.get_val(), diff --git a/src/structs/drawing/effect_list.rs b/src/structs/drawing/effect_list.rs index 50e20a3b..b151bd10 100644 --- a/src/structs/drawing/effect_list.rs +++ b/src/structs/drawing/effect_list.rs @@ -2,8 +2,8 @@ use super::Glow; use super::OuterShadow; use super::SoftEdge; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct EffectList { impl EffectList { #[inline] + #[must_use] pub fn get_glow(&self) -> Option<&Glow> { self.glow.as_deref() } @@ -33,6 +34,7 @@ impl EffectList { } #[inline] + #[must_use] pub fn get_outer_shadow(&self) -> Option<&OuterShadow> { self.outer_shadow.as_deref() } @@ -48,6 +50,7 @@ impl EffectList { } #[inline] + #[must_use] pub fn get_soft_edge(&self) -> Option<&SoftEdge> { self.soft_edge.as_deref() } diff --git a/src/structs/drawing/effect_style.rs b/src/structs/drawing/effect_style.rs index 9349c219..28721ede 100644 --- a/src/structs/drawing/effect_style.rs +++ b/src/structs/drawing/effect_style.rs @@ -1,8 +1,8 @@ use super::EffectList; use super::Scene3DType; use super::Shape3DType; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct EffectStyle { impl EffectStyle { #[inline] + #[must_use] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } @@ -34,6 +35,7 @@ impl EffectStyle { } #[inline] + #[must_use] pub fn get_scene_3d_type(&self) -> Option<&Scene3DType> { self.scene_3d_type.as_deref() } @@ -50,6 +52,7 @@ impl EffectStyle { } #[inline] + #[must_use] pub fn get_shape_3d_type(&self) -> Option<&Shape3DType> { self.shape_3d_type.as_deref() } diff --git a/src/structs/drawing/effect_style_list.rs b/src/structs/drawing/effect_style_list.rs index f05f9e3a..b8bf6b0c 100644 --- a/src/structs/drawing/effect_style_list.rs +++ b/src/structs/drawing/effect_style_list.rs @@ -1,6 +1,6 @@ use super::EffectStyle; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct EffectStyleList { impl EffectStyleList { #[inline] + #[must_use] pub fn get_effect_style_collection(&self) -> &[EffectStyle] { &self.effect_style_collection } diff --git a/src/structs/drawing/end_connection.rs b/src/structs/drawing/end_connection.rs index 4a84b1f5..91132aa1 100644 --- a/src/structs/drawing/end_connection.rs +++ b/src/structs/drawing/end_connection.rs @@ -1,7 +1,7 @@ // a:endCxn use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct EndConnection { } impl EndConnection { #[inline] + #[must_use] pub fn get_id(&self) -> u32 { self.id.get_value() } @@ -24,6 +25,7 @@ impl EndConnection { } #[inline] + #[must_use] pub fn get_index(&self) -> u32 { self.index.get_value() } diff --git a/src/structs/drawing/extension_list.rs b/src/structs/drawing/extension_list.rs index 0e8760b4..4265601e 100644 --- a/src/structs/drawing/extension_list.rs +++ b/src/structs/drawing/extension_list.rs @@ -1,5 +1,5 @@ // a:extLst -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; diff --git a/src/structs/drawing/extents.rs b/src/structs/drawing/extents.rs index 181f9ee8..66e54a43 100644 --- a/src/structs/drawing/extents.rs +++ b/src/structs/drawing/extents.rs @@ -1,7 +1,7 @@ // a:ext use super::super::super::Int64Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Extents { } impl Extents { #[inline] + #[must_use] pub fn get_cx(&self) -> i64 { self.cx.get_value() } @@ -25,6 +26,7 @@ impl Extents { } #[inline] + #[must_use] pub fn get_cy(&self) -> i64 { self.cy.get_value() } diff --git a/src/structs/drawing/fill_rectangle.rs b/src/structs/drawing/fill_rectangle.rs index e18c4041..b2300bb8 100644 --- a/src/structs/drawing/fill_rectangle.rs +++ b/src/structs/drawing/fill_rectangle.rs @@ -1,5 +1,5 @@ // a:fillRect -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct FillRectangle { } impl FillRectangle { #[inline] + #[must_use] pub fn get_bottom(&self) -> usize { self.bottom } @@ -24,6 +25,7 @@ impl FillRectangle { } #[inline] + #[must_use] pub fn get_left(&self) -> usize { self.left } @@ -34,6 +36,7 @@ impl FillRectangle { } #[inline] + #[must_use] pub fn get_right(&self) -> usize { self.right } @@ -44,6 +47,7 @@ impl FillRectangle { } #[inline] + #[must_use] pub fn get_top(&self) -> usize { self.top } diff --git a/src/structs/drawing/fill_style_list.rs b/src/structs/drawing/fill_style_list.rs index 8112d8f9..f495e3c8 100644 --- a/src/structs/drawing/fill_style_list.rs +++ b/src/structs/drawing/fill_style_list.rs @@ -1,7 +1,7 @@ use super::GradientFill; use super::SolidFill; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct FillStyleList { impl FillStyleList { #[inline] + #[must_use] pub fn get_solid_fill(&self) -> &[SolidFill] { &self.solid_fill } @@ -38,6 +39,7 @@ impl FillStyleList { } #[inline] + #[must_use] pub fn get_gradient_fill_collection(&self) -> &[GradientFill] { &self.gradient_fill_collection } diff --git a/src/structs/drawing/font_collection_type.rs b/src/structs/drawing/font_collection_type.rs index 2d1440ac..5f777147 100644 --- a/src/structs/drawing/font_collection_type.rs +++ b/src/structs/drawing/font_collection_type.rs @@ -2,7 +2,7 @@ // a:minorFont use super::SupplementalFont; use super::TextFontType; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct FontCollectionType { } impl FontCollectionType { #[inline] + #[must_use] pub fn get_latin_font(&self) -> &TextFontType { &self.latin_font } @@ -34,6 +35,7 @@ impl FontCollectionType { } #[inline] + #[must_use] pub fn get_east_asian_font(&self) -> &TextFontType { &self.east_asian_font } @@ -50,6 +52,7 @@ impl FontCollectionType { } #[inline] + #[must_use] pub fn get_complex_script_font(&self) -> &TextFontType { &self.complex_script_font } @@ -66,6 +69,7 @@ impl FontCollectionType { } #[inline] + #[must_use] pub fn get_supplemental_font_list(&self) -> &[SupplementalFont] { &self.supplemental_font_list } @@ -95,7 +99,7 @@ impl FontCollectionType { self.latin_font.set_panose("020F0302020204030204"); self.east_asian_font.set_typeface(""); self.complex_script_font.set_typeface(""); - for (font_script, typeface) in self::MAJOR_FONTS { + for (font_script, typeface) in MAJOR_FONTS { let mut obj = SupplementalFont::default(); obj.set_script(*font_script).set_typeface(*typeface); self.supplemental_font_list.push(obj); @@ -108,7 +112,7 @@ impl FontCollectionType { self.latin_font.set_panose("020F0502020204030204"); self.east_asian_font.set_typeface(""); self.complex_script_font.set_typeface(""); - for (font_script, typeface) in self::MINOR_FONTS { + for (font_script, typeface) in MINOR_FONTS { let mut obj = SupplementalFont::default(); obj.set_script(*font_script).set_typeface(*typeface); self.supplemental_font_list.push(obj); diff --git a/src/structs/drawing/font_scheme.rs b/src/structs/drawing/font_scheme.rs index 308d45ea..e8931df1 100644 --- a/src/structs/drawing/font_scheme.rs +++ b/src/structs/drawing/font_scheme.rs @@ -1,8 +1,8 @@ // a:fontScheme use super::super::StringValue; use super::FontCollectionType; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct FontScheme { impl FontScheme { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -28,6 +29,7 @@ impl FontScheme { } #[inline] + #[must_use] pub fn get_major_font(&self) -> &FontCollectionType { &self.major_font } @@ -44,6 +46,7 @@ impl FontScheme { } #[inline] + #[must_use] pub fn get_minor_font(&self) -> &FontCollectionType { &self.minor_font } diff --git a/src/structs/drawing/foreground_color.rs b/src/structs/drawing/foreground_color.rs index 52315781..a85fb32f 100644 --- a/src/structs/drawing/foreground_color.rs +++ b/src/structs/drawing/foreground_color.rs @@ -1,7 +1,7 @@ // a:fgClr use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ForegroundColor { impl ForegroundColor { #[inline] + #[must_use] pub fn get_scheme_color(&self) -> &SchemeColor { &self.scheme_color } diff --git a/src/structs/drawing/format_scheme.rs b/src/structs/drawing/format_scheme.rs index d22fea5c..aa55b775 100644 --- a/src/structs/drawing/format_scheme.rs +++ b/src/structs/drawing/format_scheme.rs @@ -4,8 +4,8 @@ use super::BackgroundFillStyleList; use super::EffectStyleList; use super::FillStyleList; use super::LineStyleList; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -22,6 +22,7 @@ pub struct FormatScheme { impl FormatScheme { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -33,6 +34,7 @@ impl FormatScheme { } #[inline] + #[must_use] pub fn get_fill_style_list(&self) -> &FillStyleList { &self.fill_style_list } @@ -48,6 +50,7 @@ impl FormatScheme { } #[inline] + #[must_use] pub fn get_line_style_list(&self) -> &LineStyleList { &self.line_style_list } @@ -63,6 +66,7 @@ impl FormatScheme { } #[inline] + #[must_use] pub fn get_effect_style_list(&self) -> &EffectStyleList { &self.effect_style_list } @@ -78,6 +82,7 @@ impl FormatScheme { } #[inline] + #[must_use] pub fn get_background_fill_style_list(&self) -> &BackgroundFillStyleList { &self.background_fill_style_list } diff --git a/src/structs/drawing/glow.rs b/src/structs/drawing/glow.rs index fe6a0e2c..c76b4651 100644 --- a/src/structs/drawing/glow.rs +++ b/src/structs/drawing/glow.rs @@ -1,8 +1,8 @@ // a:glow use super::super::super::Int64Value; use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Glow { impl Glow { #[inline] + #[must_use] pub fn get_radius(&self) -> i64 { self.radius.get_value() } @@ -27,6 +28,7 @@ impl Glow { } #[inline] + #[must_use] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } diff --git a/src/structs/drawing/gradient_fill.rs b/src/structs/drawing/gradient_fill.rs index 80754d84..8c30128b 100644 --- a/src/structs/drawing/gradient_fill.rs +++ b/src/structs/drawing/gradient_fill.rs @@ -5,8 +5,8 @@ use super::GradientStopList; use super::LinearGradientFill; use super::TileFlipValues; use super::TileRectangle; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ pub struct GradientFill { impl GradientFill { #[inline] + #[must_use] pub fn get_flip(&self) -> &TileFlipValues { self.flip.get_value() } @@ -34,6 +35,7 @@ impl GradientFill { } #[inline] + #[must_use] pub fn get_rotate_with_shape(&self) -> bool { self.rotate_with_shape.get_value() } @@ -45,6 +47,7 @@ impl GradientFill { } #[inline] + #[must_use] pub fn get_gradient_stop_list(&self) -> &GradientStopList { &self.gradient_stop_list } @@ -61,6 +64,7 @@ impl GradientFill { } #[inline] + #[must_use] pub fn get_linear_gradient_fill(&self) -> Option<&LinearGradientFill> { self.linear_gradient_fill.as_deref() } @@ -77,6 +81,7 @@ impl GradientFill { } #[inline] + #[must_use] pub fn get_tile_rectangle(&self) -> Option<&TileRectangle> { self.tile_rectangle.as_deref() } diff --git a/src/structs/drawing/gradient_stop.rs b/src/structs/drawing/gradient_stop.rs index 53d0911b..20742a33 100644 --- a/src/structs/drawing/gradient_stop.rs +++ b/src/structs/drawing/gradient_stop.rs @@ -1,8 +1,8 @@ // a:gs use super::RgbColorModelHex; use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct GradientStop { impl GradientStop { #[inline] + #[must_use] pub fn get_position(&self) -> i32 { self.position } @@ -28,6 +29,7 @@ impl GradientStop { } #[inline] + #[must_use] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } @@ -44,6 +46,7 @@ impl GradientStop { } #[inline] + #[must_use] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } diff --git a/src/structs/drawing/gradient_stop_list.rs b/src/structs/drawing/gradient_stop_list.rs index f6f9b587..0543ea25 100644 --- a/src/structs/drawing/gradient_stop_list.rs +++ b/src/structs/drawing/gradient_stop_list.rs @@ -1,7 +1,7 @@ // a:gsLst use super::GradientStop; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct GradientStopList { impl GradientStopList { #[inline] + #[must_use] pub fn get_gradient_stop(&self) -> &[GradientStop] { &self.gradient_stop } diff --git a/src/structs/drawing/graphic.rs b/src/structs/drawing/graphic.rs index 3b368a9e..27cb8604 100644 --- a/src/structs/drawing/graphic.rs +++ b/src/structs/drawing/graphic.rs @@ -1,9 +1,9 @@ // a:graphic use super::GraphicData; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Graphic { impl Graphic { #[inline] + #[must_use] pub fn get_graphic_data(&self) -> &GraphicData { &self.graphic_data } diff --git a/src/structs/drawing/graphic_data.rs b/src/structs/drawing/graphic_data.rs index abe36cb9..679d7932 100644 --- a/src/structs/drawing/graphic_data.rs +++ b/src/structs/drawing/graphic_data.rs @@ -1,11 +1,11 @@ // *:graphicData use super::charts::ChartSpace; -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{DRAWINGML_CHART_NS, REL_OFC_NS}; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::reader::xlsx::chart; use crate::structs::raw::RawRelationships; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct GraphicData { impl GraphicData { #[inline] + #[must_use] pub fn get_chart_space(&self) -> &ChartSpace { &self.chart_space } @@ -73,7 +74,7 @@ impl GraphicData { ); // c:chart - rel_list.push((String::from("CHART"), String::from(""))); + rel_list.push((String::from("CHART"), String::new())); write_start_tag( writer, "c:chart", diff --git a/src/structs/drawing/group_shape_locks.rs b/src/structs/drawing/group_shape_locks.rs index 3528b50e..f27e60bc 100644 --- a/src/structs/drawing/group_shape_locks.rs +++ b/src/structs/drawing/group_shape_locks.rs @@ -1,7 +1,7 @@ // a:grpSpLocks -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::BooleanValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -20,6 +20,7 @@ pub struct GroupShapeLocks { impl GroupShapeLocks { #[inline] + #[must_use] pub fn get_no_change_aspect(&self) -> bool { self.no_change_aspect.get_value() } diff --git a/src/structs/drawing/light_rig.rs b/src/structs/drawing/light_rig.rs index 6ae8d8ed..a3cd7bca 100644 --- a/src/structs/drawing/light_rig.rs +++ b/src/structs/drawing/light_rig.rs @@ -3,8 +3,8 @@ use super::super::EnumValue; use super::LightRigDirectionValues; use super::LightRigValues; use super::Rotation; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct LightRig { impl LightRig { #[inline] + #[must_use] pub fn get_rig(&self) -> &LightRigValues { self.rig.get_value() } @@ -30,6 +31,7 @@ impl LightRig { } #[inline] + #[must_use] pub fn get_definition(&self) -> &LightRigDirectionValues { self.definition.get_value() } @@ -41,6 +43,7 @@ impl LightRig { } #[inline] + #[must_use] pub fn get_rotation(&self) -> Option<&Rotation> { self.rotation.as_deref() } diff --git a/src/structs/drawing/line_spacing.rs b/src/structs/drawing/line_spacing.rs index 32eea214..3659fd63 100644 --- a/src/structs/drawing/line_spacing.rs +++ b/src/structs/drawing/line_spacing.rs @@ -1,7 +1,7 @@ // a:lnSpc use super::SpacingPercent; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct LineSpacing { impl LineSpacing { #[inline] + #[must_use] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } diff --git a/src/structs/drawing/line_style_list.rs b/src/structs/drawing/line_style_list.rs index 32678b53..814db86c 100644 --- a/src/structs/drawing/line_style_list.rs +++ b/src/structs/drawing/line_style_list.rs @@ -1,6 +1,6 @@ use super::Outline; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct LineStyleList { impl LineStyleList { #[inline] + #[must_use] pub fn get_outline_collection(&self) -> &[Outline] { &self.outline_collection } diff --git a/src/structs/drawing/linear_gradient_fill.rs b/src/structs/drawing/linear_gradient_fill.rs index 3e23c569..db71b919 100644 --- a/src/structs/drawing/linear_gradient_fill.rs +++ b/src/structs/drawing/linear_gradient_fill.rs @@ -1,8 +1,8 @@ // a:lin use super::super::super::BooleanValue; use super::super::super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct LinearGradientFill { impl LinearGradientFill { #[inline] + #[must_use] pub fn get_angle(&self) -> i32 { self.angle.get_value() } @@ -27,6 +28,7 @@ impl LinearGradientFill { } #[inline] + #[must_use] pub fn get_scaled(&self) -> bool { self.scaled.get_value() } diff --git a/src/structs/drawing/list_style.rs b/src/structs/drawing/list_style.rs index fe7d35bb..ed052786 100644 --- a/src/structs/drawing/list_style.rs +++ b/src/structs/drawing/list_style.rs @@ -1,8 +1,8 @@ // a:lstStyle use super::EffectList; use super::TextParagraphPropertiesType; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct ListStyle { impl ListStyle { #[inline] + #[must_use] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } diff --git a/src/structs/drawing/miter.rs b/src/structs/drawing/miter.rs index d367580d..25c7e08f 100644 --- a/src/structs/drawing/miter.rs +++ b/src/structs/drawing/miter.rs @@ -1,6 +1,6 @@ // a:miter -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use crate::Int32Value; use quick_xml::events::BytesStart; use quick_xml::Reader; @@ -14,6 +14,7 @@ pub struct Miter { impl Miter { #[inline] + #[must_use] pub fn get_limit(&self) -> i32 { self.limit.get_value() } diff --git a/src/structs/drawing/no_fill.rs b/src/structs/drawing/no_fill.rs index e8ec34cb..4a6cc78f 100644 --- a/src/structs/drawing/no_fill.rs +++ b/src/structs/drawing/no_fill.rs @@ -1,5 +1,5 @@ // a:noFill -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/offset.rs b/src/structs/drawing/offset.rs index 636bf1f3..02c87737 100644 --- a/src/structs/drawing/offset.rs +++ b/src/structs/drawing/offset.rs @@ -1,7 +1,7 @@ // a:off use super::super::super::Int64Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Offset { } impl Offset { #[inline] + #[must_use] pub fn get_x(&self) -> i64 { self.x.get_value() } @@ -24,6 +25,7 @@ impl Offset { } #[inline] + #[must_use] pub fn get_y(&self) -> i64 { self.y.get_value() } diff --git a/src/structs/drawing/outer_shadow.rs b/src/structs/drawing/outer_shadow.rs index f7501717..985ccbe9 100644 --- a/src/structs/drawing/outer_shadow.rs +++ b/src/structs/drawing/outer_shadow.rs @@ -2,8 +2,8 @@ use super::PresetColor; use super::RgbColorModelHex; use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -26,6 +26,7 @@ pub struct OuterShadow { impl OuterShadow { #[inline] + #[must_use] pub fn get_blur_radius(&self) -> Option<&str> { self.blur_radius.get_value() } @@ -37,6 +38,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_horizontal_ratio(&self) -> Option<&str> { self.horizontal_ratio.get_value() } @@ -48,6 +50,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_vertical_ratio(&self) -> Option<&str> { self.vertical_ratio.get_value() } @@ -59,6 +62,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_alignment(&self) -> Option<&str> { self.alignment.get_value() } @@ -70,6 +74,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_direction(&self) -> Option<&str> { self.direction.get_value() } @@ -81,6 +86,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_distance(&self) -> Option<&str> { self.distance.get_value() } @@ -91,6 +97,7 @@ impl OuterShadow { self } + #[must_use] pub fn get_rotate_with_shape(&self) -> Option<&str> { self.rotate_with_shape.get_value() } @@ -102,6 +109,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_preset_color(&self) -> Option<&PresetColor> { self.preset_color.as_deref() } @@ -118,6 +126,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } @@ -134,6 +143,7 @@ impl OuterShadow { } #[inline] + #[must_use] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } diff --git a/src/structs/drawing/outline.rs b/src/structs/drawing/outline.rs index 820edde2..723ef4a5 100644 --- a/src/structs/drawing/outline.rs +++ b/src/structs/drawing/outline.rs @@ -8,10 +8,10 @@ use super::PresetDash; use super::Round; use super::SolidFill; use super::TailEnd; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::EnumValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -36,6 +36,7 @@ pub struct Outline { impl Outline { #[inline] + #[must_use] pub fn get_width(&self) -> u32 { self.width.get_value() } @@ -47,6 +48,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_cap_type(&self) -> Option<&str> { self.cap_type.get_value() } @@ -58,6 +60,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_compound_line_type(&self) -> Option<&str> { self.compound_line_type.get_value() } @@ -69,6 +72,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } @@ -85,6 +89,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } @@ -101,6 +106,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_tail_end(&self) -> Option<&TailEnd> { self.tail_end.as_deref() } @@ -117,6 +123,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } @@ -133,6 +140,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_bevel(&self) -> Option<&Bevel> { self.bevel.as_deref() } @@ -149,6 +157,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_preset_dash(&self) -> Option<&PresetDash> { self.preset_dash.as_ref() } @@ -165,6 +174,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_miter(&self) -> Option<&Miter> { self.miter.as_ref() } @@ -181,6 +191,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_round(&self) -> Option<&Round> { self.round.as_ref() } @@ -197,6 +208,7 @@ impl Outline { } #[inline] + #[must_use] pub fn get_alignment(&self) -> &PenAlignmentValues { self.alignment.get_value() } diff --git a/src/structs/drawing/paragraph.rs b/src/structs/drawing/paragraph.rs index 56f372cc..b93dfb41 100644 --- a/src/structs/drawing/paragraph.rs +++ b/src/structs/drawing/paragraph.rs @@ -2,8 +2,8 @@ use super::ParagraphProperties; use super::Run; use super::RunProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct Paragraph { impl Paragraph { #[inline] + #[must_use] pub fn get_paragraph_properties(&self) -> &ParagraphProperties { &self.paragraph_properties } @@ -35,6 +36,7 @@ impl Paragraph { } #[inline] + #[must_use] pub fn get_run(&self) -> &[Run] { &self.run } @@ -45,6 +47,7 @@ impl Paragraph { } #[inline] + #[must_use] pub fn get_end_para_run_properties(&self) -> Option<&RunProperties> { self.end_para_run_properties.as_deref() } diff --git a/src/structs/drawing/paragraph_properties.rs b/src/structs/drawing/paragraph_properties.rs index 055f4d29..c198b0bf 100644 --- a/src/structs/drawing/paragraph_properties.rs +++ b/src/structs/drawing/paragraph_properties.rs @@ -3,8 +3,8 @@ use super::super::EnumValue; use super::LineSpacing; use super::RunProperties; use super::TextAlignmentTypeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -21,6 +21,7 @@ pub struct ParagraphProperties { impl ParagraphProperties { #[inline] + #[must_use] pub fn get_right_to_left(&self) -> Option<&str> { self.right_to_left.get_value() } @@ -32,6 +33,7 @@ impl ParagraphProperties { } #[inline] + #[must_use] pub fn get_alignment(&self) -> &TextAlignmentTypeValues { self.alignment.get_value() } @@ -43,6 +45,7 @@ impl ParagraphProperties { } #[inline] + #[must_use] pub fn get_default_run_properties(&self) -> Option<&RunProperties> { self.default_run_properties.as_deref() } @@ -59,6 +62,7 @@ impl ParagraphProperties { } #[inline] + #[must_use] pub fn get_line_spacing(&self) -> Option<&LineSpacing> { self.line_spacing.as_ref() } @@ -138,12 +142,12 @@ impl ParagraphProperties { if !empty_flag { // a:defRPr if let Some(v) = &self.default_run_properties { - v.write_to_def_rpr(writer) + v.write_to_def_rpr(writer); } // a:lnSpc if let Some(v) = &self.line_spacing { - v.write_to(writer) + v.write_to(writer); } write_end_tag(writer, "a:pPr"); diff --git a/src/structs/drawing/pattern_fill.rs b/src/structs/drawing/pattern_fill.rs index 8e7fdd46..8a1fea8b 100644 --- a/src/structs/drawing/pattern_fill.rs +++ b/src/structs/drawing/pattern_fill.rs @@ -1,8 +1,8 @@ // a:pattFill use super::BackgroundColor; use super::ForegroundColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -28,6 +28,7 @@ impl Default for PatternFill { impl PatternFill { #[inline] + #[must_use] pub fn get_preset(&self) -> &str { &self.preset } @@ -39,6 +40,7 @@ impl PatternFill { } #[inline] + #[must_use] pub fn get_foreground_color(&self) -> &ForegroundColor { &self.foreground_color } @@ -55,6 +57,7 @@ impl PatternFill { } #[inline] + #[must_use] pub fn get_background_color(&self) -> &BackgroundColor { &self.background_color } diff --git a/src/structs/drawing/percentage_type.rs b/src/structs/drawing/percentage_type.rs index d36038a9..a615aa5f 100644 --- a/src/structs/drawing/percentage_type.rs +++ b/src/structs/drawing/percentage_type.rs @@ -1,6 +1,6 @@ use super::super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct PercentageType { impl PercentageType { #[inline] + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } @@ -34,27 +35,27 @@ impl PercentageType { #[inline] pub(crate) fn write_to_lum(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lum") + self.write_to(writer, "a:lum"); } #[inline] pub(crate) fn write_to_lum_mod(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lumMod") + self.write_to(writer, "a:lumMod"); } #[inline] pub(crate) fn write_to_lum_off(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lumOff") + self.write_to(writer, "a:lumOff"); } #[inline] pub(crate) fn write_to_sat(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:sat") + self.write_to(writer, "a:sat"); } #[inline] pub(crate) fn write_to_sat_mod(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:satMod") + self.write_to(writer, "a:satMod"); } fn write_to(&self, writer: &mut Writer>>, tab_name: &str) { diff --git a/src/structs/drawing/picture_locks.rs b/src/structs/drawing/picture_locks.rs index 170ddbc1..52fc8b90 100644 --- a/src/structs/drawing/picture_locks.rs +++ b/src/structs/drawing/picture_locks.rs @@ -1,6 +1,6 @@ // a:picLocks -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct PictureLocks { impl PictureLocks { #[inline] + #[must_use] pub fn get_no_change_aspect(&self) -> bool { self.no_change_aspect } diff --git a/src/structs/drawing/point_2d_type.rs b/src/structs/drawing/point_2d_type.rs index f1eba176..47932363 100644 --- a/src/structs/drawing/point_2d_type.rs +++ b/src/structs/drawing/point_2d_type.rs @@ -1,8 +1,8 @@ // a:off // a:chOff -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::Int64Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Point2DType { impl Point2DType { #[inline] + #[must_use] pub fn get_x(&self) -> i64 { self.x.get_value() } @@ -26,6 +27,7 @@ impl Point2DType { } #[inline] + #[must_use] pub fn get_y(&self) -> i64 { self.y.get_value() } diff --git a/src/structs/drawing/positive_fixed_percentage_type.rs b/src/structs/drawing/positive_fixed_percentage_type.rs index 8d40fcd5..7acd30c5 100644 --- a/src/structs/drawing/positive_fixed_percentage_type.rs +++ b/src/structs/drawing/positive_fixed_percentage_type.rs @@ -1,6 +1,6 @@ use super::super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct PositiveFixedPercentageType { impl PositiveFixedPercentageType { #[inline] + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } @@ -34,17 +35,17 @@ impl PositiveFixedPercentageType { #[inline] pub(crate) fn write_to_shade(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:shade") + self.write_to(writer, "a:shade"); } #[inline] pub(crate) fn write_to_alpha(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:alpha") + self.write_to(writer, "a:alpha"); } #[inline] pub(crate) fn write_to_tint(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:tint") + self.write_to(writer, "a:tint"); } fn write_to(&self, writer: &mut Writer>>, tab_name: &str) { diff --git a/src/structs/drawing/positive_size_2d_type.rs b/src/structs/drawing/positive_size_2d_type.rs index a5b8824a..5f56a706 100644 --- a/src/structs/drawing/positive_size_2d_type.rs +++ b/src/structs/drawing/positive_size_2d_type.rs @@ -1,8 +1,8 @@ // a:ext // a:chExt -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::Int64Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct PositiveSize2DType { impl PositiveSize2DType { #[inline] + #[must_use] pub fn get_cx(&self) -> i64 { self.cx.get_value() } @@ -26,6 +27,7 @@ impl PositiveSize2DType { } #[inline] + #[must_use] pub fn get_cy(&self) -> i64 { self.cy.get_value() } diff --git a/src/structs/drawing/preset_color.rs b/src/structs/drawing/preset_color.rs index 27a69d76..ccaa5e75 100644 --- a/src/structs/drawing/preset_color.rs +++ b/src/structs/drawing/preset_color.rs @@ -1,7 +1,7 @@ // a:prstClr use super::alpha::Alpha; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct PresetColor { impl PresetColor { #[inline] + #[must_use] pub fn get_val(&self) -> &str { &self.val } @@ -25,6 +26,7 @@ impl PresetColor { } #[inline] + #[must_use] pub fn get_alpha(&self) -> Option<&Alpha> { self.alpha.as_ref() } @@ -70,7 +72,7 @@ impl PresetColor { // a:alpha if let Some(v) = &self.alpha { - v.write_to(writer) + v.write_to(writer); } write_end_tag(writer, "a:prstClr"); diff --git a/src/structs/drawing/preset_dash.rs b/src/structs/drawing/preset_dash.rs index c836d9b6..191049d3 100644 --- a/src/structs/drawing/preset_dash.rs +++ b/src/structs/drawing/preset_dash.rs @@ -1,8 +1,8 @@ // a:prstDash use super::super::EnumValue; use super::PresetLineDashValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct PresetDash { } impl PresetDash { #[inline] + #[must_use] pub fn get_val(&self) -> &PresetLineDashValues { self.val.get_value() } diff --git a/src/structs/drawing/preset_geometry.rs b/src/structs/drawing/preset_geometry.rs index 950c7e2f..6764f1bc 100644 --- a/src/structs/drawing/preset_geometry.rs +++ b/src/structs/drawing/preset_geometry.rs @@ -1,7 +1,7 @@ // a:prstGeom use super::adjust_value_list::AdjustValueList; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -204,6 +204,7 @@ impl PresetGeometry { pub const GEOMETRY_WEDGEROUNDRECTCALLOUT: &'static str = "wedgeRoundRectCallout"; #[inline] + #[must_use] pub fn get_geometry(&self) -> &str { &self.geometry } @@ -214,6 +215,7 @@ impl PresetGeometry { } #[inline] + #[must_use] pub fn get_adjust_value_list(&self) -> &AdjustValueList { &self.adjust_value_list } diff --git a/src/structs/drawing/rgb_color_model_hex.rs b/src/structs/drawing/rgb_color_model_hex.rs index b6917a03..d36993c6 100644 --- a/src/structs/drawing/rgb_color_model_hex.rs +++ b/src/structs/drawing/rgb_color_model_hex.rs @@ -3,8 +3,8 @@ use super::super::StringValue; use super::PercentageType; use super::PositiveFixedPercentageType; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -25,6 +25,7 @@ pub struct RgbColorModelHex { impl RgbColorModelHex { #[inline] + #[must_use] pub fn get_val(&self) -> &str { self.val.get_value_str() } @@ -36,6 +37,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_luminance(&self) -> Option<&PercentageType> { self.luminance.as_ref() } @@ -51,6 +53,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_luminance_modulation(&self) -> Option<&PercentageType> { self.luminance_modulation.as_ref() } @@ -66,6 +69,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_luminance_offset(&self) -> Option<&PercentageType> { self.luminance_offset.as_ref() } @@ -81,6 +85,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_saturation(&self) -> Option<&PercentageType> { self.saturation.as_ref() } @@ -96,6 +101,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_saturation_modulation(&self) -> Option<&PercentageType> { self.saturation_modulation.as_ref() } @@ -111,6 +117,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_shade(&self) -> Option<&PositiveFixedPercentageType> { self.shade.as_ref() } @@ -126,6 +133,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_alpha(&self) -> Option<&PositiveFixedPercentageType> { self.alpha.as_ref() } @@ -141,6 +149,7 @@ impl RgbColorModelHex { } #[inline] + #[must_use] pub fn get_tint(&self) -> Option<&PositiveFixedPercentageType> { self.tint.as_ref() } diff --git a/src/structs/drawing/rotation.rs b/src/structs/drawing/rotation.rs index 5fd87c9b..e9b88db4 100644 --- a/src/structs/drawing/rotation.rs +++ b/src/structs/drawing/rotation.rs @@ -1,7 +1,7 @@ // a:rot use super::super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Rotation { impl Rotation { #[inline] + #[must_use] pub fn get_latitude(&self) -> i32 { self.latitude.get_value() } @@ -27,6 +28,7 @@ impl Rotation { } #[inline] + #[must_use] pub fn get_longitude(&self) -> i32 { self.longitude.get_value() } @@ -38,6 +40,7 @@ impl Rotation { } #[inline] + #[must_use] pub fn get_revolution(&self) -> i32 { self.revolution.get_value() } diff --git a/src/structs/drawing/round.rs b/src/structs/drawing/round.rs index 8065f19d..84dfbe70 100644 --- a/src/structs/drawing/round.rs +++ b/src/structs/drawing/round.rs @@ -1,5 +1,5 @@ // a:round -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/run.rs b/src/structs/drawing/run.rs index f243c966..6538b34b 100644 --- a/src/structs/drawing/run.rs +++ b/src/structs/drawing/run.rs @@ -1,6 +1,6 @@ use super::run_properties::RunProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Run { impl Run { #[inline] + #[must_use] pub fn get_text(&self) -> &str { &self.text } @@ -24,6 +25,7 @@ impl Run { } #[inline] + #[must_use] pub fn get_run_properties(&self) -> &RunProperties { &self.run_properties } diff --git a/src/structs/drawing/run_properties.rs b/src/structs/drawing/run_properties.rs index 630ceb20..6119c1d7 100644 --- a/src/structs/drawing/run_properties.rs +++ b/src/structs/drawing/run_properties.rs @@ -7,9 +7,9 @@ use super::Outline; use super::SolidFill; use super::TextCapsValues; use super::TextFontType; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -38,6 +38,7 @@ pub struct RunProperties { impl RunProperties { #[inline] + #[must_use] pub fn get_text(&self) -> &str { &self.text } @@ -49,6 +50,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_kumimoji(&self) -> &str { self.kumimoji.get_value_str() } @@ -60,6 +62,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_language(&self) -> &str { self.language.get_value_str() } @@ -71,6 +74,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_alternative_language(&self) -> &str { self.alternative_language.get_value_str() } @@ -82,6 +86,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_bold(&self) -> &str { self.bold.get_value_str() } @@ -93,6 +98,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_sz(&self) -> &str { self.sz.get_value_str() } @@ -104,6 +110,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_italic(&self) -> &str { self.italic.get_value_str() } @@ -115,6 +122,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_capital(&self) -> &TextCapsValues { self.capital.get_value() } @@ -126,6 +134,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_spacing(&self) -> i32 { self.spacing.get_value() } @@ -137,6 +146,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_strike(&self) -> &str { self.strike.get_value_str() } @@ -148,6 +158,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } @@ -164,6 +175,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_outline(&self) -> Option<&Outline> { self.outline.as_deref() } @@ -180,6 +192,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_latin_font(&self) -> Option<&TextFontType> { self.latin_font.as_deref() } @@ -196,6 +209,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_east_asian_font(&self) -> Option<&TextFontType> { self.east_asian_font.as_deref() } @@ -212,6 +226,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } @@ -228,6 +243,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } @@ -244,6 +260,7 @@ impl RunProperties { } #[inline] + #[must_use] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } @@ -366,38 +383,38 @@ impl RunProperties { #[inline] pub(crate) fn write_to_rpr(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:rPr") + self.write_to(writer, "a:rPr"); } #[inline] pub(crate) fn write_to_end_para_rpr(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:endParaRPr") + self.write_to(writer, "a:endParaRPr"); } #[inline] pub(crate) fn write_to_def_rpr(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:defRPr") + self.write_to(writer, "a:defRPr"); } fn write_to(&self, writer: &mut Writer>>, tag_name: &str) { let mut attributes: Vec<(&str, &str)> = Vec::new(); if self.kumimoji.has_value() { - attributes.push(("kumimoji", self.kumimoji.get_value_str())) + attributes.push(("kumimoji", self.kumimoji.get_value_str())); } if self.language.has_value() { - attributes.push(("lang", self.language.get_value_str())) + attributes.push(("lang", self.language.get_value_str())); } if self.alternative_language.has_value() { - attributes.push(("altLang", self.alternative_language.get_value_str())) + attributes.push(("altLang", self.alternative_language.get_value_str())); } if self.sz.has_value() { - attributes.push(("sz", self.sz.get_value_str())) + attributes.push(("sz", self.sz.get_value_str())); } if self.bold.has_value() { - attributes.push(("b", self.bold.get_value_str())) + attributes.push(("b", self.bold.get_value_str())); } if self.italic.has_value() { - attributes.push(("i", self.italic.get_value_str())) + attributes.push(("i", self.italic.get_value_str())); } if self.capital.has_value() { attributes.push(("cap", self.capital.get_value_string())); diff --git a/src/structs/drawing/scene_3d_type.rs b/src/structs/drawing/scene_3d_type.rs index d460720f..4f8af1d0 100644 --- a/src/structs/drawing/scene_3d_type.rs +++ b/src/structs/drawing/scene_3d_type.rs @@ -1,8 +1,8 @@ // a:scene3d use super::Camera; use super::LightRig; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Scene3DType { impl Scene3DType { #[inline] + #[must_use] pub fn get_camera(&self) -> Option<&Camera> { self.camera.as_ref() } @@ -27,6 +28,7 @@ impl Scene3DType { } #[inline] + #[must_use] pub fn get_light_rig(&self) -> Option<&LightRig> { self.light_rig.as_ref() } diff --git a/src/structs/drawing/scheme_color.rs b/src/structs/drawing/scheme_color.rs index 7c08b750..20c642ed 100644 --- a/src/structs/drawing/scheme_color.rs +++ b/src/structs/drawing/scheme_color.rs @@ -3,8 +3,8 @@ use super::super::EnumValue; use super::PercentageType; use super::PositiveFixedPercentageType; use super::SchemeColorValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -25,6 +25,7 @@ pub struct SchemeColor { impl SchemeColor { #[inline] + #[must_use] pub fn get_val(&self) -> &SchemeColorValues { self.val.get_value() } @@ -36,6 +37,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_luminance(&self) -> Option<&PercentageType> { self.luminance.as_ref() } @@ -51,6 +53,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_luminance_modulation(&self) -> Option<&PercentageType> { self.luminance_modulation.as_ref() } @@ -66,6 +69,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_luminance_offset(&self) -> Option<&PercentageType> { self.luminance_offset.as_ref() } @@ -81,6 +85,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_saturation(&self) -> Option<&PercentageType> { self.saturation.as_ref() } @@ -96,6 +101,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_saturation_modulation(&self) -> Option<&PercentageType> { self.saturation_modulation.as_ref() } @@ -111,6 +117,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_shade(&self) -> Option<&PositiveFixedPercentageType> { self.shade.as_ref() } @@ -126,6 +133,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_alpha(&self) -> Option<&PositiveFixedPercentageType> { self.alpha.as_ref() } @@ -141,6 +149,7 @@ impl SchemeColor { } #[inline] + #[must_use] pub fn get_tint(&self) -> Option<&PositiveFixedPercentageType> { self.tint.as_ref() } diff --git a/src/structs/drawing/shape_3d_type.rs b/src/structs/drawing/shape_3d_type.rs index 257e759e..3c1bf336 100644 --- a/src/structs/drawing/shape_3d_type.rs +++ b/src/structs/drawing/shape_3d_type.rs @@ -3,8 +3,8 @@ use super::super::EnumValue; use super::BevelBottom; use super::BevelTop; use super::PresetMaterialTypeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct Shape3DType { impl Shape3DType { #[inline] + #[must_use] pub fn get_preset_material(&self) -> &PresetMaterialTypeValues { self.preset_material.get_value() } @@ -30,6 +31,7 @@ impl Shape3DType { } #[inline] + #[must_use] pub fn get_bevel_top(&self) -> Option<&BevelTop> { self.bevel_top.as_deref() } @@ -45,6 +47,7 @@ impl Shape3DType { } #[inline] + #[must_use] pub fn get_bevel_bottom(&self) -> Option<&BevelBottom> { self.bevel_bottom.as_deref() } @@ -103,12 +106,12 @@ impl Shape3DType { // a:bevelT if let Some(v) = &self.bevel_top { - v.write_to(writer) + v.write_to(writer); } // a:bevelB if let Some(v) = &self.bevel_bottom { - v.write_to(writer) + v.write_to(writer); } write_end_tag(writer, "a:sp3d"); diff --git a/src/structs/drawing/shape_auto_fit.rs b/src/structs/drawing/shape_auto_fit.rs index 79d812d9..cc9aaa8f 100644 --- a/src/structs/drawing/shape_auto_fit.rs +++ b/src/structs/drawing/shape_auto_fit.rs @@ -1,5 +1,5 @@ // a:spAutoFit -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/shape_guide.rs b/src/structs/drawing/shape_guide.rs index bb802a67..ba0fea92 100644 --- a/src/structs/drawing/shape_guide.rs +++ b/src/structs/drawing/shape_guide.rs @@ -1,5 +1,5 @@ // a:gd -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::Writer; use std::io::Cursor; @@ -10,6 +10,7 @@ pub struct ShapeGuide { } impl ShapeGuide { #[inline] + #[must_use] pub fn get_name(&self) -> &str { &self.name } @@ -20,6 +21,7 @@ impl ShapeGuide { } #[inline] + #[must_use] pub fn get_fmla(&self) -> &str { &self.fmla } diff --git a/src/structs/drawing/soft_edge.rs b/src/structs/drawing/soft_edge.rs index d15d20d6..9dda4deb 100644 --- a/src/structs/drawing/soft_edge.rs +++ b/src/structs/drawing/soft_edge.rs @@ -1,7 +1,7 @@ // a:softEdge use super::super::super::Int64Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct SoftEdge { } impl SoftEdge { #[inline] + #[must_use] pub fn get_radius(&self) -> i64 { self.radius.get_value() } diff --git a/src/structs/drawing/solid_fill.rs b/src/structs/drawing/solid_fill.rs index 822aa29a..eb7b6ce1 100644 --- a/src/structs/drawing/solid_fill.rs +++ b/src/structs/drawing/solid_fill.rs @@ -1,8 +1,8 @@ // a:solidFill use super::rgb_color_model_hex::RgbColorModelHex; use super::scheme_color::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct SolidFill { impl SolidFill { #[inline] + #[must_use] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } @@ -31,6 +32,7 @@ impl SolidFill { } #[inline] + #[must_use] pub fn get_rgb_color_model_hex(&self) -> Option<&RgbColorModelHex> { self.rgb_color_model_hex.as_deref() } diff --git a/src/structs/drawing/source_rectangle.rs b/src/structs/drawing/source_rectangle.rs index cb879573..9d405bc6 100644 --- a/src/structs/drawing/source_rectangle.rs +++ b/src/structs/drawing/source_rectangle.rs @@ -1,6 +1,6 @@ // a:srcRect -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute_value; +use crate::writer::driver::write_start_tag; use crate::StringValue; use quick_xml::events::BytesStart; use quick_xml::Reader; @@ -21,6 +21,7 @@ impl SourceRectangle { } #[inline] + #[must_use] pub fn get_t(&self) -> Option<&str> { self.t.get_value() } @@ -31,6 +32,7 @@ impl SourceRectangle { } #[inline] + #[must_use] pub fn get_l(&self) -> Option<&str> { self.l.get_value() } @@ -41,6 +43,7 @@ impl SourceRectangle { } #[inline] + #[must_use] pub fn get_r(&self) -> Option<&str> { self.r.get_value() } @@ -51,6 +54,7 @@ impl SourceRectangle { } #[inline] + #[must_use] pub fn get_b(&self) -> Option<&str> { self.b.get_value() } @@ -76,16 +80,16 @@ impl SourceRectangle { let mut attributes: Vec<(&str, &str)> = Vec::new(); if let Some(v) = self.t.get_value() { - attributes.push(("t", v)) + attributes.push(("t", v)); } if let Some(v) = self.l.get_value() { - attributes.push(("l", v)) + attributes.push(("l", v)); } if let Some(v) = self.r.get_value() { - attributes.push(("r", v)) + attributes.push(("r", v)); } if let Some(v) = self.b.get_value() { - attributes.push(("b", v)) + attributes.push(("b", v)); } write_start_tag(writer, "a:srcRect", attributes, true); } diff --git a/src/structs/drawing/space_after.rs b/src/structs/drawing/space_after.rs index 988ca028..2adac00a 100644 --- a/src/structs/drawing/space_after.rs +++ b/src/structs/drawing/space_after.rs @@ -1,7 +1,7 @@ // a:spcAft use super::SpacingPercent; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct SpaceAfter { impl SpaceAfter { #[inline] + #[must_use] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } diff --git a/src/structs/drawing/space_before.rs b/src/structs/drawing/space_before.rs index 449e616f..f943844b 100644 --- a/src/structs/drawing/space_before.rs +++ b/src/structs/drawing/space_before.rs @@ -1,7 +1,7 @@ // a:spcBef use super::SpacingPercent; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct SpaceBefore { impl SpaceBefore { #[inline] + #[must_use] pub fn get_spacing_percent(&self) -> Option<&SpacingPercent> { self.spacing_percent.as_ref() } diff --git a/src/structs/drawing/spacing_percent.rs b/src/structs/drawing/spacing_percent.rs index fc796ac6..b910ccec 100644 --- a/src/structs/drawing/spacing_percent.rs +++ b/src/structs/drawing/spacing_percent.rs @@ -1,7 +1,7 @@ // a:spcPct use super::super::super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct SpacingPercent { } impl SpacingPercent { #[inline] + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } diff --git a/src/structs/drawing/spreadsheet/blip_fill.rs b/src/structs/drawing/spreadsheet/blip_fill.rs index 56726e46..9bb4debc 100644 --- a/src/structs/drawing/spreadsheet/blip_fill.rs +++ b/src/structs/drawing/spreadsheet/blip_fill.rs @@ -3,9 +3,9 @@ use super::super::super::BooleanValue; use super::super::Blip; use super::super::SourceRectangle; use super::super::Stretch; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct BlipFill { impl BlipFill { #[inline] + #[must_use] pub fn get_rotate_with_shape(&self) -> bool { self.rotate_with_shape.get_value() } @@ -32,6 +33,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_source_rectangle(&self) -> Option<&SourceRectangle> { self.source_rectangle.as_deref() } @@ -48,6 +50,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_blip(&self) -> &Blip { &self.blip } @@ -64,6 +67,7 @@ impl BlipFill { } #[inline] + #[must_use] pub fn get_stretch(&self) -> &Stretch { &self.stretch } @@ -132,7 +136,7 @@ impl BlipFill { // xdr:blipFill let mut attributes: Vec<(&str, &str)> = Vec::new(); if self.rotate_with_shape.has_value() { - attributes.push(("rotWithShape", self.rotate_with_shape.get_value_string())) + attributes.push(("rotWithShape", self.rotate_with_shape.get_value_string())); } write_start_tag(writer, "xdr:blipFill", attributes, false); diff --git a/src/structs/drawing/spreadsheet/connection_shape.rs b/src/structs/drawing/spreadsheet/connection_shape.rs index b8e11ce4..cee4050d 100644 --- a/src/structs/drawing/spreadsheet/connection_shape.rs +++ b/src/structs/drawing/spreadsheet/connection_shape.rs @@ -3,9 +3,9 @@ use super::super::super::Anchor; use super::NonVisualConnectionShapeProperties; use super::ShapeProperties; use super::ShapeStyle; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct ConnectionShape { impl ConnectionShape { #[inline] + #[must_use] pub fn get_anchor(&self) -> &Anchor { &self.anchor } @@ -36,6 +37,7 @@ impl ConnectionShape { } #[inline] + #[must_use] pub fn get_non_visual_connection_shape_properties( &self, ) -> &NonVisualConnectionShapeProperties { @@ -58,6 +60,7 @@ impl ConnectionShape { } #[inline] + #[must_use] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } @@ -73,6 +76,7 @@ impl ConnectionShape { } #[inline] + #[must_use] pub fn get_shape_style(&self) -> &ShapeStyle { &self.shape_style } diff --git a/src/structs/drawing/spreadsheet/extent.rs b/src/structs/drawing/spreadsheet/extent.rs index 20f03f27..e3d00013 100644 --- a/src/structs/drawing/spreadsheet/extent.rs +++ b/src/structs/drawing/spreadsheet/extent.rs @@ -1,7 +1,7 @@ // xdr:ext use super::super::super::Int64Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct Extent { impl Extent { #[inline] + #[must_use] pub fn get_cx(&self) -> i64 { self.cx.get_value() } @@ -26,6 +27,7 @@ impl Extent { } #[inline] + #[must_use] pub fn get_cy(&self) -> i64 { self.cy.get_value() } diff --git a/src/structs/drawing/spreadsheet/graphic_frame.rs b/src/structs/drawing/spreadsheet/graphic_frame.rs index 319b2a8b..5ffa95f9 100644 --- a/src/structs/drawing/spreadsheet/graphic_frame.rs +++ b/src/structs/drawing/spreadsheet/graphic_frame.rs @@ -3,10 +3,10 @@ use super::super::super::StringValue; use super::super::Graphic; use super::NonVisualGraphicFrameProperties; use super::Transform; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -22,6 +22,7 @@ pub struct GraphicFrame { impl GraphicFrame { #[inline] + #[must_use] pub fn get_macro(&self) -> &str { self.r#macro.get_value_str() } @@ -33,6 +34,7 @@ impl GraphicFrame { } #[inline] + #[must_use] pub fn get_non_visual_graphic_frame_properties(&self) -> &NonVisualGraphicFrameProperties { &self.non_visual_graphic_frame_properties } @@ -54,6 +56,7 @@ impl GraphicFrame { } #[inline] + #[must_use] pub fn get_transform(&self) -> &Transform { &self.transform } @@ -70,6 +73,7 @@ impl GraphicFrame { } #[inline] + #[must_use] pub fn get_graphic(&self) -> &Graphic { &self.graphic } diff --git a/src/structs/drawing/spreadsheet/group_shape.rs b/src/structs/drawing/spreadsheet/group_shape.rs index d32b4f93..f76f2303 100644 --- a/src/structs/drawing/spreadsheet/group_shape.rs +++ b/src/structs/drawing/spreadsheet/group_shape.rs @@ -3,9 +3,9 @@ use super::GroupShapeProperties; use super::NonVisualGroupShapeProperties; use super::Picture; use super::Shape; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -22,6 +22,7 @@ pub struct GroupShape { impl GroupShape { #[inline] + #[must_use] pub fn get_non_visual_group_shape_properties(&self) -> &NonVisualGroupShapeProperties { &self.non_visual_group_shape_properties } @@ -39,6 +40,7 @@ impl GroupShape { } #[inline] + #[must_use] pub fn get_group_shape_properties(&self) -> &GroupShapeProperties { &self.group_shape_properties } @@ -54,6 +56,7 @@ impl GroupShape { } #[inline] + #[must_use] pub fn get_picture_collection(&self) -> &[Picture] { &self.picture_collection } @@ -69,6 +72,7 @@ impl GroupShape { } #[inline] + #[must_use] pub fn get_shape_collection(&self) -> &[Shape] { &self.shape_collection } diff --git a/src/structs/drawing/spreadsheet/group_shape_properties.rs b/src/structs/drawing/spreadsheet/group_shape_properties.rs index de0cc34b..6024935e 100644 --- a/src/structs/drawing/spreadsheet/group_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/group_shape_properties.rs @@ -1,7 +1,7 @@ // xdr:grpSpPr use super::super::Transform2D; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct GroupShapeProperties { impl GroupShapeProperties { #[inline] + #[must_use] pub fn get_transform2d(&self) -> Option<&Transform2D> { self.transform2d.as_ref() } diff --git a/src/structs/drawing/spreadsheet/marker_type.rs b/src/structs/drawing/spreadsheet/marker_type.rs index 02d4142c..c10c9651 100644 --- a/src/structs/drawing/spreadsheet/marker_type.rs +++ b/src/structs/drawing/spreadsheet/marker_type.rs @@ -1,7 +1,10 @@ // xdr:from,xdr:to -use crate::helper::coordinate::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, coordinate_from_index, + index_from_coordinate, is_remove_coordinate, +}; use crate::traits::AdjustmentCoordinate; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +19,7 @@ pub struct MarkerType { } impl MarkerType { #[inline] + #[must_use] pub fn get_col(&self) -> u32 { self.col } @@ -27,6 +31,7 @@ impl MarkerType { } #[inline] + #[must_use] pub fn get_col_off(&self) -> i32 { self.col_off } @@ -44,6 +49,7 @@ impl MarkerType { } #[inline] + #[must_use] pub fn get_row(&self) -> u32 { self.row } @@ -55,6 +61,7 @@ impl MarkerType { } #[inline] + #[must_use] pub fn get_row_off(&self) -> i32 { self.row_off } @@ -72,6 +79,7 @@ impl MarkerType { } #[inline] + #[must_use] pub fn get_coordinate(&self) -> String { coordinate_from_index(self.col + 1, self.row + 1) } @@ -88,7 +96,7 @@ impl MarkerType { reader: &mut Reader, _e: &BytesStart, ) { - let mut string_value: String = String::from(""); + let mut string_value: String = String::new(); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { diff --git a/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs index 6fdebac6..89391e13 100644 --- a/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_connection_shape_properties.rs @@ -1,8 +1,8 @@ // xdr:nvCxnSpPr use super::NonVisualConnectorShapeDrawingProperties; use super::NonVisualDrawingProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualConnectionShapeProperties { impl NonVisualConnectionShapeProperties { #[inline] + #[must_use] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } @@ -35,6 +36,7 @@ impl NonVisualConnectionShapeProperties { } #[inline] + #[must_use] pub fn get_non_visual_connector_shape_drawing_properties( &self, ) -> &NonVisualConnectorShapeDrawingProperties { diff --git a/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs index 43d317a4..9e795b6a 100644 --- a/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_connector_shape_drawing_properties.rs @@ -1,8 +1,8 @@ // xdr:cNvCxnSpPr use super::super::EndConnection; use super::super::StartConnection; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualConnectorShapeDrawingProperties { impl NonVisualConnectorShapeDrawingProperties { #[inline] + #[must_use] pub fn get_start_connection(&self) -> Option<&StartConnection> { self.start_connection.as_deref() } @@ -31,6 +32,7 @@ impl NonVisualConnectorShapeDrawingProperties { } #[inline] + #[must_use] pub fn get_end_connection(&self) -> Option<&EndConnection> { self.end_connection.as_deref() } diff --git a/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs index d6ac338a..ccfb033c 100644 --- a/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_drawing_properties.rs @@ -2,8 +2,8 @@ use super::super::super::BooleanValue; use super::super::super::StringValue; use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct NonVisualDrawingProperties { impl NonVisualDrawingProperties { #[inline] + #[must_use] pub fn get_id(&self) -> u32 { self.id.get_value() } @@ -29,6 +30,7 @@ impl NonVisualDrawingProperties { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -40,6 +42,7 @@ impl NonVisualDrawingProperties { } #[inline] + #[must_use] pub fn get_hidden(&self) -> bool { self.hidden.get_value() } @@ -89,7 +92,7 @@ impl NonVisualDrawingProperties { write_start_tag(writer, "xdr:cNvPr", attributes, !with_inner); if with_inner { - let spid = format!("_x0000_s{}", ole_id); + let spid = format!("_x0000_s{ole_id}"); write_start_tag(writer, "a:extLst", vec![], false); write_start_tag( writer, diff --git a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs index 53901e3e..62b84d46 100644 --- a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_drawing_properties.rs @@ -1,5 +1,5 @@ // xdr:cNvGraphicFramePr -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs index 5c231e6a..d9c875a1 100644 --- a/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_graphic_frame_properties.rs @@ -1,8 +1,8 @@ // xdr:nvGraphicFramePr use super::NonVisualDrawingProperties; use super::NonVisualGraphicFrameDrawingProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualGraphicFrameProperties { impl NonVisualGraphicFrameProperties { #[inline] + #[must_use] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } @@ -35,6 +36,7 @@ impl NonVisualGraphicFrameProperties { } #[inline] + #[must_use] pub fn get_non_visual_graphic_frame_drawing_properties( &self, ) -> &NonVisualGraphicFrameDrawingProperties { diff --git a/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs index 3de684c2..54f8ed24 100644 --- a/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_group_shape_drawing_properties.rs @@ -1,7 +1,7 @@ // xdr:cNvGrpSpPr use super::super::GroupShapeLocks; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct NonVisualGroupShapeDrawingProperties { impl NonVisualGroupShapeDrawingProperties { #[inline] + #[must_use] pub fn get_group_shape_locks(&self) -> Option<&GroupShapeLocks> { self.group_shape_locks.as_ref() } diff --git a/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs index 245a89b7..ac1c3086 100644 --- a/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_group_shape_properties.rs @@ -1,8 +1,8 @@ // xdr:nvGrpSpPr use super::NonVisualDrawingProperties; use super::NonVisualGroupShapeDrawingProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualGroupShapeProperties { impl NonVisualGroupShapeProperties { #[inline] + #[must_use] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } @@ -35,6 +36,7 @@ impl NonVisualGroupShapeProperties { } #[inline] + #[must_use] pub fn get_non_visual_group_shape_drawing_properties( &self, ) -> &NonVisualGroupShapeDrawingProperties { diff --git a/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs b/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs index 74ddad77..83ff4bcd 100644 --- a/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_picture_drawing_properties.rs @@ -1,8 +1,8 @@ //xdr:cNvPicPr use super::super::PictureLocks; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::BooleanValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualPictureDrawingProperties { impl NonVisualPictureDrawingProperties { #[inline] + #[must_use] pub fn get_prefer_relative_resize(&self) -> bool { self.prefer_relative_resize.get_value() } @@ -26,6 +27,7 @@ impl NonVisualPictureDrawingProperties { } #[inline] + #[must_use] pub fn get_picture_locks(&self) -> Option<&PictureLocks> { self.picture_locks.as_ref() } diff --git a/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs b/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs index 652e39fe..44d98492 100644 --- a/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_picture_properties.rs @@ -1,8 +1,8 @@ //xdr:nvPicPr use super::NonVisualDrawingProperties; use super::NonVisualPictureDrawingProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct NonVisualPictureProperties { impl NonVisualPictureProperties { #[inline] + #[must_use] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } @@ -31,6 +32,7 @@ impl NonVisualPictureProperties { } #[inline] + #[must_use] pub fn get_non_visual_picture_drawing_properties(&self) -> &NonVisualPictureDrawingProperties { &self.non_visual_picture_drawing_properties } diff --git a/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs b/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs index fc0e3e83..45803e53 100644 --- a/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs +++ b/src/structs/drawing/spreadsheet/non_visual_shape_properties.rs @@ -1,7 +1,7 @@ // xdr:nvSpPr use super::NonVisualDrawingProperties; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct NonVisualShapeProperties { impl NonVisualShapeProperties { #[inline] + #[must_use] pub fn get_non_visual_drawing_properties(&self) -> &NonVisualDrawingProperties { &self.non_visual_drawing_properties } diff --git a/src/structs/drawing/spreadsheet/one_cell_anchor.rs b/src/structs/drawing/spreadsheet/one_cell_anchor.rs index 98c66d4a..4d4fb38f 100644 --- a/src/structs/drawing/spreadsheet/one_cell_anchor.rs +++ b/src/structs/drawing/spreadsheet/one_cell_anchor.rs @@ -4,10 +4,10 @@ use super::GroupShape; use super::MarkerType; use super::Picture; use super::Shape; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; use crate::traits::AdjustmentCoordinate; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct OneCellAnchor { impl OneCellAnchor { #[inline] + #[must_use] pub fn get_from_marker(&self) -> &MarkerType { &self.from_marker } @@ -40,6 +41,7 @@ impl OneCellAnchor { } #[inline] + #[must_use] pub fn get_extent(&self) -> &Extent { &self.extent } @@ -56,6 +58,7 @@ impl OneCellAnchor { } #[inline] + #[must_use] pub fn get_group_shape(&self) -> Option<&GroupShape> { self.group_shape.as_deref() } @@ -72,6 +75,7 @@ impl OneCellAnchor { } #[inline] + #[must_use] pub fn get_shape(&self) -> Option<&Shape> { self.shape.as_deref() } @@ -88,6 +92,7 @@ impl OneCellAnchor { } #[inline] + #[must_use] pub fn get_picture(&self) -> Option<&Picture> { self.picture.as_deref() } diff --git a/src/structs/drawing/spreadsheet/picture.rs b/src/structs/drawing/spreadsheet/picture.rs index 1be14a15..b67c3a3f 100644 --- a/src/structs/drawing/spreadsheet/picture.rs +++ b/src/structs/drawing/spreadsheet/picture.rs @@ -2,9 +2,9 @@ use super::BlipFill; use super::NonVisualPictureProperties; use super::ShapeProperties; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct Picture { impl Picture { #[inline] + #[must_use] pub fn get_non_visual_picture_properties(&self) -> &NonVisualPictureProperties { &self.non_visual_picture_properties } @@ -34,6 +35,7 @@ impl Picture { } #[inline] + #[must_use] pub fn get_blip_fill(&self) -> &BlipFill { &self.blip_fill } @@ -49,6 +51,7 @@ impl Picture { } #[inline] + #[must_use] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } diff --git a/src/structs/drawing/spreadsheet/shape.rs b/src/structs/drawing/spreadsheet/shape.rs index 7470af76..68fb3e29 100644 --- a/src/structs/drawing/spreadsheet/shape.rs +++ b/src/structs/drawing/spreadsheet/shape.rs @@ -4,9 +4,9 @@ use super::NonVisualShapeProperties; use super::ShapeProperties; use super::ShapeStyle; use super::TextBody; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ pub struct Shape { impl Shape { #[inline] + #[must_use] pub fn get_anchor(&self) -> &Anchor { &self.anchor } @@ -38,6 +39,7 @@ impl Shape { } #[inline] + #[must_use] pub fn get_non_visual_shape_properties(&self) -> &NonVisualShapeProperties { &self.non_visual_shape_properties } @@ -52,6 +54,7 @@ impl Shape { } #[inline] + #[must_use] pub fn get_shape_properties(&self) -> &ShapeProperties { &self.shape_properties } @@ -66,6 +69,7 @@ impl Shape { self.shape_properties = value; } + #[must_use] pub fn get_shape_style(&self) -> Option<&ShapeStyle> { self.shape_style.as_deref() } @@ -81,6 +85,7 @@ impl Shape { } #[inline] + #[must_use] pub fn get_text_body(&self) -> Option<&TextBody> { self.text_body.as_deref() } diff --git a/src/structs/drawing/spreadsheet/shape_properties.rs b/src/structs/drawing/spreadsheet/shape_properties.rs index 7a380d7c..edbb8caa 100644 --- a/src/structs/drawing/spreadsheet/shape_properties.rs +++ b/src/structs/drawing/spreadsheet/shape_properties.rs @@ -7,9 +7,9 @@ use super::super::Outline; use super::super::PresetGeometry; use super::super::SolidFill; use super::super::Transform2D; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -28,6 +28,7 @@ pub struct ShapeProperties { } impl ShapeProperties { #[inline] + #[must_use] pub fn get_transform2d(&self) -> Option<&Transform2D> { self.transform2d.as_deref() } @@ -44,6 +45,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_geometry(&self) -> &PresetGeometry { &self.preset_geometry } @@ -60,6 +62,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_blip_fill(&self) -> Option<&BlipFill> { self.blip_fill.as_deref() } @@ -76,6 +79,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_solid_fill(&self) -> Option<&SolidFill> { self.solid_fill.as_deref() } @@ -92,6 +96,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_outline(&self) -> Option<&Outline> { self.outline.as_deref() } @@ -108,6 +113,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_effect_list(&self) -> Option<&EffectList> { self.effect_list.as_deref() } @@ -124,6 +130,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_no_fill(&self) -> Option<&NoFill> { self.no_fill.as_ref() } @@ -140,6 +147,7 @@ impl ShapeProperties { } #[inline] + #[must_use] pub fn get_extension_list(&self) -> Option<&ExtensionList> { self.extension_list.as_ref() } diff --git a/src/structs/drawing/spreadsheet/shape_style.rs b/src/structs/drawing/spreadsheet/shape_style.rs index 26aac113..ee979351 100644 --- a/src/structs/drawing/spreadsheet/shape_style.rs +++ b/src/structs/drawing/spreadsheet/shape_style.rs @@ -1,7 +1,7 @@ // xdr:style use super::super::StyleMatrixReferenceType; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct ShapeStyle { impl ShapeStyle { #[inline] + #[must_use] pub fn get_line_reference(&self) -> Option<&StyleMatrixReferenceType> { self.line_reference.as_deref() } @@ -27,6 +28,7 @@ impl ShapeStyle { } #[inline] + #[must_use] pub fn get_fill_reference(&self) -> Option<&StyleMatrixReferenceType> { self.fill_reference.as_deref() } @@ -37,6 +39,7 @@ impl ShapeStyle { } #[inline] + #[must_use] pub fn get_effect_reference(&self) -> Option<&StyleMatrixReferenceType> { self.effect_reference.as_deref() } @@ -47,6 +50,7 @@ impl ShapeStyle { } #[inline] + #[must_use] pub fn get_font_reference(&self) -> Option<&StyleMatrixReferenceType> { self.font_reference.as_deref() } diff --git a/src/structs/drawing/spreadsheet/text_body.rs b/src/structs/drawing/spreadsheet/text_body.rs index 869d7609..a23a1cdb 100644 --- a/src/structs/drawing/spreadsheet/text_body.rs +++ b/src/structs/drawing/spreadsheet/text_body.rs @@ -1,8 +1,8 @@ use super::super::BodyProperties; use super::super::ListStyle; use super::super::Paragraph; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct TextBody { impl TextBody { #[inline] + #[must_use] pub fn get_body_properties(&self) -> &BodyProperties { &self.body_properties } @@ -33,6 +34,7 @@ impl TextBody { } #[inline] + #[must_use] pub fn get_list_style(&self) -> &ListStyle { &self.list_style } @@ -48,6 +50,7 @@ impl TextBody { } #[inline] + #[must_use] pub fn get_paragraph(&self) -> &[Paragraph] { &self.paragraph } diff --git a/src/structs/drawing/spreadsheet/transform.rs b/src/structs/drawing/spreadsheet/transform.rs index 35f9368e..e0ca2822 100644 --- a/src/structs/drawing/spreadsheet/transform.rs +++ b/src/structs/drawing/spreadsheet/transform.rs @@ -1,7 +1,7 @@ // xdr:xfrm use super::super::{Extents, Offset}; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::{BooleanValue, Int32Value}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -19,6 +19,7 @@ pub struct Transform { impl Transform { #[inline] + #[must_use] pub fn get_offset(&self) -> &Offset { &self.offset } @@ -35,6 +36,7 @@ impl Transform { } #[inline] + #[must_use] pub fn get_extents(&self) -> &Extents { &self.extents } @@ -51,6 +53,7 @@ impl Transform { } #[inline] + #[must_use] pub fn get_rotation(&self) -> i32 { self.rotation.get_value() } @@ -61,6 +64,7 @@ impl Transform { } #[inline] + #[must_use] pub fn get_vertical_flip(&self) -> bool { self.vertical_flip.get_value() } @@ -71,6 +75,7 @@ impl Transform { } #[inline] + #[must_use] pub fn get_horizontal_flip(&self) -> bool { self.horizontal_flip.get_value() } diff --git a/src/structs/drawing/spreadsheet/two_cell_anchor.rs b/src/structs/drawing/spreadsheet/two_cell_anchor.rs index eedaaf21..c8c758c0 100644 --- a/src/structs/drawing/spreadsheet/two_cell_anchor.rs +++ b/src/structs/drawing/spreadsheet/two_cell_anchor.rs @@ -7,14 +7,14 @@ use super::GroupShape; use super::MarkerType; use super::Picture; use super::Shape; +use crate::helper::const_str::DRAWING_MAIN_NS; use crate::helper::const_str::MC_NS; -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; use crate::structs::BooleanValue; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -35,6 +35,7 @@ pub struct TwoCellAnchor { impl TwoCellAnchor { #[inline] + #[must_use] pub fn get_edit_as(&self) -> &EditAsValues { self.edit_as.get_value() } @@ -46,6 +47,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_from_marker(&self) -> &MarkerType { &self.from_marker } @@ -62,6 +64,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_to_marker(&self) -> &MarkerType { &self.to_marker } @@ -78,6 +81,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_group_shape(&self) -> Option<&GroupShape> { self.group_shape.as_deref() } @@ -94,6 +98,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_graphic_frame(&self) -> Option<&GraphicFrame> { self.graphic_frame.as_deref() } @@ -110,6 +115,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_shape(&self) -> Option<&Shape> { self.shape.as_deref() } @@ -126,6 +132,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_connection_shape(&self) -> Option<&ConnectionShape> { self.connection_shape.as_deref() } @@ -142,6 +149,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_picture(&self) -> Option<&Picture> { self.picture.as_deref() } @@ -158,6 +166,7 @@ impl TwoCellAnchor { } #[inline] + #[must_use] pub fn get_is_alternate_content(&self) -> bool { self.is_alternate_content.get_value() } @@ -170,7 +179,7 @@ impl TwoCellAnchor { #[inline] pub(crate) fn is_support(&self) -> bool { - self.graphic_frame.as_ref().map_or(true, |v| { + self.graphic_frame.as_ref().is_none_or(|v| { v.get_graphic() .get_graphic_data() .get_chart_space() @@ -299,7 +308,7 @@ impl TwoCellAnchor { // xdr:cxnSp if let Some(v) = &self.connection_shape { - v.write_to(writer, rel_list) + v.write_to(writer, rel_list); } // xdr:pic diff --git a/src/structs/drawing/spreadsheet/worksheet_drawing.rs b/src/structs/drawing/spreadsheet/worksheet_drawing.rs index 0d75e0d1..7d0ef6c3 100644 --- a/src/structs/drawing/spreadsheet/worksheet_drawing.rs +++ b/src/structs/drawing/spreadsheet/worksheet_drawing.rs @@ -5,15 +5,15 @@ use super::OneCellAnchor; use super::Picture; use super::Shape; use super::TwoCellAnchor; -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{DRAWINGML_MAIN_NS, SHEET_DRAWING_NS}; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; use crate::structs::Chart; use crate::structs::Image; use crate::structs::OleObjects; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentCoordinateWithSheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -30,6 +30,7 @@ pub struct WorksheetDrawing { impl WorksheetDrawing { #[inline] + #[must_use] pub fn get_image_collection(&self) -> &[Image] { &self.image_collection } @@ -46,6 +47,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn get_image(&self, col: u32, row: u32) -> Option<&Image> { self.image_collection .iter() @@ -59,6 +61,7 @@ impl WorksheetDrawing { .find(|image| image.get_col() == col - 1 && image.get_row() == row - 1) } + #[must_use] pub fn get_images(&self, col: u32, row: u32) -> Vec<&Image> { let mut result: Vec<&Image> = Vec::new(); for image in &self.image_collection { @@ -80,6 +83,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn get_chart_collection(&self) -> &[Chart] { &self.chart_collection } @@ -96,6 +100,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn get_chart(&self, col: u32, row: u32) -> Option<&Chart> { self.chart_collection .iter() @@ -109,6 +114,7 @@ impl WorksheetDrawing { .find(|chart| chart.get_col() == col - 1 && chart.get_row() == row - 1) } + #[must_use] pub fn get_charts(&self, col: u32, row: u32) -> Vec<&Chart> { let mut result: Vec<&Chart> = Vec::new(); for chart in &self.chart_collection { @@ -130,6 +136,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn get_one_cell_anchor_collection(&self) -> &[OneCellAnchor] { &self.one_cell_anchor_collection } @@ -146,6 +153,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn get_two_cell_anchor_collection(&self) -> &[TwoCellAnchor] { &self.two_cell_anchor_collection } @@ -162,6 +170,7 @@ impl WorksheetDrawing { } #[inline] + #[must_use] pub fn has_drawing_object(&self) -> bool { !self.chart_collection.is_empty() || !self.image_collection.is_empty() @@ -169,6 +178,7 @@ impl WorksheetDrawing { || !self.two_cell_anchor_collection.is_empty() } + #[must_use] pub fn get_graphic_frame_collection(&self) -> Vec<&GraphicFrame> { let mut result: Vec<&GraphicFrame> = Vec::new(); for two_cell_anchor in &self.two_cell_anchor_collection { @@ -189,6 +199,7 @@ impl WorksheetDrawing { result } + #[must_use] pub fn get_shape_collection(&self) -> Vec<&Shape> { let mut result: Vec<&Shape> = Vec::new(); for two_cell_anchor in &self.two_cell_anchor_collection { @@ -209,6 +220,7 @@ impl WorksheetDrawing { result } + #[must_use] pub fn get_connection_shape_collection(&self) -> Vec<&ConnectionShape> { let mut result: Vec<&ConnectionShape> = Vec::new(); for two_cell_anchor in &self.two_cell_anchor_collection { @@ -229,6 +241,7 @@ impl WorksheetDrawing { result } + #[must_use] pub fn get_picture_collection(&self) -> Vec<&Picture> { let mut result: Vec<&Picture> = Vec::new(); for two_cell_anchor in &self.two_cell_anchor_collection { diff --git a/src/structs/drawing/start_connection.rs b/src/structs/drawing/start_connection.rs index 6bcbc12b..295ab319 100644 --- a/src/structs/drawing/start_connection.rs +++ b/src/structs/drawing/start_connection.rs @@ -1,7 +1,7 @@ // a:stCxn use super::super::super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct StartConnection { } impl StartConnection { #[inline] + #[must_use] pub fn get_id(&self) -> u32 { self.id.get_value() } @@ -24,6 +25,7 @@ impl StartConnection { } #[inline] + #[must_use] pub fn get_index(&self) -> u32 { self.index.get_value() } diff --git a/src/structs/drawing/stretch.rs b/src/structs/drawing/stretch.rs index 7749f352..69380efb 100644 --- a/src/structs/drawing/stretch.rs +++ b/src/structs/drawing/stretch.rs @@ -1,7 +1,7 @@ // a:stretch use super::fill_rectangle::FillRectangle; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Stretch { impl Stretch { #[inline] + #[must_use] pub fn get_fill_rectangle(&self) -> Option<&FillRectangle> { self.fill_rectangle.as_deref() } diff --git a/src/structs/drawing/style_matrix_reference_type.rs b/src/structs/drawing/style_matrix_reference_type.rs index d5d6d708..22c596a1 100644 --- a/src/structs/drawing/style_matrix_reference_type.rs +++ b/src/structs/drawing/style_matrix_reference_type.rs @@ -1,7 +1,7 @@ // a:lnRef use super::SchemeColor; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct StyleMatrixReferenceType { impl StyleMatrixReferenceType { #[inline] + #[must_use] pub fn get_index(&self) -> &str { &self.index } @@ -25,6 +26,7 @@ impl StyleMatrixReferenceType { } #[inline] + #[must_use] pub fn get_scheme_color(&self) -> Option<&SchemeColor> { self.scheme_color.as_deref() } diff --git a/src/structs/drawing/supplemental_font.rs b/src/structs/drawing/supplemental_font.rs index 08540108..64e56f5d 100644 --- a/src/structs/drawing/supplemental_font.rs +++ b/src/structs/drawing/supplemental_font.rs @@ -1,7 +1,7 @@ // a:font -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct SupplementalFont { impl SupplementalFont { #[inline] + #[must_use] pub fn get_script(&self) -> &str { self.script.get_value_str() } @@ -26,6 +27,7 @@ impl SupplementalFont { } #[inline] + #[must_use] pub fn get_typeface(&self) -> &str { self.typeface.get_value_str() } diff --git a/src/structs/drawing/system_color.rs b/src/structs/drawing/system_color.rs index aee072f7..eeb69ddc 100644 --- a/src/structs/drawing/system_color.rs +++ b/src/structs/drawing/system_color.rs @@ -2,8 +2,8 @@ use super::super::super::EnumValue; use super::super::super::StringValue; use super::SystemColorValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct SystemColor { impl SystemColor { #[inline] + #[must_use] pub fn get_val(&self) -> &SystemColorValues { self.val.get_value() } @@ -28,6 +29,7 @@ impl SystemColor { } #[inline] + #[must_use] pub fn get_last_color(&self) -> &str { self.last_color.get_value_str() } diff --git a/src/structs/drawing/tail_end.rs b/src/structs/drawing/tail_end.rs index c2aae488..019e106f 100644 --- a/src/structs/drawing/tail_end.rs +++ b/src/structs/drawing/tail_end.rs @@ -1,7 +1,7 @@ // a:tailEnd -use crate::reader::driver::*; +use crate::reader::driver::get_attribute; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct TailEnd { impl TailEnd { #[inline] + #[must_use] pub fn get_type(&self) -> &str { self.t_type.get_value_str() } @@ -26,6 +27,7 @@ impl TailEnd { } #[inline] + #[must_use] pub fn get_width(&self) -> &str { self.width.get_value_str() } @@ -36,6 +38,7 @@ impl TailEnd { } #[inline] + #[must_use] pub fn get_length(&self) -> &str { self.length.get_value_str() } diff --git a/src/structs/drawing/text_font_type.rs b/src/structs/drawing/text_font_type.rs index 35f95086..1643ad67 100644 --- a/src/structs/drawing/text_font_type.rs +++ b/src/structs/drawing/text_font_type.rs @@ -1,6 +1,6 @@ use super::super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct TextFontType { impl TextFontType { #[inline] + #[must_use] pub fn get_typeface(&self) -> &str { self.typeface.get_value_str() } @@ -27,6 +28,7 @@ impl TextFontType { } #[inline] + #[must_use] pub fn get_pitch_family(&self) -> &str { self.pitch_family.get_value_str() } @@ -38,6 +40,7 @@ impl TextFontType { } #[inline] + #[must_use] pub fn get_charset(&self) -> &str { self.charset.get_value_str() } @@ -49,6 +52,7 @@ impl TextFontType { } #[inline] + #[must_use] pub fn get_panose(&self) -> &str { self.panose.get_value_str() } diff --git a/src/structs/drawing/text_paragraph_properties_type.rs b/src/structs/drawing/text_paragraph_properties_type.rs index b87a2789..33295b36 100644 --- a/src/structs/drawing/text_paragraph_properties_type.rs +++ b/src/structs/drawing/text_paragraph_properties_type.rs @@ -6,8 +6,8 @@ use super::SpaceAfter; use super::SpaceBefore; use super::TextAlignmentTypeValues; use super::TextFontAlignmentValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct TextParagraphPropertiesType { } impl TextParagraphPropertiesType { #[inline] + #[must_use] pub fn get_right_to_left(&self) -> bool { self.right_to_left.get_value() } @@ -35,6 +36,7 @@ impl TextParagraphPropertiesType { } #[inline] + #[must_use] pub fn get_alignment(&self) -> &TextAlignmentTypeValues { self.alignment.get_value() } @@ -46,6 +48,7 @@ impl TextParagraphPropertiesType { } #[inline] + #[must_use] pub fn get_font_alignment(&self) -> &TextFontAlignmentValues { self.font_alignment.get_value() } @@ -57,6 +60,7 @@ impl TextParagraphPropertiesType { } #[inline] + #[must_use] pub fn get_space_before(&self) -> Option<&SpaceBefore> { self.space_before.as_ref() } @@ -73,6 +77,7 @@ impl TextParagraphPropertiesType { } #[inline] + #[must_use] pub fn get_space_after(&self) -> Option<&SpaceAfter> { self.space_after.as_ref() } @@ -89,6 +94,7 @@ impl TextParagraphPropertiesType { } #[inline] + #[must_use] pub fn get_default_run_properties(&self) -> Option<&RunProperties> { self.default_run_properties.as_deref() } @@ -163,52 +169,52 @@ impl TextParagraphPropertiesType { #[inline] pub(crate) fn write_to_default(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:defPPr") + self.write_to(writer, "a:defPPr"); } #[inline] pub(crate) fn write_to_lvl1(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl1pPr") + self.write_to(writer, "a:lvl1pPr"); } #[inline] pub(crate) fn write_to_lvl2(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl2pPr") + self.write_to(writer, "a:lvl2pPr"); } #[inline] pub(crate) fn write_to_lvl3(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl3pPr") + self.write_to(writer, "a:lvl3pPr"); } #[inline] pub(crate) fn write_to_lvl4(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl4pPr") + self.write_to(writer, "a:lvl4pPr"); } #[inline] pub(crate) fn write_to_lvl5(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl5pPr") + self.write_to(writer, "a:lvl5pPr"); } #[inline] pub(crate) fn write_to_lvl6(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl6pPr") + self.write_to(writer, "a:lvl6pPr"); } #[inline] pub(crate) fn write_to_lvl7(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl7pPr") + self.write_to(writer, "a:lvl7pPr"); } #[inline] pub(crate) fn write_to_lvl8(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl8pPr") + self.write_to(writer, "a:lvl8pPr"); } #[inline] pub(crate) fn write_to_lvl9(&self, writer: &mut Writer>>) { - self.write_to(writer, "a:lvl9pPr") + self.write_to(writer, "a:lvl9pPr"); } fn write_to(&self, writer: &mut Writer>>, tag_name: &str) { diff --git a/src/structs/drawing/theme.rs b/src/structs/drawing/theme.rs index 22ec1613..8d924377 100644 --- a/src/structs/drawing/theme.rs +++ b/src/structs/drawing/theme.rs @@ -19,9 +19,9 @@ use super::SolidFill; use super::SystemColor; use super::SystemColorValues; use super::ThemeElements; -use crate::helper::const_str::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::const_str::DRAWINGML_MAIN_NS; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -35,6 +35,7 @@ pub struct Theme { impl Theme { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -46,6 +47,7 @@ impl Theme { } #[inline] + #[must_use] pub fn get_theme_elements(&self) -> &ThemeElements { &self.theme_elements } diff --git a/src/structs/drawing/theme_elements.rs b/src/structs/drawing/theme_elements.rs index 304c21d7..374cdd4b 100644 --- a/src/structs/drawing/theme_elements.rs +++ b/src/structs/drawing/theme_elements.rs @@ -2,8 +2,8 @@ use super::ColorScheme; use super::FontScheme; use super::FormatScheme; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ impl ThemeElements { } #[inline] + #[must_use] pub fn get_color_scheme(&self) -> &ColorScheme { &self.color_scheme } @@ -38,6 +39,7 @@ impl ThemeElements { } #[inline] + #[must_use] pub fn get_font_scheme(&self) -> &FontScheme { &self.font_scheme } @@ -53,6 +55,7 @@ impl ThemeElements { } #[inline] + #[must_use] pub fn get_format_scheme(&self) -> &FormatScheme { &self.format_scheme } diff --git a/src/structs/drawing/tile_rectangle.rs b/src/structs/drawing/tile_rectangle.rs index 53215b39..c9052f55 100644 --- a/src/structs/drawing/tile_rectangle.rs +++ b/src/structs/drawing/tile_rectangle.rs @@ -1,5 +1,5 @@ // a:tileRect -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/drawing/transform2d.rs b/src/structs/drawing/transform2d.rs index f331b5a8..6b344bff 100644 --- a/src/structs/drawing/transform2d.rs +++ b/src/structs/drawing/transform2d.rs @@ -1,8 +1,8 @@ // a:xfrm -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; use crate::structs::drawing::Point2DType; use crate::structs::drawing::PositiveSize2DType; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use crate::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -22,6 +22,7 @@ pub struct Transform2D { impl Transform2D { #[inline] + #[must_use] pub fn get_offset(&self) -> &Point2DType { &self.offset } @@ -37,6 +38,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_extents(&self) -> &PositiveSize2DType { &self.extents } @@ -52,6 +54,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_child_offset(&self) -> Option<&Point2DType> { self.child_offset.as_deref() } @@ -67,6 +70,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_child_extents(&self) -> Option<&PositiveSize2DType> { self.child_extents.as_deref() } @@ -82,6 +86,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_rot(&self) -> Option<&str> { self.rot.get_value() } @@ -92,6 +97,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_flip_v(&self) -> Option<&str> { self.flip_v.get_value() } @@ -102,6 +108,7 @@ impl Transform2D { } #[inline] + #[must_use] pub fn get_flip_h(&self) -> Option<&str> { self.flip_h.get_value() } @@ -164,13 +171,13 @@ impl Transform2D { // a:xfrm let mut attributes: Vec<(&str, &str)> = Vec::new(); if let Some(v) = self.rot.get_value() { - attributes.push(("rot", v)) + attributes.push(("rot", v)); } if let Some(v) = self.flip_h.get_value() { - attributes.push(("flipH", v)) + attributes.push(("flipH", v)); } if let Some(v) = self.flip_v.get_value() { - attributes.push(("flipV", v)) + attributes.push(("flipV", v)); } write_start_tag(writer, "a:xfrm", attributes, false); diff --git a/src/structs/embedded_object_properties.rs b/src/structs/embedded_object_properties.rs index 5545c8b5..cba3b951 100644 --- a/src/structs/embedded_object_properties.rs +++ b/src/structs/embedded_object_properties.rs @@ -2,10 +2,10 @@ use super::BooleanValue; use super::ObjectAnchor; use super::StringValue; use super::UInt32Value; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; use crate::structs::MediaObject; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ pub struct EmbeddedObjectProperties { impl EmbeddedObjectProperties { #[inline] + #[must_use] pub fn get_prog_id(&self) -> &str { self.prog_id.get_value_str() } @@ -34,6 +35,7 @@ impl EmbeddedObjectProperties { } #[inline] + #[must_use] pub fn get_shape_id(&self) -> u32 { self.shape_id.get_value() } @@ -45,6 +47,7 @@ impl EmbeddedObjectProperties { } #[inline] + #[must_use] pub fn get_image(&self) -> &MediaObject { &self.image } @@ -60,6 +63,7 @@ impl EmbeddedObjectProperties { } #[inline] + #[must_use] pub fn get_default_size(&self) -> bool { self.default_size.get_value() } @@ -71,6 +75,7 @@ impl EmbeddedObjectProperties { } #[inline] + #[must_use] pub fn get_auto_pict(&self) -> bool { self.auto_pict.get_value() } @@ -82,6 +87,7 @@ impl EmbeddedObjectProperties { } #[inline] + #[must_use] pub fn get_object_anchor(&self) -> &ObjectAnchor { &self.object_anchor } @@ -139,7 +145,7 @@ impl EmbeddedObjectProperties { if self.auto_pict.has_value() { attributes.push(("autoPict", self.auto_pict.get_value_string())); } - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); attributes.push(("r:id", r_id_str.as_str())); write_start_tag(writer, "objectPr", attributes, false); diff --git a/src/structs/error.rs b/src/structs/error.rs index dbf3c8af..24656754 100644 --- a/src/structs/error.rs +++ b/src/structs/error.rs @@ -80,12 +80,12 @@ from_err!(std::string::FromUtf8Error, XlsxError, Uft8); impl fmt::Display for XlsxError { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use self::XlsxError::*; + use self::XlsxError::{CellError, Io, Uft8, Xml, Zip}; match self { - Io(i) => write!(f, "IoError: {}", i), - Xml(s) => write!(f, "XmlError: {}", s), - Zip(s) => write!(f, "ZipError: {}", s), - Uft8(s) => write!(f, "Uft8Error: {}", s), + Io(i) => write!(f, "IoError: {i}"), + Xml(s) => write!(f, "XmlError: {s}"), + Zip(s) => write!(f, "ZipError: {s}"), + Uft8(s) => write!(f, "Uft8Error: {s}"), CellError(e) => write!(f, "Unsupported cell error value '{e}'"), } } diff --git a/src/structs/field.rs b/src/structs/field.rs index e489d5fa..422e4336 100644 --- a/src/structs/field.rs +++ b/src/structs/field.rs @@ -1,7 +1,7 @@ // field -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::Int32Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Field { x: Int32Value, } impl Field { + #[must_use] pub fn get_data_field(&self) -> i32 { self.x.get_value() } diff --git a/src/structs/fill.rs b/src/structs/fill.rs index 34207d59..200d4658 100644 --- a/src/structs/fill.rs +++ b/src/structs/fill.rs @@ -1,8 +1,8 @@ use super::GradientFill; use super::PatternFill; use super::PatternValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct Fill { impl Fill { #[inline] + #[must_use] pub fn get_pattern_fill(&self) -> Option<&PatternFill> { self.pattern_fill.as_deref() } @@ -38,6 +39,7 @@ impl Fill { } #[inline] + #[must_use] pub fn get_gradient_fill(&self) -> Option<&GradientFill> { self.gradient_fill.as_deref() } diff --git a/src/structs/fills.rs b/src/structs/fills.rs index e702c9e4..0cc29a0f 100644 --- a/src/structs/fills.rs +++ b/src/structs/fills.rs @@ -1,8 +1,8 @@ // fills use super::Fill; use super::Style; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/font.rs b/src/structs/font.rs index b3d22930..0725d9b2 100644 --- a/src/structs/font.rs +++ b/src/structs/font.rs @@ -12,7 +12,7 @@ use super::Strike; use super::Underline; use super::UnderlineValues; use super::VerticalTextAlignment; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -65,6 +65,7 @@ impl Font { pub const UNDERLINE_SINGLEACCOUNTING: &'static str = "singleAccounting"; #[inline] + #[must_use] pub fn get_font_name(&self) -> &FontName { &self.font_name } @@ -81,6 +82,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.font_name.get_val() } @@ -100,6 +102,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_size(&self) -> &FontSize { &self.font_size } @@ -116,6 +119,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_size(&self) -> f64 { self.font_size.get_val() } @@ -127,6 +131,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_family_numbering(&self) -> &FontFamilyNumbering { &self.font_family_numbering } @@ -143,6 +148,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_family(&self) -> i32 { self.font_family_numbering.get_val() } @@ -154,6 +160,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_bold(&self) -> &Bold { &self.font_bold } @@ -170,6 +177,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_bold(&self) -> bool { self.font_bold.get_val() } @@ -181,6 +189,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_italic(&self) -> &Italic { &self.font_italic } @@ -197,6 +206,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_italic(&self) -> bool { self.font_italic.get_val() } @@ -208,6 +218,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_underline(&self) -> &Underline { &self.font_underline } @@ -224,6 +235,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_underline(&self) -> &str { self.font_underline.val.get_value_string() } @@ -237,6 +249,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_strike(&self) -> &Strike { &self.font_strike } @@ -253,6 +266,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_strikethrough(&self) -> bool { self.font_strike.get_val() } @@ -264,6 +278,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_color(&self) -> &Color { &self.color } @@ -280,6 +295,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_char_set(&self) -> &FontCharSet { &self.font_char_set } @@ -296,6 +312,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_charset(&self) -> i32 { self.font_char_set.get_val() } @@ -307,6 +324,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_font_scheme(&self) -> &FontScheme { &self.font_scheme } @@ -323,6 +341,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_scheme(&self) -> &str { self.font_scheme.val.get_value_string() } @@ -336,6 +355,7 @@ impl Font { } #[inline] + #[must_use] pub fn get_vertical_text_alignment(&self) -> &VerticalTextAlignment { &self.vertical_text_alignment } diff --git a/src/structs/font_char_set.rs b/src/structs/font_char_set.rs index babab491..ff4ac9cd 100644 --- a/src/structs/font_char_set.rs +++ b/src/structs/font_char_set.rs @@ -1,7 +1,7 @@ // family use super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct FontCharSet { impl FontCharSet { #[inline] + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } diff --git a/src/structs/font_family_numbering.rs b/src/structs/font_family_numbering.rs index a62ec884..94ec5593 100644 --- a/src/structs/font_family_numbering.rs +++ b/src/structs/font_family_numbering.rs @@ -1,7 +1,7 @@ // family use super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct FontFamilyNumbering { impl FontFamilyNumbering { #[inline] + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } diff --git a/src/structs/font_name.rs b/src/structs/font_name.rs index 7e8e9ef0..b0e63474 100644 --- a/src/structs/font_name.rs +++ b/src/structs/font_name.rs @@ -1,7 +1,7 @@ // name use super::StringValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct FontName { impl FontName { #[inline] + #[must_use] pub fn get_val(&self) -> &str { self.val.get_value_str() } diff --git a/src/structs/font_scheme.rs b/src/structs/font_scheme.rs index 66449546..1ffcab66 100644 --- a/src/structs/font_scheme.rs +++ b/src/structs/font_scheme.rs @@ -1,8 +1,8 @@ // scheme use super::EnumValue; use super::FontSchemeValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct FontScheme { impl FontScheme { #[inline] + #[must_use] pub fn get_val(&self) -> &FontSchemeValues { self.val.get_value() } diff --git a/src/structs/font_size.rs b/src/structs/font_size.rs index 699ffec7..52638d83 100644 --- a/src/structs/font_size.rs +++ b/src/structs/font_size.rs @@ -1,7 +1,7 @@ // sz use super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct FontSize { impl FontSize { #[inline] + #[must_use] pub fn get_val(&self) -> f64 { self.val.get_value() } diff --git a/src/structs/fonts.rs b/src/structs/fonts.rs index 3d0f90b2..921462f5 100644 --- a/src/structs/fonts.rs +++ b/src/structs/fonts.rs @@ -1,8 +1,8 @@ // fronts -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Font; use crate::structs::Style; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/formula.rs b/src/structs/formula.rs index 1c81137d..222c5de2 100644 --- a/src/structs/formula.rs +++ b/src/structs/formula.rs @@ -1,9 +1,9 @@ // formula use super::Address; use super::StringValue; -use crate::helper::address::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::address::is_address; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct Formula { impl Formula { #[inline] + #[must_use] pub fn get_address(&self) -> &Address { &self.address } @@ -27,6 +28,7 @@ impl Formula { } #[inline] + #[must_use] pub fn get_address_str(&self) -> String { if self.string_value.has_value() { return self.string_value.get_value_str().to_string(); diff --git a/src/structs/from_marker.rs b/src/structs/from_marker.rs index 4323c042..cee1ed0b 100644 --- a/src/structs/from_marker.rs +++ b/src/structs/from_marker.rs @@ -1,6 +1,6 @@ // from -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct FromMarker { impl FromMarker { #[inline] + #[must_use] pub fn get_col(&self) -> usize { self.col } @@ -27,6 +28,7 @@ impl FromMarker { } #[inline] + #[must_use] pub fn get_col_off(&self) -> usize { self.col_off } @@ -38,6 +40,7 @@ impl FromMarker { } #[inline] + #[must_use] pub fn get_row(&self) -> usize { self.row } @@ -49,6 +52,7 @@ impl FromMarker { } #[inline] + #[must_use] pub fn get_row_off(&self) -> usize { self.row_off } @@ -92,7 +96,7 @@ impl FromMarker { reader: &mut Reader, _e: &BytesStart, ) { - let mut string_value: String = String::from(""); + let mut string_value: String = String::new(); xml_read_loop!( reader, Event::Text(e) => string_value = e.unescape().unwrap().to_string(), diff --git a/src/structs/gradient_fill.rs b/src/structs/gradient_fill.rs index 05199af0..0beabdf7 100644 --- a/src/structs/gradient_fill.rs +++ b/src/structs/gradient_fill.rs @@ -1,8 +1,8 @@ // gradientFill use super::DoubleValue; use super::GradientStop; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -19,6 +19,7 @@ pub struct GradientFill { impl GradientFill { #[inline] + #[must_use] pub fn get_degree(&self) -> f64 { self.degree.get_value() } @@ -30,6 +31,7 @@ impl GradientFill { } #[inline] + #[must_use] pub fn get_gradient_stop(&self) -> &[GradientStop] { &self.gradient_stop } @@ -46,7 +48,7 @@ impl GradientFill { } pub(crate) fn get_hash_code(&self) -> String { - let mut value = String::from(""); + let mut value = String::new(); for stop in &self.gradient_stop { write!(value, "{}", stop.get_hash_code().as_str()).unwrap(); } diff --git a/src/structs/gradient_stop.rs b/src/structs/gradient_stop.rs index 7be5e6fb..e844d769 100644 --- a/src/structs/gradient_stop.rs +++ b/src/structs/gradient_stop.rs @@ -1,8 +1,8 @@ // stop use super::Color; use super::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct GradientStop { impl GradientStop { #[inline] + #[must_use] pub fn get_position(&self) -> f64 { self.position.get_value() } @@ -28,6 +29,7 @@ impl GradientStop { } #[inline] + #[must_use] pub fn get_color(&self) -> &Color { &self.color } diff --git a/src/structs/header_footer.rs b/src/structs/header_footer.rs index f223091a..5e206c03 100644 --- a/src/structs/header_footer.rs +++ b/src/structs/header_footer.rs @@ -1,8 +1,8 @@ // headerFooter -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::OddFooter; use crate::structs::OddHeader; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct HeaderFooter { impl HeaderFooter { #[inline] + #[must_use] pub fn get_odd_header(&self) -> &OddHeader { &self.odd_header } @@ -32,6 +33,7 @@ impl HeaderFooter { } #[inline] + #[must_use] pub fn get_odd_footer(&self) -> &OddFooter { &self.odd_footer } diff --git a/src/structs/hyperlink.rs b/src/structs/hyperlink.rs index b82051d6..d347c546 100644 --- a/src/structs/hyperlink.rs +++ b/src/structs/hyperlink.rs @@ -6,6 +6,7 @@ pub struct Hyperlink { } impl Hyperlink { #[inline] + #[must_use] pub fn get_url(&self) -> &str { &self.url } @@ -17,6 +18,7 @@ impl Hyperlink { } #[inline] + #[must_use] pub fn get_tooltip(&self) -> &str { &self.tooltip } @@ -28,6 +30,7 @@ impl Hyperlink { } #[inline] + #[must_use] pub fn get_location(&self) -> bool { self.location } diff --git a/src/structs/icon_set.rs b/src/structs/icon_set.rs index a636943e..f9325c43 100644 --- a/src/structs/icon_set.rs +++ b/src/structs/icon_set.rs @@ -1,7 +1,7 @@ use super::Color; use super::ConditionalFormatValueObject; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct IconSet { impl IconSet { #[inline] + #[must_use] pub fn get_cfvo_collection(&self) -> &[ConditionalFormatValueObject] { &self.cfvo_collection } @@ -37,6 +38,7 @@ impl IconSet { } #[inline] + #[must_use] pub fn get_color_collection(&self) -> &[Color] { &self.color_collection } diff --git a/src/structs/image.rs b/src/structs/image.rs index 7e3bbc66..7128de9b 100644 --- a/src/structs/image.rs +++ b/src/structs/image.rs @@ -66,6 +66,7 @@ pub struct Image { /// ``` impl Image { #[inline] + #[must_use] pub fn get_two_cell_anchor(&self) -> Option<&TwoCellAnchor> { self.two_cell_anchor.as_deref() } @@ -88,6 +89,7 @@ impl Image { } #[inline] + #[must_use] pub fn get_one_cell_anchor(&self) -> Option<&OneCellAnchor> { self.one_cell_anchor.as_deref() } @@ -120,7 +122,7 @@ impl Image { let file = File::open(path).unwrap(); BufReader::new(file).read_to_end(&mut buf).unwrap(); - self.new_image_with_dimensions(height, width, image_name, buf, marker) + self.new_image_with_dimensions(height, width, image_name, buf, marker); } pub fn new_image_with_dimensions>>( @@ -169,8 +171,10 @@ impl Image { one_cell_anchor.set_from_marker(marker); one_cell_anchor .get_extent_mut() - .set_cy(height as i64 * 9525); - one_cell_anchor.get_extent_mut().set_cx(width as i64 * 9525); + .set_cy(i64::from(height) * 9525); + one_cell_anchor + .get_extent_mut() + .set_cx(i64::from(width) * 9525); one_cell_anchor.set_picture(picture); self.set_one_cell_anchor(one_cell_anchor); } @@ -190,11 +194,13 @@ impl Image { } #[inline] + #[must_use] pub fn has_image(&self) -> bool { !self.get_media_object().is_empty() } #[inline] + #[must_use] pub fn get_image_name(&self) -> &str { match self.get_media_object().first() { Some(v) => v.get_image_name(), @@ -203,6 +209,7 @@ impl Image { } #[inline] + #[must_use] pub fn get_image_data(&self) -> &[u8] { match self.get_media_object().first() { Some(v) => v.get_image_data(), @@ -211,26 +218,31 @@ impl Image { } #[inline] + #[must_use] pub fn get_image_data_base64(&self) -> String { STANDARD.encode(self.get_image_data()) } #[inline] + #[must_use] pub fn get_coordinate(&self) -> String { self.get_from_marker_type().get_coordinate() } #[inline] + #[must_use] pub fn get_col(&self) -> u32 { self.get_from_marker_type().get_col() } #[inline] + #[must_use] pub fn get_row(&self) -> u32 { self.get_from_marker_type().get_row() } #[inline] + #[must_use] pub fn get_from_marker_type(&self) -> &MarkerType { if let Some(anchor) = self.get_two_cell_anchor() { return anchor.get_from_marker(); @@ -242,6 +254,7 @@ impl Image { } #[inline] + #[must_use] pub fn get_to_marker_type(&self) -> Option<&MarkerType> { self.get_two_cell_anchor() .as_ref() diff --git a/src/structs/italic.rs b/src/structs/italic.rs index 19ae4a6d..6d6e0315 100644 --- a/src/structs/italic.rs +++ b/src/structs/italic.rs @@ -1,7 +1,7 @@ // i use super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Italic { impl Italic { #[inline] + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/location.rs b/src/structs/location.rs index 666c2c2c..0d478434 100644 --- a/src/structs/location.rs +++ b/src/structs/location.rs @@ -1,7 +1,7 @@ use super::StringValue; use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct Location { first_data_col: UInt32Value, } impl Location { + #[must_use] pub fn get_reference(&self) -> &str { self.reference.get_value_str() } @@ -24,6 +25,7 @@ impl Location { self } + #[must_use] pub fn get_first_header_row(&self) -> u32 { self.first_header_row.get_value() } @@ -33,6 +35,7 @@ impl Location { self } + #[must_use] pub fn get_first_data_row(&self) -> u32 { self.first_data_row.get_value() } @@ -42,6 +45,7 @@ impl Location { self } + #[must_use] pub fn get_first_data_col(&self) -> u32 { self.first_data_col.get_value() } diff --git a/src/structs/media_object.rs b/src/structs/media_object.rs index 9b06fb20..a048dc59 100644 --- a/src/structs/media_object.rs +++ b/src/structs/media_object.rs @@ -44,12 +44,11 @@ impl MediaObject { let find = rel_list .iter() .position(|(k, v)| k == "IMAGE" && v == &*self.image_name); - match find { - Some(v) => (v + 1) as i32, - None => { - rel_list.push((String::from("IMAGE"), self.image_name.to_string())); - rel_list.len() as i32 - } + if let Some(v) = find { + (v + 1) as i32 + } else { + rel_list.push((String::from("IMAGE"), self.image_name.to_string())); + rel_list.len() as i32 } } } diff --git a/src/structs/member_property_index.rs b/src/structs/member_property_index.rs index 2e10a692..af12bd86 100644 --- a/src/structs/member_property_index.rs +++ b/src/structs/member_property_index.rs @@ -1,7 +1,7 @@ // x use super::Int32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct MemberPropertyIndex { } impl MemberPropertyIndex { + #[must_use] pub fn get_val(&self) -> i32 { self.val.get_value() } diff --git a/src/structs/merge_cells.rs b/src/structs/merge_cells.rs index dc273528..a2821844 100644 --- a/src/structs/merge_cells.rs +++ b/src/structs/merge_cells.rs @@ -1,8 +1,8 @@ // mergeCell use super::Range; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -37,10 +37,10 @@ impl MergeCells { self.get_range_collection().iter().any(|range| { let start_num = range .get_coordinate_start_row() - .map_or(true, |v| v.get_num() <= row_num); + .is_none_or(|v| v.get_num() <= row_num); let end_num = range .get_coordinate_end_row() - .map_or(true, |v| v.get_num() >= row_num); + .is_none_or(|v| v.get_num() >= row_num); start_num && end_num && start_num != end_num }) } @@ -49,10 +49,10 @@ impl MergeCells { self.get_range_collection().iter().any(|range| { let start_num = range .get_coordinate_start_col() - .map_or(true, |v| v.get_num() <= col_num); + .is_none_or(|v| v.get_num() <= col_num); let end_num = range .get_coordinate_end_col() - .map_or(true, |v| v.get_num() >= col_num); + .is_none_or(|v| v.get_num() >= col_num); start_num && end_num && start_num != end_num }) } diff --git a/src/structs/mru_colors.rs b/src/structs/mru_colors.rs index cde74c5c..a297e7ce 100644 --- a/src/structs/mru_colors.rs +++ b/src/structs/mru_colors.rs @@ -1,7 +1,7 @@ // mruColors use super::Color; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/numbering_format.rs b/src/structs/numbering_format.rs index 6b1c276a..22dab0f5 100644 --- a/src/structs/numbering_format.rs +++ b/src/structs/numbering_format.rs @@ -1,5 +1,5 @@ -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use md5::Digest; use quick_xml::escape; use quick_xml::events::BytesStart; @@ -64,7 +64,7 @@ impl NumberingFormat { pub const FORMAT_DATE_YYYYMMDDSLASH: &'static str = "yyyy/mm/dd;@"; pub const FORMAT_CURRENCY_USD_SIMPLE: &'static str = r##""$"#,##0.00_-"##; - pub const FORMAT_CURRENCY_USD: &'static str = r###"$#,##0_-"###; + pub const FORMAT_CURRENCY_USD: &'static str = r"$#,##0_-"; pub const FORMAT_CURRENCY_EUR_SIMPLE: &'static str = r#"#,##0.00_-"€""#; pub const FORMAT_CURRENCY_EUR: &'static str = r#"#,##0_-"€""#; pub const FORMAT_ACCOUNTING_USD: &'static str = @@ -73,6 +73,7 @@ impl NumberingFormat { r#"_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)"#; #[inline] + #[must_use] pub fn get_number_format_id(&self) -> u32 { self.number_format_id } @@ -102,12 +103,12 @@ impl NumberingFormat { /// Set the format code. /// # Arguments - /// * `value` - format code. (umya_spreadsheet::NumberingFormat) + /// * `value` - format code. (`umya_spreadsheet::NumberingFormat`) /// # Examples /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let mut worksheet = book.get_sheet_mut(0).unwrap(); - /// let _ = worksheet.get_style_mut("C30") + /// let _unused = worksheet.get_style_mut("C30") /// .get_number_format_mut() /// .set_format_code(umya_spreadsheet::NumberingFormat::FORMAT_DATE_XLSX17); /// ``` @@ -132,6 +133,7 @@ impl NumberingFormat { } #[inline] + #[must_use] pub fn get_format_code(&self) -> &str { &self.format_code } diff --git a/src/structs/numbering_formats.rs b/src/structs/numbering_formats.rs index 2ad99648..26f9f662 100644 --- a/src/structs/numbering_formats.rs +++ b/src/structs/numbering_formats.rs @@ -1,8 +1,8 @@ // numFmts use super::NumberingFormat; use super::Style; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -112,11 +112,9 @@ impl NumberingFormats { let cnt_str = cnt.to_string(); write_start_tag(writer, "numFmts", vec![("count", &cnt_str)], false); - formats_to_write - .into_iter() - .for_each(|(index, numbering_format)| { - numbering_format.write_to(writer, *index); - }); + for (index, numbering_format) in formats_to_write { + numbering_format.write_to(writer, *index); + } write_end_tag(writer, "numFmts"); } diff --git a/src/structs/object_anchor.rs b/src/structs/object_anchor.rs index 6b890cb9..5b482492 100644 --- a/src/structs/object_anchor.rs +++ b/src/structs/object_anchor.rs @@ -1,8 +1,8 @@ use super::BooleanValue; use super::FromMarker; use super::ToMarker; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -17,6 +17,7 @@ pub struct ObjectAnchor { impl ObjectAnchor { #[inline] + #[must_use] pub fn get_move_with_cells(&self) -> bool { self.move_with_cells.get_value() } @@ -28,6 +29,7 @@ impl ObjectAnchor { } #[inline] + #[must_use] pub fn get_from_marker(&self) -> &FromMarker { &self.from_marker } @@ -44,6 +46,7 @@ impl ObjectAnchor { } #[inline] + #[must_use] pub fn get_to_marker(&self) -> &ToMarker { &self.to_marker } diff --git a/src/structs/odd_footer.rs b/src/structs/odd_footer.rs index cf403e73..a91224bf 100644 --- a/src/structs/odd_footer.rs +++ b/src/structs/odd_footer.rs @@ -1,7 +1,7 @@ // oddFooter -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -15,6 +15,7 @@ pub struct OddFooter { impl OddFooter { #[inline] + #[must_use] pub fn get_value(&self) -> &str { self.value.get_value_str() } diff --git a/src/structs/odd_header.rs b/src/structs/odd_header.rs index acc455c3..2c0d632d 100644 --- a/src/structs/odd_header.rs +++ b/src/structs/odd_header.rs @@ -1,7 +1,7 @@ // oddHeader -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -15,6 +15,7 @@ pub struct OddHeader { impl OddHeader { #[inline] + #[must_use] pub fn get_value(&self) -> &str { self.value.get_value_str() } diff --git a/src/structs/office/excel/formula.rs b/src/structs/office/excel/formula.rs index 5659ac96..38c569bb 100644 --- a/src/structs/office/excel/formula.rs +++ b/src/structs/office/excel/formula.rs @@ -1,6 +1,6 @@ // xm:f use crate::structs::Address; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Formula { } impl Formula { #[inline] + #[must_use] pub fn get_value(&self) -> &Address { &self.value } @@ -33,7 +34,7 @@ impl Formula { reader: &mut Reader, _e: &BytesStart, ) { - let mut value: String = String::from(""); + let mut value: String = String::new(); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { diff --git a/src/structs/office/excel/reference_sequence.rs b/src/structs/office/excel/reference_sequence.rs index 8e92e0e0..887b9c1c 100644 --- a/src/structs/office/excel/reference_sequence.rs +++ b/src/structs/office/excel/reference_sequence.rs @@ -1,6 +1,6 @@ // xm:sqref use crate::structs::Range; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ReferenceSequence { } impl ReferenceSequence { #[inline] + #[must_use] pub fn get_value(&self) -> &[Range] { &self.value } @@ -51,10 +52,11 @@ impl ReferenceSequence { } #[inline] + #[must_use] pub fn get_sqref(&self) -> String { self.value .iter() - .map(|range| range.get_range()) + .map(Range::get_range) .collect::>() .join(" ") } @@ -64,7 +66,7 @@ impl ReferenceSequence { reader: &mut Reader, _e: &BytesStart, ) { - let mut value: String = String::from(""); + let mut value: String = String::new(); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { diff --git a/src/structs/office2010/drawing/charts/style.rs b/src/structs/office2010/drawing/charts/style.rs index 40b643ac..ea328870 100644 --- a/src/structs/office2010/drawing/charts/style.rs +++ b/src/structs/office2010/drawing/charts/style.rs @@ -1,7 +1,7 @@ // c14:style -use crate::helper::const_str::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::const_str::{DRAWING_CHART_NS, MC_NS}; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/office2010/excel/data_validation.rs b/src/structs/office2010/excel/data_validation.rs index e525bb29..c4ede1bf 100644 --- a/src/structs/office2010/excel/data_validation.rs +++ b/src/structs/office2010/excel/data_validation.rs @@ -1,5 +1,5 @@ // x14:dataValidation -use crate::reader::driver::*; +use crate::reader::driver::get_attribute; use crate::structs::office::excel::ReferenceSequence; use crate::structs::office2010::excel::DataValidationForumla1; use crate::structs::office2010::excel::DataValidationForumla2; @@ -8,7 +8,7 @@ use crate::structs::DataValidationOperatorValues; use crate::structs::DataValidationValues; use crate::structs::EnumValue; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -29,6 +29,7 @@ pub struct DataValidation { } impl DataValidation { #[inline] + #[must_use] pub fn get_type(&self) -> &DataValidationValues { self.r#type.get_value() } @@ -40,6 +41,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_operator(&self) -> &DataValidationOperatorValues { self.operator.get_value() } @@ -51,6 +53,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_allow_blank(&self) -> bool { self.allow_blank.get_value() } @@ -62,6 +65,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_show_input_message(&self) -> bool { self.show_input_message.get_value() } @@ -73,6 +77,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_show_error_message(&self) -> bool { self.show_error_message.get_value() } @@ -84,6 +89,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_prompt_title(&self) -> &str { self.prompt_title.get_value_str() } @@ -95,6 +101,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_prompt(&self) -> &str { self.prompt.get_value_str() } @@ -106,6 +113,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_reference_sequence(&self) -> &ReferenceSequence { &self.reference_sequence } @@ -122,6 +130,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_formula1(&self) -> Option<&DataValidationForumla1> { self.formula1.as_deref() } @@ -144,6 +153,7 @@ impl DataValidation { } #[inline] + #[must_use] pub fn get_formula2(&self) -> Option<&DataValidationForumla2> { self.formula2.as_deref() } @@ -279,10 +289,10 @@ impl DataValidation { write_start_tag(writer, "x14:dataValidation", attributes, false); if let Some(v) = &self.formula1 { - v.write_to(writer) + v.write_to(writer); } if let Some(v) = &self.formula2 { - v.write_to(writer) + v.write_to(writer); } self.reference_sequence.write_to(writer); write_end_tag(writer, "x14:dataValidation"); diff --git a/src/structs/office2010/excel/data_validation_forumla1.rs b/src/structs/office2010/excel/data_validation_forumla1.rs index d469f291..780fba61 100644 --- a/src/structs/office2010/excel/data_validation_forumla1.rs +++ b/src/structs/office2010/excel/data_validation_forumla1.rs @@ -1,6 +1,6 @@ // x14:formula1 use crate::structs::office::excel::Formula; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct DataValidationForumla1 { } impl DataValidationForumla1 { #[inline] + #[must_use] pub fn get_value(&self) -> &Formula { &self.value } diff --git a/src/structs/office2010/excel/data_validation_forumla2.rs b/src/structs/office2010/excel/data_validation_forumla2.rs index 42a6b629..f8bfdee4 100644 --- a/src/structs/office2010/excel/data_validation_forumla2.rs +++ b/src/structs/office2010/excel/data_validation_forumla2.rs @@ -1,6 +1,6 @@ // x14:formula2 use crate::structs::office::excel::Formula; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct DataValidationForumla2 { } impl DataValidationForumla2 { #[inline] + #[must_use] pub fn get_value(&self) -> &Formula { &self.value } diff --git a/src/structs/office2010/excel/data_validations.rs b/src/structs/office2010/excel/data_validations.rs index a81370ab..097c2cb1 100644 --- a/src/structs/office2010/excel/data_validations.rs +++ b/src/structs/office2010/excel/data_validations.rs @@ -1,8 +1,8 @@ // x14:dataValidations -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{EXCEL_MAIN_NS, SHEET_MS_MAIN_NS}; +use crate::reader::driver::xml_read_loop; use crate::structs::office2010::excel::DataValidation; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct DataValidations { impl DataValidations { #[inline] + #[must_use] pub fn get_data_validation_list(&self) -> &[DataValidation] { &self.data_validation_list } diff --git a/src/structs/ole_object.rs b/src/structs/ole_object.rs index 11c24dff..bd3fe873 100644 --- a/src/structs/ole_object.rs +++ b/src/structs/ole_object.rs @@ -1,11 +1,11 @@ use super::EmbeddedObjectProperties; use super::StringValue; use crate::helper::const_str::MC_NS; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::drawing::spreadsheet::TwoCellAnchor; use crate::structs::raw::RawRelationships; use crate::structs::vml::Shape; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -25,6 +25,7 @@ pub struct OleObject { impl OleObject { #[inline] + #[must_use] pub fn get_requires(&self) -> &str { self.requires.get_value_str() } @@ -36,6 +37,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_prog_id(&self) -> &str { self.prog_id.get_value_str() } @@ -47,6 +49,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_object_extension(&self) -> &str { &self.object_extension } @@ -57,6 +60,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_object_data(&self) -> Option<&[u8]> { self.object_data.as_deref() } @@ -73,6 +77,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_embedded_object_properties(&self) -> &EmbeddedObjectProperties { &self.embedded_object_properties } @@ -89,6 +94,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_two_cell_anchor(&self) -> &TwoCellAnchor { &self.two_cell_anchor } @@ -105,6 +111,7 @@ impl OleObject { } #[inline] + #[must_use] pub fn get_shape(&self) -> &Shape { &self.shape } @@ -201,8 +208,8 @@ impl OleObject { ); // oleObject - let r_id_str = format!("rId{}", r_id); - let shape_id_str = format!("{}", ole_id); + let r_id_str = format!("rId{r_id}"); + let shape_id_str = format!("{ole_id}"); let attributes = vec![ ("progId", self.prog_id.get_value_str()), ("shapeId", shape_id_str.as_str()), @@ -221,7 +228,7 @@ impl OleObject { write_start_tag(writer, "mc:Fallback", vec![], false); // oleObject - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); let attributes = vec![ ("progId", self.prog_id.get_value_str()), ("shapeId", shape_id_str.as_str()), diff --git a/src/structs/ole_objects.rs b/src/structs/ole_objects.rs index c8cc3d7c..71e0dab6 100644 --- a/src/structs/ole_objects.rs +++ b/src/structs/ole_objects.rs @@ -1,8 +1,8 @@ // oleObjects use super::OleObject; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::raw::RawRelationships; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct OleObjects { impl OleObjects { #[inline] + #[must_use] pub fn get_ole_object(&self) -> &[OleObject] { &self.ole_object } diff --git a/src/structs/page_margins.rs b/src/structs/page_margins.rs index 34a9c446..a56ca449 100644 --- a/src/structs/page_margins.rs +++ b/src/structs/page_margins.rs @@ -1,7 +1,7 @@ use crate::structs::DoubleValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::get_attribute; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct PageMargins { } impl PageMargins { #[inline] + #[must_use] pub fn get_left(&self) -> f64 { self.left.get_value() } @@ -29,6 +30,7 @@ impl PageMargins { } #[inline] + #[must_use] pub fn get_right(&self) -> f64 { self.right.get_value() } @@ -40,6 +42,7 @@ impl PageMargins { } #[inline] + #[must_use] pub fn get_top(&self) -> f64 { self.top.get_value() } @@ -51,6 +54,7 @@ impl PageMargins { } #[inline] + #[must_use] pub fn get_bottom(&self) -> f64 { self.bottom.get_value() } @@ -62,6 +66,7 @@ impl PageMargins { } #[inline] + #[must_use] pub fn get_header(&self) -> f64 { self.header.get_value() } @@ -73,6 +78,7 @@ impl PageMargins { } #[inline] + #[must_use] pub fn get_footer(&self) -> f64 { self.footer.get_value() } diff --git a/src/structs/page_setup.rs b/src/structs/page_setup.rs index 53fc3cbf..260458bb 100644 --- a/src/structs/page_setup.rs +++ b/src/structs/page_setup.rs @@ -1,9 +1,9 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::raw::RawRelationships; use crate::structs::EnumValue; use crate::structs::OrientationValues; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -24,6 +24,7 @@ pub struct PageSetup { impl PageSetup { #[inline] + #[must_use] pub fn get_paper_size(&self) -> u32 { self.paper_size.get_value() } @@ -35,6 +36,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_orientation(&self) -> &OrientationValues { self.orientation.get_value() } @@ -46,6 +48,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_scale(&self) -> u32 { self.scale.get_value() } @@ -57,6 +60,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_fit_to_height(&self) -> u32 { self.fit_to_height.get_value() } @@ -68,6 +72,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_fit_to_width(&self) -> u32 { self.fit_to_width.get_value() } @@ -79,6 +84,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_horizontal_dpi(&self) -> u32 { self.horizontal_dpi.get_value() } @@ -90,6 +96,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_vertical_dpi(&self) -> u32 { self.vertical_dpi.get_value() } @@ -101,6 +108,7 @@ impl PageSetup { } #[inline] + #[must_use] pub fn get_object_data(&self) -> Option<&[u8]> { self.object_data.as_deref() } @@ -154,7 +162,7 @@ impl PageSetup { pub(crate) fn write_to(&self, writer: &mut Writer>>, r_id: &mut usize) { if self.has_param() { // pageSetup - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); let mut attributes: Vec<(&str, &str)> = Vec::new(); let paper_size = self.paper_size.get_value_string(); if self.paper_size.has_value() { diff --git a/src/structs/pane.rs b/src/structs/pane.rs index a36f6e08..ded6a16b 100644 --- a/src/structs/pane.rs +++ b/src/structs/pane.rs @@ -3,8 +3,8 @@ use super::DoubleValue; use super::EnumValue; use super::PaneStateValues; use super::PaneValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +21,7 @@ pub struct Pane { impl Pane { #[inline] + #[must_use] pub fn get_horizontal_split(&self) -> f64 { self.horizontal_split.get_value() } @@ -32,6 +33,7 @@ impl Pane { } #[inline] + #[must_use] pub fn get_vertical_split(&self) -> f64 { self.vertical_split.get_value() } @@ -43,6 +45,7 @@ impl Pane { } #[inline] + #[must_use] pub fn get_top_left_cell(&self) -> &Coordinate { &self.top_left_cell } @@ -59,6 +62,7 @@ impl Pane { } #[inline] + #[must_use] pub fn get_active_pane(&self) -> &PaneValues { self.active_pane.get_value() } @@ -70,6 +74,7 @@ impl Pane { } #[inline] + #[must_use] pub fn get_state(&self) -> &PaneStateValues { self.state.get_value() } diff --git a/src/structs/pattern_fill.rs b/src/structs/pattern_fill.rs index cd962301..7c8109bd 100644 --- a/src/structs/pattern_fill.rs +++ b/src/structs/pattern_fill.rs @@ -2,8 +2,8 @@ use super::Color; use super::EnumValue; use super::PatternValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -19,6 +19,7 @@ pub struct PatternFill { impl PatternFill { #[inline] + #[must_use] pub fn get_pattern_type(&self) -> &PatternValues { self.pattern_type.get_value() } @@ -41,6 +42,7 @@ impl PatternFill { } #[inline] + #[must_use] pub fn get_foreground_color(&self) -> Option<&Color> { self.foreground_color.as_deref() } @@ -65,6 +67,7 @@ impl PatternFill { } #[inline] + #[must_use] pub fn get_background_color(&self) -> Option<&Color> { self.background_color.as_deref() } @@ -100,8 +103,7 @@ impl PatternFill { format!( "{:x}", md5::Md5::digest(format!( - "{}{}{}", - pattern_type, foreground_color, background_color + "{pattern_type}{foreground_color}{background_color}" )) ) } diff --git a/src/structs/phonetic_run.rs b/src/structs/phonetic_run.rs index 824eab23..304790fb 100644 --- a/src/structs/phonetic_run.rs +++ b/src/structs/phonetic_run.rs @@ -1,5 +1,5 @@ // si -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/pivot_cache_definition.rs b/src/structs/pivot_cache_definition.rs index bc283120..15cf92d6 100644 --- a/src/structs/pivot_cache_definition.rs +++ b/src/structs/pivot_cache_definition.rs @@ -1,13 +1,13 @@ // pivotCacheDefinition -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{MC_NS, REL_OFC_NS, SHEET_MAIN_NS, SHEET_MS_REVISION_NS}; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::ByteValue; use crate::structs::CacheFields; use crate::structs::CacheSource; use crate::structs::DoubleValue; use crate::structs::StringValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -28,6 +28,7 @@ pub struct PivotCacheDefinition { impl PivotCacheDefinition { #[inline] + #[must_use] pub fn get_id(&self) -> &str { self.id.get_value_str() } @@ -39,6 +40,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_refreshed_by(&self) -> &str { self.refreshed_by.get_value_str() } @@ -50,6 +52,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_refreshed_date(&self) -> f64 { self.refreshed_date.get_value() } @@ -61,6 +64,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_created_version(&self) -> u8 { self.created_version.get_value() } @@ -72,6 +76,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_refreshed_version(&self) -> u8 { self.refreshed_version.get_value() } @@ -83,6 +88,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_min_refreshable_version(&self) -> u8 { self.min_refreshable_version.get_value() } @@ -94,6 +100,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_record_count(&self) -> u32 { self.record_count.get_value() } @@ -105,6 +112,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_cache_source(&self) -> &CacheSource { &self.cache_source } @@ -121,6 +129,7 @@ impl PivotCacheDefinition { } #[inline] + #[must_use] pub fn get_cache_fields(&self) -> &CacheFields { &self.cache_fields } diff --git a/src/structs/pivot_field.rs b/src/structs/pivot_field.rs index c8ac08de..7101aeab 100644 --- a/src/structs/pivot_field.rs +++ b/src/structs/pivot_field.rs @@ -1,7 +1,7 @@ // pivotField -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::BooleanValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct PivotField { } impl PivotField { #[inline] + #[must_use] pub fn get_data_field(&self) -> bool { self.data_field.get_value() } @@ -25,6 +26,7 @@ impl PivotField { } #[inline] + #[must_use] pub fn get_show_all(&self) -> bool { self.show_all.get_value() } diff --git a/src/structs/pivot_fields.rs b/src/structs/pivot_fields.rs index 9ba6006f..5b60cd03 100644 --- a/src/structs/pivot_fields.rs +++ b/src/structs/pivot_fields.rs @@ -1,7 +1,7 @@ // pivotFields -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::PivotField; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct PivotFields { } impl PivotFields { #[inline] + #[must_use] pub fn get_list(&self) -> &[PivotField] { &self.list } diff --git a/src/structs/pivot_table.rs b/src/structs/pivot_table.rs index b7db294e..e483f4f1 100644 --- a/src/structs/pivot_table.rs +++ b/src/structs/pivot_table.rs @@ -9,6 +9,7 @@ pub struct PivotTable { impl PivotTable { #[inline] + #[must_use] pub fn get_pivot_table_definition(&self) -> &PivotTableDefinition { &self.pivot_table_definition } @@ -25,6 +26,7 @@ impl PivotTable { } #[inline] + #[must_use] pub fn get_pivot_cache_definition(&self) -> &PivotCacheDefinition { &self.pivot_cache_definition } diff --git a/src/structs/pivot_table_definition.rs b/src/structs/pivot_table_definition.rs index 2a70284d..85e6da8a 100644 --- a/src/structs/pivot_table_definition.rs +++ b/src/structs/pivot_table_definition.rs @@ -1,6 +1,6 @@ // pivotTableDefinition -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{MC_NS, SHEET_MAIN_NS, SHEET_MS_REVISION_NS}; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::BooleanValue; use crate::structs::ByteValue; use crate::structs::ColumnFields; @@ -12,7 +12,7 @@ use crate::structs::PivotTableStyle; use crate::structs::RowItems; use crate::structs::StringValue; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -49,6 +49,7 @@ pub struct PivotTableDefinition { } impl PivotTableDefinition { #[inline] + #[must_use] pub fn get_apply_number_formats(&self) -> bool { self.apply_number_formats.get_value() } @@ -60,6 +61,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_apply_border_formats(&self) -> bool { self.apply_border_formats.get_value() } @@ -71,6 +73,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_apply_font_formats(&self) -> bool { self.apply_font_formats.get_value() } @@ -82,6 +85,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_apply_pattern_formats(&self) -> bool { self.apply_pattern_formats.get_value() } @@ -93,6 +97,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_apply_alignment_formats(&self) -> bool { self.apply_alignment_formats.get_value() } @@ -104,6 +109,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_apply_width_height_formats(&self) -> bool { self.apply_width_height_formats.get_value() } @@ -115,6 +121,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_use_auto_formatting(&self) -> bool { self.use_auto_formatting.get_value() } @@ -126,6 +133,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_item_print_titles(&self) -> bool { self.item_print_titles.get_value() } @@ -137,6 +145,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_outline(&self) -> bool { self.outline.get_value() } @@ -148,6 +157,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_outline_data(&self) -> bool { self.outline_data.get_value() } @@ -159,6 +169,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_multiple_field_filters(&self) -> bool { self.multiple_field_filters.get_value() } @@ -170,6 +181,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -181,6 +193,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_cache_id(&self) -> u32 { self.cache_id.get_value() } @@ -192,6 +205,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_indent(&self) -> u32 { self.indent.get_value() } @@ -203,6 +217,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_local_name(&self) -> &str { self.local_name.get_value_str() } @@ -214,6 +229,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_data_caption(&self) -> &str { self.data_caption.get_value_str() } @@ -225,6 +241,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_updated_version(&self) -> u8 { self.updated_version.get_value() } @@ -236,6 +253,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_min_refreshable_version(&self) -> u8 { self.min_refreshable_version.get_value() } @@ -247,6 +265,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_created_version(&self) -> u8 { self.created_version.get_value() } @@ -258,6 +277,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_location(&self) -> &Location { &self.location } @@ -274,6 +294,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_pivot_fields(&self) -> &PivotFields { &self.pivot_fields } @@ -290,6 +311,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_row_items(&self) -> &RowItems { &self.row_items } @@ -306,6 +328,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_column_fields(&self) -> &ColumnFields { &self.column_fields } @@ -322,6 +345,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_column_items(&self) -> &ColumnItems { &self.column_items } @@ -338,6 +362,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_data_fields(&self) -> &DataFields { &self.data_fields } @@ -354,6 +379,7 @@ impl PivotTableDefinition { } #[inline] + #[must_use] pub fn get_pivot_table_style(&self) -> &PivotTableStyle { &self.pivot_table_style } diff --git a/src/structs/pivot_table_style.rs b/src/structs/pivot_table_style.rs index db538428..a642b320 100644 --- a/src/structs/pivot_table_style.rs +++ b/src/structs/pivot_table_style.rs @@ -1,8 +1,8 @@ // pivotTableStyleInfo -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::BooleanValue; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct PivotTableStyle { } impl PivotTableStyle { #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.get_value_str() } @@ -31,6 +32,7 @@ impl PivotTableStyle { } #[inline] + #[must_use] pub fn get_show_row_headers(&self) -> bool { self.show_row_headers.get_value() } @@ -42,6 +44,7 @@ impl PivotTableStyle { } #[inline] + #[must_use] pub fn get_show_column_headers(&self) -> bool { self.show_column_headers.get_value() } @@ -53,6 +56,7 @@ impl PivotTableStyle { } #[inline] + #[must_use] pub fn get_show_row_stripes(&self) -> bool { self.show_row_stripes.get_value() } @@ -64,6 +68,7 @@ impl PivotTableStyle { } #[inline] + #[must_use] pub fn get_show_column_stripes(&self) -> bool { self.show_column_stripes.get_value() } @@ -75,6 +80,7 @@ impl PivotTableStyle { } #[inline] + #[must_use] pub fn get_show_last_column(&self) -> bool { self.show_last_column.get_value() } diff --git a/src/structs/print_options.rs b/src/structs/print_options.rs index 8a97159e..733ee8a3 100644 --- a/src/structs/print_options.rs +++ b/src/structs/print_options.rs @@ -1,6 +1,6 @@ use super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct PrintOptions { impl PrintOptions { #[inline] + #[must_use] pub fn get_horizontal_centered(&self) -> bool { self.horizontal_centered.get_value() } @@ -25,6 +26,7 @@ impl PrintOptions { } #[inline] + #[must_use] pub fn get_vertical_centered(&self) -> bool { self.vertical_centered.get_value() } diff --git a/src/structs/properties.rs b/src/structs/properties.rs index d43a0ef0..9af5e4d5 100644 --- a/src/structs/properties.rs +++ b/src/structs/properties.rs @@ -1,9 +1,11 @@ -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::{ + COREPROPS_NS, DCMITYPE_NS, DCORE_NS, DCTERMS_NS, VTYPES_NS, XPROPS_NS, XSI_NS, +}; +use crate::reader::driver::xml_read_loop; use crate::structs::custom_properties::Properties as CustomProperties; use crate::structs::StringValue; use crate::structs::Worksheet; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::BytesStart; use quick_xml::events::Event; use quick_xml::Reader; @@ -54,6 +56,7 @@ impl Default for Properties { } impl Properties { #[inline] + #[must_use] pub fn get_creator(&self) -> &str { self.creator.get_value_str() } @@ -65,6 +68,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_last_modified_by(&self) -> &str { self.last_modified_by.get_value_str() } @@ -76,6 +80,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_created(&self) -> &str { self.created.get_value_str() } @@ -87,6 +92,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_modified(&self) -> &str { self.modified.get_value_str() } @@ -98,6 +104,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_title(&self) -> &str { self.title.get_value_str() } @@ -109,6 +116,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_description(&self) -> &str { self.description.get_value_str() } @@ -120,6 +128,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_subject(&self) -> &str { self.subject.get_value_str() } @@ -131,6 +140,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_keywords(&self) -> &str { self.keywords.get_value_str() } @@ -142,6 +152,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_revision(&self) -> &str { self.revision.get_value_str() } @@ -153,6 +164,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_category(&self) -> &str { self.category.get_value_str() } @@ -164,6 +176,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_version(&self) -> &str { self.version.get_value_str() } @@ -175,6 +188,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_manager(&self) -> &str { self.manager.get_value_str() } @@ -186,6 +200,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_company(&self) -> &str { self.company.get_value_str() } @@ -197,6 +212,7 @@ impl Properties { } #[inline] + #[must_use] pub fn get_custom_properties(&self) -> &CustomProperties { &self.custom_properties } @@ -217,7 +233,7 @@ impl Properties { reader: &mut Reader, _e: &BytesStart, ) { - let mut value: String = String::from(""); + let mut value: String = String::new(); xml_read_loop!( reader, Event::Text(e) => { @@ -248,13 +264,13 @@ impl Properties { reader: &mut Reader, _e: &BytesStart, ) { - let mut value: String = String::from(""); + let mut value: String = String::new(); xml_read_loop!( reader, Event::Start(ref e) => { match e.name().into_inner(){ - b"Manager" => {value = String::from("");}, - b"Company" => {value = String::from("");}, + b"Manager" => {value = String::new();}, + b"Company" => {value = String::new();}, _ => {} } }, diff --git a/src/structs/protection.rs b/src/structs/protection.rs index 400d221f..588ece5a 100644 --- a/src/structs/protection.rs +++ b/src/structs/protection.rs @@ -1,7 +1,7 @@ // protection use super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use md5::Digest; use quick_xml::events::BytesStart; use quick_xml::Reader; @@ -16,6 +16,7 @@ pub struct Protection { impl Protection { #[inline] + #[must_use] pub fn get_locked(&self) -> bool { self.locked.get_value() } diff --git a/src/structs/range.rs b/src/structs/range.rs index 0e351845..f10f319a 100644 --- a/src/structs/range.rs +++ b/src/structs/range.rs @@ -1,6 +1,6 @@ use super::ColumnReference; use super::RowReference; -use crate::helper::coordinate::*; +use crate::helper::coordinate::index_from_coordinate; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentValue; @@ -65,6 +65,7 @@ impl Range { } #[inline] + #[must_use] pub fn get_range(&self) -> String { let mut result = self.get_coordinate_start(); if self.end_col.is_some() || self.end_row.is_some() { @@ -74,6 +75,7 @@ impl Range { } #[inline] + #[must_use] pub fn get_coordinate_start_col(&self) -> Option<&ColumnReference> { self.start_col.as_ref() } @@ -84,6 +86,7 @@ impl Range { } #[inline] + #[must_use] pub fn get_coordinate_start_row(&self) -> Option<&RowReference> { self.start_row.as_ref() } @@ -94,6 +97,7 @@ impl Range { } #[inline] + #[must_use] pub fn get_coordinate_end_col(&self) -> Option<&ColumnReference> { self.end_col.as_ref() } @@ -104,6 +108,7 @@ impl Range { } #[inline] + #[must_use] pub fn get_coordinate_end_row(&self) -> Option<&RowReference> { self.end_row.as_ref() } @@ -114,7 +119,7 @@ impl Range { } pub(crate) fn get_coordinate_start(&self) -> String { - let mut coordinate_str = "".into(); + let mut coordinate_str = String::new(); if let Some(v) = &self.start_col { coordinate_str = v.get_coordinate(); }; @@ -125,7 +130,7 @@ impl Range { } pub(crate) fn get_coordinate_end(&self) -> String { - let mut coordinate_str = "".into(); + let mut coordinate_str = String::new(); if let Some(v) = &self.end_col { coordinate_str = v.get_coordinate(); }; diff --git a/src/structs/raw.rs b/src/structs/raw.rs index c3bb5a3e..c153550b 100644 --- a/src/structs/raw.rs +++ b/src/structs/raw.rs @@ -1,4 +1,4 @@ -//! structs of raw_data. +//! structs of `raw_data`. mod raw_file; pub(crate) use self::raw_file::*; diff --git a/src/structs/raw/raw_file.rs b/src/structs/raw/raw_file.rs index dcbc82ec..625f37e9 100644 --- a/src/structs/raw/raw_file.rs +++ b/src/structs/raw/raw_file.rs @@ -1,4 +1,4 @@ -use crate::reader::driver::*; +use crate::reader::driver::join_paths; use crate::structs::StringValue; use crate::structs::WriterManager; use crate::XlsxError; @@ -16,7 +16,7 @@ impl RawFile { pub(crate) fn get_file_name(&self) -> String { let v: Vec<&str> = self.get_file_target().split('/').collect(); let object_name = v.last().unwrap(); - object_name.to_string() + (*object_name).to_string() } #[inline] @@ -66,7 +66,7 @@ impl RawFile { self } - pub(crate) fn set_attributes( + pub(crate) fn set_attributes( &mut self, arv: &mut zip::read::ZipArchive, base_path: &str, diff --git a/src/structs/raw/raw_relationship.rs b/src/structs/raw/raw_relationship.rs index 84ec2fb3..8f0f743b 100644 --- a/src/structs/raw/raw_relationship.rs +++ b/src/structs/raw/raw_relationship.rs @@ -1,9 +1,9 @@ -use crate::reader::driver::*; +use crate::reader::driver::get_attribute; use crate::structs::raw::RawFile; use crate::structs::StringValue; use crate::structs::WriterManager; use crate::structs::XlsxError; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -80,7 +80,7 @@ impl RawRelationship { self } - pub(crate) fn set_attributes( + pub(crate) fn set_attributes( &mut self, _reader: &mut Reader, e: &BytesStart, diff --git a/src/structs/raw/raw_relationships.rs b/src/structs/raw/raw_relationships.rs index a4be7e2a..d520eea5 100644 --- a/src/structs/raw/raw_relationships.rs +++ b/src/structs/raw/raw_relationships.rs @@ -1,10 +1,10 @@ -use crate::helper::const_str::*; -use crate::reader::driver::*; +use crate::helper::const_str::REL_NS; +use crate::reader::driver::{join_paths, xml_read_loop}; use crate::structs::raw::RawRelationship; use crate::structs::StringValue; use crate::structs::WriterManager; use crate::structs::XlsxError; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_new_line, write_start_tag}; use quick_xml::events::{BytesDecl, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,7 +23,7 @@ impl RawRelationships { pub(crate) fn _get_file_name(&self) -> String { let v: Vec<&str> = self.get_file_target().split('/').collect(); let object_name = v.last().unwrap(); - object_name.to_string() + (*object_name).to_string() } #[inline] @@ -53,7 +53,7 @@ impl RawRelationships { return relationship; } } - panic!("not found relationship as {}.", r_id); + panic!("not found relationship as {r_id}."); } #[inline] @@ -62,7 +62,7 @@ impl RawRelationships { self } - pub(crate) fn set_attributes( + pub(crate) fn set_attributes( &mut self, arv: &mut zip::read::ZipArchive, base_path: &str, @@ -80,7 +80,7 @@ impl RawRelationships { let mut r = io::BufReader::new(file_path); let mut buf = Vec::new(); r.read_to_end(&mut buf).unwrap(); - std::io::Cursor::new(buf) + io::Cursor::new(buf) }; let mut reader = Reader::from_reader(data); reader.config_mut().trim_text(true); diff --git a/src/structs/raw/raw_worksheet.rs b/src/structs/raw/raw_worksheet.rs index 978bd79a..6b2b7b37 100644 --- a/src/structs/raw/raw_worksheet.rs +++ b/src/structs/raw/raw_worksheet.rs @@ -1,4 +1,6 @@ -use crate::helper::const_str::*; +use crate::helper::const_str::{ + PKG_DRAWINGS_RELS, PKG_SHEET, PKG_SHEET_RELS, PKG_VML_DRAWING_RELS, +}; use crate::structs::raw::RawFile; use crate::structs::raw::RawRelationships; use crate::structs::WriterManager; @@ -97,7 +99,7 @@ impl RawWorksheet { writer_mng: &mut WriterManager, ) -> Result<(), XlsxError> { // Add worksheet - let target = format!("{PKG_SHEET}{}.xml", sheet_no); + let target = format!("{PKG_SHEET}{sheet_no}.xml"); writer_mng.add_bin(&target, self.get_worksheet_file().get_file_data())?; // Add worksheet rels diff --git a/src/structs/rich_text.rs b/src/structs/rich_text.rs index 75012cfb..3ab92ab1 100644 --- a/src/structs/rich_text.rs +++ b/src/structs/rich_text.rs @@ -1,6 +1,6 @@ use super::TextElement; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -17,8 +17,9 @@ pub struct RichText { impl RichText { #[inline] + #[must_use] pub fn get_text(&self) -> Cow<'static, str> { - let mut text = String::from(""); + let mut text = String::new(); for rich_text_elements in &self.rich_text_elements { text = format!("{}{}", text, rich_text_elements.get_text()); } @@ -35,6 +36,7 @@ impl RichText { } #[inline] + #[must_use] pub fn get_rich_text_elements(&self) -> &[TextElement] { &self.rich_text_elements } @@ -57,7 +59,7 @@ impl RichText { } pub(crate) fn get_hash_code(&self) -> String { - let mut value = String::from(""); + let mut value = String::new(); for ele in &self.rich_text_elements { write!(value, "{}", ele.get_hash_code()).unwrap(); } diff --git a/src/structs/row.rs b/src/structs/row.rs index e04be53c..94c018ec 100644 --- a/src/structs/row.rs +++ b/src/structs/row.rs @@ -6,10 +6,10 @@ use super::SharedStringTable; use super::Style; use super::Stylesheet; use super::UInt32Value; -use crate::helper::formula::*; -use crate::reader::driver::*; +use crate::helper::formula::FormulaToken; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::traits::AdjustmentValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -42,6 +42,7 @@ impl Default for Row { } impl Row { #[inline] + #[must_use] pub fn get_row_num(&self) -> u32 { self.row_num.get_value() } @@ -53,6 +54,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_height(&self) -> f64 { self.height.get_value() } @@ -65,6 +67,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_descent(&self) -> f64 { self.descent.get_value() } @@ -76,6 +79,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_thick_bot(&self) -> bool { self.thick_bot.get_value() } @@ -87,6 +91,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_custom_height(&self) -> bool { self.custom_height.get_value() } @@ -98,6 +103,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_hidden(&self) -> bool { self.hidden.get_value() } @@ -109,6 +115,7 @@ impl Row { } #[inline] + #[must_use] pub fn get_style(&self) -> &Style { &self.style } diff --git a/src/structs/row_breaks.rs b/src/structs/row_breaks.rs index e556268c..72b3d131 100644 --- a/src/structs/row_breaks.rs +++ b/src/structs/row_breaks.rs @@ -1,7 +1,7 @@ // rowBreaks -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::Break; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct RowBreaks { impl RowBreaks { #[inline] + #[must_use] pub fn get_break_list(&self) -> &[Break] { &self.break_list } diff --git a/src/structs/row_item.rs b/src/structs/row_item.rs index f7bdbaa7..aea9f9fe 100644 --- a/src/structs/row_item.rs +++ b/src/structs/row_item.rs @@ -1,10 +1,10 @@ // i -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::EnumValue; use crate::structs::ItemValues; use crate::structs::MemberPropertyIndex; use crate::structs::UInt32Value; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -19,6 +19,7 @@ pub struct RowItem { } impl RowItem { #[inline] + #[must_use] pub fn get_index(&self) -> u32 { self.index.get_value() } @@ -30,6 +31,7 @@ impl RowItem { } #[inline] + #[must_use] pub fn get_item_type(&self) -> &ItemValues { self.item_type.get_value() } @@ -41,6 +43,7 @@ impl RowItem { } #[inline] + #[must_use] pub fn get_repeated_item_count(&self) -> u32 { self.repeated_item_count.get_value() } @@ -52,6 +55,7 @@ impl RowItem { } #[inline] + #[must_use] pub fn get_member_property_index(&self) -> Option<&MemberPropertyIndex> { self.member_property_index.as_ref() } diff --git a/src/structs/row_items.rs b/src/structs/row_items.rs index 4c107c0e..c564853c 100644 --- a/src/structs/row_items.rs +++ b/src/structs/row_items.rs @@ -1,7 +1,7 @@ // rowItems -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::RowItem; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct RowItems { } impl RowItems { #[inline] + #[must_use] pub fn get_list(&self) -> &[RowItem] { &self.list } diff --git a/src/structs/row_reference.rs b/src/structs/row_reference.rs index 21da3d6f..2d362cd1 100644 --- a/src/structs/row_reference.rs +++ b/src/structs/row_reference.rs @@ -1,4 +1,6 @@ -use crate::helper::coordinate::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, is_remove_coordinate, +}; use crate::traits::AdjustmentValue; #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] @@ -19,6 +21,7 @@ impl Default for RowReference { impl RowReference { #[inline] + #[must_use] pub fn get_num(&self) -> u32 { self.num } @@ -53,6 +56,7 @@ impl RowReference { } #[inline] + #[must_use] pub fn get_is_lock(&self) -> bool { self.is_lock } @@ -70,6 +74,7 @@ impl RowReference { } #[inline] + #[must_use] pub fn get_coordinate(&self) -> String { format!("{}{}", if self.is_lock { "$" } else { "" }, self.num) } diff --git a/src/structs/selection.rs b/src/structs/selection.rs index 198bcb11..4c25a3c9 100644 --- a/src/structs/selection.rs +++ b/src/structs/selection.rs @@ -2,8 +2,8 @@ use super::Coordinate; use super::EnumValue; use super::PaneValues; use super::SequenceOfReferences; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct Selection { impl Selection { #[inline] + #[must_use] pub fn get_pane(&self) -> &PaneValues { self.pane.get_value() } @@ -29,6 +30,7 @@ impl Selection { } #[inline] + #[must_use] pub fn get_active_cell(&self) -> Option<&Coordinate> { self.active_cell.as_ref() } @@ -45,6 +47,7 @@ impl Selection { } #[inline] + #[must_use] pub fn get_sequence_of_references(&self) -> &SequenceOfReferences { &self.sequence_of_references } @@ -99,7 +102,7 @@ impl Selection { let active_cell_str = match &self.active_cell { Some(active_cell) => active_cell.to_string(), - None => String::from(""), + None => String::new(), }; if !active_cell_str.is_empty() { attributes.push(("activeCell", active_cell_str.as_str())); diff --git a/src/structs/sequence_of_references.rs b/src/structs/sequence_of_references.rs index 093b46d5..03dd28da 100644 --- a/src/structs/sequence_of_references.rs +++ b/src/structs/sequence_of_references.rs @@ -9,6 +9,7 @@ pub struct SequenceOfReferences { impl SequenceOfReferences { #[inline] + #[must_use] pub fn get_range_collection(&self) -> &[Range] { &self.range_collection } @@ -46,10 +47,11 @@ impl SequenceOfReferences { } #[inline] + #[must_use] pub fn get_sqref(&self) -> String { self.range_collection .iter() - .map(|range| range.get_range()) + .map(Range::get_range) .collect::>() .join(" ") } diff --git a/src/structs/shared_items.rs b/src/structs/shared_items.rs index 3825b43d..f7f021c6 100644 --- a/src/structs/shared_items.rs +++ b/src/structs/shared_items.rs @@ -1,8 +1,8 @@ // sharedItems -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::BooleanValue; use crate::structs::DoubleValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -18,6 +18,7 @@ pub struct SharedItems { max_value: DoubleValue, } impl SharedItems { + #[must_use] pub fn get_contains_semi_mixed_types(&self) -> bool { self.contains_semi_mixed_types.get_value() } @@ -27,6 +28,7 @@ impl SharedItems { self } + #[must_use] pub fn get_contains_string(&self) -> bool { self.contains_string.get_value() } @@ -36,6 +38,7 @@ impl SharedItems { self } + #[must_use] pub fn get_contains_number(&self) -> bool { self.contains_number.get_value() } @@ -45,6 +48,7 @@ impl SharedItems { self } + #[must_use] pub fn get_contains_integer(&self) -> bool { self.contains_integer.get_value() } @@ -54,6 +58,7 @@ impl SharedItems { self } + #[must_use] pub fn get_min_value(&self) -> f64 { self.min_value.get_value() } @@ -63,6 +68,7 @@ impl SharedItems { self } + #[must_use] pub fn get_max_value(&self) -> f64 { self.max_value.get_value() } diff --git a/src/structs/shared_string_item.rs b/src/structs/shared_string_item.rs index fcaa6b26..0cfdcfcb 100644 --- a/src/structs/shared_string_item.rs +++ b/src/structs/shared_string_item.rs @@ -3,8 +3,8 @@ use super::PhoneticRun; use super::RichText; use super::Text; use super::TextElement; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -71,10 +71,10 @@ impl SharedStringItem { "{}{}", self.text .as_ref() - .map_or(String::from("NONE"), |v| v.get_hash_code()), + .map_or(String::from("NONE"), Text::get_hash_code), self.rich_text .as_ref() - .map_or(String::from("NONE"), |v| v.get_hash_code()) + .map_or(String::from("NONE"), RichText::get_hash_code) ); h.write(content.as_bytes()); h.finish() diff --git a/src/structs/shared_string_table.rs b/src/structs/shared_string_table.rs index bb9a9058..9f82c340 100644 --- a/src/structs/shared_string_table.rs +++ b/src/structs/shared_string_table.rs @@ -1,9 +1,9 @@ // sst use super::CellValue; use super::SharedStringItem; -use crate::helper::const_str::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::const_str::SHEET_MAIN_NS; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -54,14 +54,13 @@ impl SharedStringTable { } let hash_code = shared_string_item.get_hash_u64(); - let n = match self.map.get(&hash_code) { - Some(v) => v.to_owned(), - None => { - let n = self.shared_string_item.len(); - self.map.insert(hash_code, n); - self.set_shared_string_item(shared_string_item); - n - } + let n = if let Some(v) = self.map.get(&hash_code) { + v.to_owned() + } else { + let n = self.shared_string_item.len(); + self.map.insert(hash_code, n); + self.set_shared_string_item(shared_string_item); + n }; n } diff --git a/src/structs/sheet_format_properties.rs b/src/structs/sheet_format_properties.rs index df8dc879..cf63dfd2 100644 --- a/src/structs/sheet_format_properties.rs +++ b/src/structs/sheet_format_properties.rs @@ -3,8 +3,8 @@ use super::BooleanValue; use super::ByteValue; use super::DoubleValue; use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -25,6 +25,7 @@ pub struct SheetFormatProperties { impl SheetFormatProperties { #[inline] + #[must_use] pub fn get_base_column_width(&self) -> u32 { self.base_column_width.get_value() } @@ -36,6 +37,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_custom_height(&self) -> bool { self.custom_height.get_value() } @@ -47,6 +49,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_default_column_width(&self) -> f64 { self.default_column_width.get_value() } @@ -58,6 +61,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_default_row_height(&self) -> f64 { self.default_row_height.get_value() } @@ -69,6 +73,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_dy_descent(&self) -> f64 { self.dy_descent.get_value() } @@ -80,6 +85,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_outline_level_column(&self) -> u8 { self.outline_level_column.get_value() } @@ -91,6 +97,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_outline_level_row(&self) -> u8 { self.outline_level_row.get_value() } @@ -102,6 +109,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_thick_bottom(&self) -> bool { self.thick_bottom.get_value() } @@ -113,6 +121,7 @@ impl SheetFormatProperties { } #[inline] + #[must_use] pub fn get_thick_top(&self) -> bool { self.thick_top.get_value() } diff --git a/src/structs/sheet_protection.rs b/src/structs/sheet_protection.rs index 223864f3..d6ce782a 100644 --- a/src/structs/sheet_protection.rs +++ b/src/structs/sheet_protection.rs @@ -2,9 +2,9 @@ use super::BooleanValue; use super::StringValue; use super::UInt32Value; -use crate::helper::crypt::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::crypt::encrypt_sheet_protection; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -36,6 +36,7 @@ pub struct SheetProtection { } impl SheetProtection { #[inline] + #[must_use] pub fn get_algorithm_name(&self) -> &str { self.algorithm_name.get_value_str() } @@ -47,6 +48,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_hash_value(&self) -> &str { self.hash_value.get_value_str() } @@ -58,6 +60,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_salt_value(&self) -> &str { self.salt_value.get_value_str() } @@ -69,6 +72,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_spin_count(&self) -> u32 { self.spin_count.get_value() } @@ -80,6 +84,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_password_raw(&self) -> &str { self.password.get_value_str() } @@ -97,6 +102,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_sheet(&self) -> bool { self.sheet.get_value() } @@ -108,6 +114,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_objects(&self) -> bool { self.objects.get_value() } @@ -119,6 +126,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_delete_rows(&self) -> bool { self.delete_rows.get_value() } @@ -130,6 +138,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_insert_columns(&self) -> bool { self.insert_columns.get_value() } @@ -141,6 +150,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_delete_columns(&self) -> bool { self.delete_columns.get_value() } @@ -152,6 +162,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_insert_hyperlinks(&self) -> bool { self.insert_hyperlinks.get_value() } @@ -163,6 +174,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_auto_filter(&self) -> bool { self.auto_filter.get_value() } @@ -174,6 +186,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_scenarios(&self) -> bool { self.scenarios.get_value() } @@ -185,6 +198,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_format_cells(&self) -> bool { self.format_cells.get_value() } @@ -196,6 +210,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_format_columns(&self) -> bool { self.format_columns.get_value() } @@ -207,6 +222,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_insert_rows(&self) -> bool { self.insert_rows.get_value() } @@ -218,6 +234,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_format_rows(&self) -> bool { self.format_rows.get_value() } @@ -229,6 +246,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_pivot_tables(&self) -> bool { self.pivot_tables.get_value() } @@ -240,6 +258,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_select_locked_cells(&self) -> bool { self.select_locked_cells.get_value() } @@ -251,6 +270,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_select_unlocked_cells(&self) -> bool { self.select_unlocked_cells.get_value() } @@ -262,6 +282,7 @@ impl SheetProtection { } #[inline] + #[must_use] pub fn get_sort(&self) -> bool { self.sort.get_value() } diff --git a/src/structs/sheet_view.rs b/src/structs/sheet_view.rs index 5646a349..be2de3b4 100644 --- a/src/structs/sheet_view.rs +++ b/src/structs/sheet_view.rs @@ -6,8 +6,8 @@ use super::Selection; use super::SheetViewValues; use super::StringValue; use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -31,6 +31,7 @@ pub struct SheetView { impl SheetView { #[inline] + #[must_use] pub fn get_show_grid_lines(&self) -> bool { self.show_grid_lines.get_value() } @@ -42,6 +43,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_tab_selected(&self) -> bool { self.tab_selected.get_value() } @@ -53,6 +55,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_workbook_view_id(&self) -> u32 { self.workbook_view_id.get_value() } @@ -64,6 +67,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_pane(&self) -> Option<&Pane> { self.pane.as_deref() } @@ -80,6 +84,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_view(&self) -> &SheetViewValues { self.view.get_value() } @@ -91,6 +96,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_zoom_scale(&self) -> u32 { self.zoom_scale.get_value() } @@ -102,6 +108,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_zoom_scale_normal(&self) -> u32 { self.zoom_scale_normal.get_value() } @@ -113,6 +120,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_zoom_scale_page_layout_view(&self) -> u32 { self.zoom_scale_page_layout_view.get_value() } @@ -124,6 +132,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_zoom_scale_sheet_layout_view(&self) -> u32 { self.zoom_scale_sheet_layout_view.get_value() } @@ -135,6 +144,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_top_left_cell(&self) -> &str { self.top_left_cell.get_value_str() } @@ -146,6 +156,7 @@ impl SheetView { } #[inline] + #[must_use] pub fn get_selection(&self) -> &[Selection] { &self.selection } @@ -261,7 +272,7 @@ impl SheetView { } // pane if let Some(v) = &self.pane { - v.write_to(writer) + v.write_to(writer); } // selection for obj in &self.selection { diff --git a/src/structs/sheet_views.rs b/src/structs/sheet_views.rs index 728a9db9..0f42db39 100644 --- a/src/structs/sheet_views.rs +++ b/src/structs/sheet_views.rs @@ -1,7 +1,7 @@ // sheetViews use super::SheetView; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct SheetViews { impl SheetViews { #[inline] + #[must_use] pub fn get_sheet_view_list(&self) -> &[SheetView] { &self.sheet_view_list } diff --git a/src/structs/spreadsheet.rs b/src/structs/spreadsheet.rs index c1bd0ddb..e33baf8d 100644 --- a/src/structs/spreadsheet.rs +++ b/src/structs/spreadsheet.rs @@ -1,6 +1,6 @@ -use crate::helper::address::*; -use crate::helper::coordinate::*; -use crate::reader::xlsx::*; +use crate::helper::address::split_address; +use crate::helper::coordinate::column_index_from_string; +use crate::reader::xlsx::raw_to_deserialize_by_worksheet; use crate::structs::drawing::Theme; use crate::structs::Address; use crate::structs::CellValue; @@ -150,13 +150,14 @@ impl Spreadsheet { /// # Arguments /// * `address` - address. ex) "Sheet1!A1:C5" /// # Return value - /// *`Vec<&CellValue>` - CellValue List. + /// *`Vec<&CellValue>` - `CellValue` List. /// # Examples /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let mut cell_value_List = book.get_cell_value_by_address("Sheet1!A1:C5"); /// ``` #[inline] + #[must_use] pub fn get_cell_value_by_address(&self, address: &str) -> Vec<&CellValue> { let (sheet_name, range) = split_address(address); self.get_sheet_by_name(sheet_name) @@ -169,7 +170,7 @@ impl Spreadsheet { /// # Arguments /// * `address` - Address Object /// # Return value - /// *`Vec<&CellValue>` - CellValue List. + /// *`Vec<&CellValue>` - `CellValue` List. #[inline] pub(crate) fn get_cell_value_by_address_crate(&self, address: &Address) -> Vec<&CellValue> { self.get_sheet_by_name(address.get_sheet_name()) @@ -179,6 +180,7 @@ impl Spreadsheet { /// Get Theme. #[inline] + #[must_use] pub fn get_theme(&self) -> &Theme { &self.theme } @@ -200,6 +202,7 @@ impl Spreadsheet { /// Get Properties. #[inline] + #[must_use] pub fn get_properties(&self) -> &Properties { &self.properties } @@ -223,6 +226,7 @@ impl Spreadsheet { /// # Return value /// * `Option<&Vec>` - Macros Code Raw Data. #[inline] + #[must_use] pub fn get_macros_code(&self) -> Option<&[u8]> { self.macros_code.as_deref() } @@ -245,6 +249,7 @@ impl Spreadsheet { /// Has Macros Code #[inline] + #[must_use] pub fn get_has_macros(&self) -> bool { self.macros_code.is_some() } @@ -268,6 +273,7 @@ impl Spreadsheet { /// Must to be the same in workbook with VBA/macros code from this workbook /// for that code in Workbook object to work out of the box without adjustments #[inline] + #[must_use] pub fn get_code_name(&self) -> Option<&str> { self.code_name.get_value() } @@ -315,6 +321,7 @@ impl Spreadsheet { } /// Get Work Sheet List. + #[must_use] pub fn get_sheet_collection(&self) -> &[Worksheet] { for worksheet in &self.work_sheet_collection { assert!(worksheet.is_deserialized(),"This Worksheet is Not Deserialized. Please exec to read_sheet(&mut self, index: usize);"); @@ -325,6 +332,7 @@ impl Spreadsheet { /// Get Work Sheet List. /// No check deserialized. #[inline] + #[must_use] pub fn get_sheet_collection_no_check(&self) -> &[Worksheet] { &self.work_sheet_collection } @@ -340,6 +348,7 @@ impl Spreadsheet { /// # Return value /// * `usize` - Work Sheet Count. #[inline] + #[must_use] pub fn get_sheet_count(&self) -> usize { self.work_sheet_collection.len() } @@ -385,6 +394,7 @@ impl Spreadsheet { /// # Return value /// * `Option<&Worksheet>`. #[inline] + #[must_use] pub fn get_sheet(&self, index: usize) -> Option<&Worksheet> { self.work_sheet_collection .get(index) @@ -399,6 +409,7 @@ impl Spreadsheet { /// # Return value /// * `Option<&Worksheet>. #[inline] + #[must_use] pub fn get_sheet_by_name(&self, sheet_name: &str) -> Option<&Worksheet> { self.find_sheet_index_by_name(sheet_name) .and_then(|index| self.get_sheet(index)) @@ -453,6 +464,7 @@ impl Spreadsheet { /// # Return value /// * `&Worksheet` - Work sheet. #[inline] + #[must_use] pub fn get_active_sheet(&self) -> &Worksheet { let index = self.get_workbook_view().get_active_tab(); self.get_sheet(index as usize).unwrap() @@ -591,6 +603,7 @@ impl Spreadsheet { /// Get Workbook View. #[inline] + #[must_use] pub fn get_workbook_view(&self) -> &WorkbookView { &self.workbook_view } @@ -603,7 +616,7 @@ impl Spreadsheet { /// Set Workbook View. /// # Arguments - /// * `value` - WorkbookView + /// * `value` - `WorkbookView` #[inline] pub fn set_workbook_view(&mut self, value: WorkbookView) -> &mut Self { self.workbook_view = value; @@ -619,7 +632,7 @@ impl Spreadsheet { } self.get_sheet_collection_no_check() .iter() - .any(|sheet| sheet.has_defined_names()) + .any(Worksheet::has_defined_names) } #[inline] @@ -671,13 +684,14 @@ impl Spreadsheet { pub(crate) fn update_pivot_caches(&mut self, key: String, value: String) -> &mut Self { self.pivot_caches.iter_mut().for_each(|(val1, _, val3)| { if **val1 == key { - *val3 = value.clone().into_boxed_str() + *val3 = value.clone().into_boxed_str(); }; }); self } #[inline] + #[must_use] pub fn get_workbook_protection(&self) -> Option<&WorkbookProtection> { self.workbook_protection.as_deref() } @@ -702,6 +716,7 @@ impl Spreadsheet { /// Get Defined Name (Vec). #[inline] + #[must_use] pub fn get_defined_names(&self) -> &[DefinedName] { &self.defined_names } @@ -722,7 +737,7 @@ impl Spreadsheet { /// Add Defined Name. /// # Arguments - /// * `value` - DefinedName. + /// * `value` - `DefinedName`. #[inline] pub fn add_defined_names(&mut self, value: DefinedName) { self.defined_names.push(value); diff --git a/src/structs/strike.rs b/src/structs/strike.rs index 994c4784..872582c8 100644 --- a/src/structs/strike.rs +++ b/src/structs/strike.rs @@ -1,7 +1,7 @@ // strike use super::BooleanValue; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Strike { impl Strike { #[inline] + #[must_use] pub fn get_val(&self) -> bool { self.val.get_value() } diff --git a/src/structs/style.rs b/src/structs/style.rs index 8cb14300..13d93728 100644 --- a/src/structs/style.rs +++ b/src/structs/style.rs @@ -61,6 +61,7 @@ pub struct Style { } impl Style { #[inline] + #[must_use] pub fn get_font(&self) -> Option<&Font> { self.font.as_deref() } @@ -89,6 +90,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_fill(&self) -> Option<&Fill> { self.fill.as_deref() } @@ -105,6 +107,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_background_color(&self) -> Option<&Color> { self.get_fill() .and_then(|fill| fill.get_pattern_fill()?.get_foreground_color()) @@ -157,6 +160,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_borders(&self) -> Option<&Borders> { self.borders.as_deref() } @@ -186,6 +190,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_alignment(&self) -> Option<&Alignment> { self.alignment.as_ref() } @@ -214,6 +219,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_numbering_format(&self) -> Option<&NumberingFormat> { self.numbering_format.as_deref() } @@ -237,6 +243,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_number_format(&self) -> Option<&NumberingFormat> { self.get_numbering_format() } @@ -257,6 +264,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_format_id(&self) -> u32 { self.format_id.get_value() } @@ -268,6 +276,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_protection(&self) -> Option<&Protection> { self.protection.as_ref() } @@ -317,6 +326,7 @@ impl Style { } #[inline] + #[must_use] pub fn get_default_value() -> Self { let mut def = Self::default(); def.set_font(Font::get_default_value()); diff --git a/src/structs/stylesheet.rs b/src/structs/stylesheet.rs index 88efd816..fc4118ac 100644 --- a/src/structs/stylesheet.rs +++ b/src/structs/stylesheet.rs @@ -10,9 +10,9 @@ use super::Fills; use super::Fonts; use super::NumberingFormats; use super::Style; -use crate::helper::const_str::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::const_str::{MC_NS, SHEETML_AC_NS, SHEET_MAIN_NS, SHEET_MS_MAIN_NS}; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; diff --git a/src/structs/table.rs b/src/structs/table.rs index 28178951..d77f5855 100644 --- a/src/structs/table.rs +++ b/src/structs/table.rs @@ -1,7 +1,8 @@ use super::{ - coordinate::*, BooleanValue, EnumValue, StringValue, TotalsRowFunctionValues, UInt32Value, + coordinate::Coordinate, BooleanValue, EnumValue, StringValue, TotalsRowFunctionValues, + UInt32Value, }; -use crate::helper::coordinate::*; +use crate::helper::coordinate::CellCoordinates; use thin_vec::ThinVec; //use reader::driver::*; @@ -36,6 +37,7 @@ impl Table { } #[inline] + #[must_use] pub fn is_ok(&self) -> bool { !(self.name.is_empty() || self.display_name.is_empty() @@ -48,6 +50,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { &self.name } @@ -61,6 +64,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_display_name(&self) -> &str { &self.display_name } @@ -71,6 +75,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_area(&self) -> &(Coordinate, Coordinate) { &self.area } @@ -91,6 +96,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_columns(&self) -> &[TableColumn] { &self.columns } @@ -101,6 +107,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_style_info(&self) -> Option<&TableStyleInfo> { self.style_info.as_deref() } @@ -116,6 +123,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_totals_row_shown(&self) -> bool { self.totals_row_shown.get_value() } @@ -141,6 +149,7 @@ impl Table { } #[inline] + #[must_use] pub fn get_totals_row_count(&self) -> u32 { self.totals_row_count.get_value() } @@ -182,6 +191,7 @@ pub struct TableColumn { } impl TableColumn { #[inline] + #[must_use] pub fn new(name: &str) -> Self { Self { name: name.to_string(), @@ -192,6 +202,7 @@ impl TableColumn { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.as_str() } @@ -208,6 +219,7 @@ impl TableColumn { } #[inline] + #[must_use] pub fn get_totals_row_label(&self) -> Option<&str> { self.totals_row_label.get_value() } @@ -234,6 +246,7 @@ impl TableColumn { } #[inline] + #[must_use] pub fn get_totals_row_function(&self) -> &TotalsRowFunctionValues { self.totals_row_function.get_value() } @@ -254,6 +267,7 @@ impl TableColumn { } #[inline] + #[must_use] pub fn get_calculated_column_formula(&self) -> Option<&String> { self.calculated_column_formula.as_ref() } @@ -274,6 +288,7 @@ pub struct TableStyleInfo { } impl TableStyleInfo { #[inline] + #[must_use] pub fn new( name: &str, show_first_col: bool, @@ -291,26 +306,31 @@ impl TableStyleInfo { } #[inline] + #[must_use] pub fn get_name(&self) -> &str { self.name.as_str() } #[inline] + #[must_use] pub fn is_show_first_col(&self) -> bool { self.show_first_col } #[inline] + #[must_use] pub fn is_show_last_col(&self) -> bool { self.show_last_col } #[inline] + #[must_use] pub fn is_show_row_stripes(&self) -> bool { self.show_row_stripes } #[inline] + #[must_use] pub fn is_show_col_stripes(&self) -> bool { self.show_col_stripes } diff --git a/src/structs/text.rs b/src/structs/text.rs index 242ad4ce..fa2ff99f 100644 --- a/src/structs/text.rs +++ b/src/structs/text.rs @@ -1,6 +1,6 @@ // t -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; diff --git a/src/structs/text_element.rs b/src/structs/text_element.rs index 942ff3ab..24c50088 100644 --- a/src/structs/text_element.rs +++ b/src/structs/text_element.rs @@ -1,8 +1,8 @@ // r use super::Font; use super::Text; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::xml_read_loop; +use crate::writer::driver::{write_end_tag, write_start_tag}; use md5::Digest; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; @@ -17,6 +17,7 @@ pub struct TextElement { impl TextElement { #[inline] + #[must_use] pub fn get_text(&self) -> &str { self.text.get_value() } @@ -28,6 +29,7 @@ impl TextElement { } #[inline] + #[must_use] pub fn get_run_properties(&self) -> Option<&Font> { self.run_properties.as_deref() } @@ -54,6 +56,7 @@ impl TextElement { } #[inline] + #[must_use] pub fn get_font(&self) -> Option<&Font> { self.get_run_properties() } diff --git a/src/structs/to_marker.rs b/src/structs/to_marker.rs index c1e348eb..d6cd8768 100644 --- a/src/structs/to_marker.rs +++ b/src/structs/to_marker.rs @@ -1,5 +1,5 @@ // to -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ToMarker { } impl ToMarker { #[inline] + #[must_use] pub fn get_col(&self) -> usize { self.col } @@ -25,6 +26,7 @@ impl ToMarker { } #[inline] + #[must_use] pub fn get_col_off(&self) -> usize { self.col_off } @@ -36,6 +38,7 @@ impl ToMarker { } #[inline] + #[must_use] pub fn get_row(&self) -> usize { self.row } @@ -47,6 +50,7 @@ impl ToMarker { } #[inline] + #[must_use] pub fn get_row_off(&self) -> usize { self.row_off } @@ -82,7 +86,7 @@ impl ToMarker { reader: &mut Reader, _e: &BytesStart, ) { - let mut string_value: String = String::from(""); + let mut string_value: String = String::new(); let mut buf = Vec::new(); loop { match reader.read_event_into(&mut buf) { diff --git a/src/structs/underline.rs b/src/structs/underline.rs index 65927a4b..ade9d6f1 100644 --- a/src/structs/underline.rs +++ b/src/structs/underline.rs @@ -2,8 +2,8 @@ use super::EnumTrait; use super::EnumValue; use super::UnderlineValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct Underline { impl Underline { #[inline] + #[must_use] pub fn get_val(&self) -> &UnderlineValues { if self.val.has_value() { return self.val.get_value(); @@ -36,7 +37,7 @@ impl Underline { e: &BytesStart, ) { self.set_val(UnderlineValues::default()); - set_string_from_xml!(self, e, val, "val") + set_string_from_xml!(self, e, val, "val"); } pub(crate) fn write_to(&self, writer: &mut Writer>>) { diff --git a/src/structs/vertical_text_alignment.rs b/src/structs/vertical_text_alignment.rs index 222367b0..a61f774b 100644 --- a/src/structs/vertical_text_alignment.rs +++ b/src/structs/vertical_text_alignment.rs @@ -1,8 +1,8 @@ // vertAlign use super::EnumValue; use super::VerticalAlignmentRunValues; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +15,7 @@ pub struct VerticalTextAlignment { impl VerticalTextAlignment { #[inline] + #[must_use] pub fn get_val(&self) -> &VerticalAlignmentRunValues { self.val.get_value() } diff --git a/src/structs/vml/fill.rs b/src/structs/vml/fill.rs index ed7bcaf2..176a2c3d 100644 --- a/src/structs/vml/fill.rs +++ b/src/structs/vml/fill.rs @@ -1,9 +1,9 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::raw::RawRelationships; use crate::structs::MediaObject; use crate::structs::StringValue; use crate::structs::TrueFalseValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -20,6 +20,7 @@ pub struct Fill { impl Fill { #[inline] + #[must_use] pub fn get_color(&self) -> &str { self.color.get_value_str() } @@ -31,6 +32,7 @@ impl Fill { } #[inline] + #[must_use] pub fn get_color_2(&self) -> &str { self.color_2.get_value_str() } @@ -42,6 +44,7 @@ impl Fill { } #[inline] + #[must_use] pub fn get_on(&self) -> bool { self.on.get_value() } @@ -53,6 +56,7 @@ impl Fill { } #[inline] + #[must_use] pub fn get_focus_size(&self) -> &str { self.focus_size.get_value_str() } @@ -64,6 +68,7 @@ impl Fill { } #[inline] + #[must_use] pub fn get_image(&self) -> Option<&MediaObject> { self.image.as_ref() } @@ -123,10 +128,10 @@ impl Fill { if self.focus_size.has_value() { attributes.push(("focussize", self.focus_size.get_value_str())); } - let mut _r_id_str = String::from(""); + let mut _r_id_str = String::new(); if let Some(image) = &self.image { let r_id = image.get_rid(rel_list); - _r_id_str = format!("rId{}", r_id); + _r_id_str = format!("rId{r_id}"); attributes.push(("o:title", image.get_image_title())); attributes.push(("o:relid", _r_id_str.as_str())); attributes.push(("recolor", "t")); diff --git a/src/structs/vml/image_data.rs b/src/structs/vml/image_data.rs index 84a76b58..18f9bd4a 100644 --- a/src/structs/vml/image_data.rs +++ b/src/structs/vml/image_data.rs @@ -1,8 +1,8 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::raw::RawRelationships; use crate::structs::MediaObject; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -16,6 +16,7 @@ pub struct ImageData { impl ImageData { #[inline] + #[must_use] pub fn get_image(&self) -> &MediaObject { &self.image } @@ -31,6 +32,7 @@ impl ImageData { self } + #[must_use] pub fn get_title(&self) -> &str { self.title.get_value_str() } @@ -66,9 +68,9 @@ impl ImageData { ) { // v:imagedata let mut attributes: Vec<(&str, &str)> = Vec::new(); - let mut _r_id_str = String::from(""); + let mut _r_id_str = String::new(); let r_id = &self.image.get_rid(rel_list); - _r_id_str = format!("rId{}", r_id); + _r_id_str = format!("rId{r_id}"); attributes.push(("o:relid", _r_id_str.as_str())); if self.title.has_value() { attributes.push(("o:title", self.title.get_value_str())); diff --git a/src/structs/vml/path.rs b/src/structs/vml/path.rs index 72f38526..e983605e 100644 --- a/src/structs/vml/path.rs +++ b/src/structs/vml/path.rs @@ -1,7 +1,7 @@ use super::office::ConnectValues; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::EnumValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -12,6 +12,7 @@ pub struct Path { connection_point_type: EnumValue, } impl Path { + #[must_use] pub fn get_connection_point_type(&self) -> &ConnectValues { self.connection_point_type.get_value() } diff --git a/src/structs/vml/shadow.rs b/src/structs/vml/shadow.rs index 28671e4c..fe4798a3 100644 --- a/src/structs/vml/shadow.rs +++ b/src/structs/vml/shadow.rs @@ -1,7 +1,7 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::StringValue; use crate::structs::TrueFalseValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Shadow { obscured: TrueFalseValue, } impl Shadow { + #[must_use] pub fn get_on(&self) -> bool { self.on.get_value() } @@ -23,6 +24,7 @@ impl Shadow { self } + #[must_use] pub fn get_color(&self) -> &str { self.color.get_value_str() } @@ -32,6 +34,7 @@ impl Shadow { self } + #[must_use] pub fn get_obscured(&self) -> bool { self.obscured.get_value() } diff --git a/src/structs/vml/shape.rs b/src/structs/vml/shape.rs index 8180acc9..36b014bd 100644 --- a/src/structs/vml/shape.rs +++ b/src/structs/vml/shape.rs @@ -6,14 +6,14 @@ use super::Path; use super::Shadow; use super::Stroke; use super::TextBox; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::raw::RawRelationships; use crate::structs::EnumValue; use crate::structs::Int32Value; use crate::structs::StringValue; use crate::structs::TrueFalseValue; use crate::traits::AdjustmentCoordinate; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -41,6 +41,7 @@ pub struct Shape { } impl Shape { + #[must_use] pub fn get_style(&self) -> &str { self.style.get_value_str() } @@ -50,6 +51,7 @@ impl Shape { self } + #[must_use] pub fn get_type(&self) -> &str { self.r_type.get_value_str() } @@ -59,6 +61,7 @@ impl Shape { self } + #[must_use] pub fn get_filled(&self) -> bool { self.filled.get_value() } @@ -68,6 +71,7 @@ impl Shape { self } + #[must_use] pub fn get_fill_color(&self) -> &str { self.fill_color.get_value_str() } @@ -77,6 +81,7 @@ impl Shape { self } + #[must_use] pub fn get_stroked(&self) -> bool { self.stroked.get_value() } @@ -86,6 +91,7 @@ impl Shape { self } + #[must_use] pub fn get_stroke_color(&self) -> &str { self.stroke_color.get_value_str() } @@ -95,6 +101,7 @@ impl Shape { self } + #[must_use] pub fn get_stroke_weight(&self) -> &str { self.stroke_weight.get_value_str() } @@ -104,6 +111,7 @@ impl Shape { self } + #[must_use] pub fn get_inset_mode(&self) -> &InsetMarginValues { self.inset_mode.get_value() } @@ -113,6 +121,7 @@ impl Shape { self } + #[must_use] pub fn get_fill(&self) -> Option<&Fill> { self.fill.as_deref() } @@ -126,6 +135,7 @@ impl Shape { self } + #[must_use] pub fn get_image_data(&self) -> Option<&ImageData> { self.image_data.as_deref() } @@ -139,6 +149,7 @@ impl Shape { self } + #[must_use] pub fn get_stroke(&self) -> Option<&Stroke> { self.stroke.as_deref() } @@ -152,6 +163,7 @@ impl Shape { self } + #[must_use] pub fn get_shadow(&self) -> Option<&Shadow> { self.shadow.as_deref() } @@ -165,6 +177,7 @@ impl Shape { self } + #[must_use] pub fn get_path(&self) -> Option<&Path> { self.path.as_deref() } @@ -178,6 +191,7 @@ impl Shape { self } + #[must_use] pub fn get_text_box(&self) -> Option<&TextBox> { self.text_box.as_deref() } @@ -191,6 +205,7 @@ impl Shape { self } + #[must_use] pub fn get_client_data(&self) -> &ClientData { &self.client_data } @@ -204,6 +219,7 @@ impl Shape { self } + #[must_use] pub fn get_optional_number(&self) -> i32 { self.optional_number.get_value() } @@ -213,6 +229,7 @@ impl Shape { self } + #[must_use] pub fn get_coordinate_size(&self) -> &str { self.coordinate_size.get_value_str() } @@ -302,7 +319,7 @@ impl Shape { rel_list: &mut Vec<(String, String)>, ) { // v:shape - let id_str = format!("_x0000_s{}", id); + let id_str = format!("_x0000_s{id}"); let mut attributes: Vec<(&str, &str)> = Vec::new(); attributes.push(("id", &id_str)); if self.r_type.has_value() { diff --git a/src/structs/vml/spreadsheet/anchor.rs b/src/structs/vml/spreadsheet/anchor.rs index 561ff82a..bca48d92 100644 --- a/src/structs/vml/spreadsheet/anchor.rs +++ b/src/structs/vml/spreadsheet/anchor.rs @@ -1,7 +1,9 @@ -use crate::helper::coordinate::*; -use crate::reader::driver::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, is_remove_coordinate, +}; +use crate::reader::driver::xml_read_loop; use crate::traits::AdjustmentCoordinate; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -21,6 +23,7 @@ pub struct Anchor { impl Anchor { #[inline] + #[must_use] pub fn get_left_column(&self) -> u32 { self.left_column } @@ -32,6 +35,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_left_offset(&self) -> u32 { self.left_offset } @@ -43,6 +47,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_top_row(&self) -> u32 { self.top_row } @@ -54,6 +59,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_top_offset(&self) -> u32 { self.top_offset } @@ -65,6 +71,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_right_column(&self) -> u32 { self.right_column } @@ -76,6 +83,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_right_offset(&self) -> u32 { self.right_offset } @@ -87,6 +95,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_bottom_row(&self) -> u32 { self.bottom_row } @@ -98,6 +107,7 @@ impl Anchor { } #[inline] + #[must_use] pub fn get_bottom_offset(&self) -> u32 { self.bottom_offset } @@ -184,7 +194,7 @@ impl Anchor { #[inline] fn get_number(value: Option<&&str>) -> u32 { match value { - Some(v) => v.to_string().trim().parse::().unwrap_or(0), + Some(v) => (*v).to_string().trim().parse::().unwrap_or(0), None => 0, } } diff --git a/src/structs/vml/spreadsheet/auto_fill.rs b/src/structs/vml/spreadsheet/auto_fill.rs index aa83c7ad..ef92c5b2 100644 --- a/src/structs/vml/spreadsheet/auto_fill.rs +++ b/src/structs/vml/spreadsheet/auto_fill.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::TrueFalseBlankValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct AutoFill { impl AutoFill { #[inline] + #[must_use] pub fn get_value(&self) -> Option { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/auto_size_picture.rs b/src/structs/vml/spreadsheet/auto_size_picture.rs index 8e9efd7c..beccca18 100644 --- a/src/structs/vml/spreadsheet/auto_size_picture.rs +++ b/src/structs/vml/spreadsheet/auto_size_picture.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::TrueFalseBlankValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct AutoSizePicture { impl AutoSizePicture { #[inline] + #[must_use] pub fn get_value(&self) -> Option { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/client_data.rs b/src/structs/vml/spreadsheet/client_data.rs index 9922a3b8..cb2d612c 100644 --- a/src/structs/vml/spreadsheet/client_data.rs +++ b/src/structs/vml/spreadsheet/client_data.rs @@ -8,11 +8,11 @@ use super::MoveWithCells; use super::ObjectValues; use super::ResizeWithCells; use super::Visible; -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml, xml_read_loop}; use crate::structs::EnumValue; use crate::traits::AdjustmentCoordinate; use crate::traits::AdjustmentValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -34,6 +34,7 @@ pub struct ClientData { impl ClientData { #[inline] + #[must_use] pub fn get_object_type(&self) -> &ObjectValues { self.object_type.get_value() } @@ -45,6 +46,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_move_with_cells(&self) -> Option<&MoveWithCells> { self.move_with_cells.as_ref() } @@ -61,6 +63,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_resize_with_cells(&self) -> Option<&ResizeWithCells> { self.resize_with_cells.as_ref() } @@ -77,6 +80,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_anchor(&self) -> &Anchor { &self.anchor } @@ -93,6 +97,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_auto_fill(&self) -> Option<&AutoFill> { self.auto_fill.as_ref() } @@ -109,6 +114,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_comment_row_target(&self) -> Option<&CommentRowTarget> { self.comment_row_target.as_ref() } @@ -125,6 +131,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_comment_column_target(&self) -> Option<&CommentColumnTarget> { self.comment_column_target.as_ref() } @@ -141,6 +148,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_visible(&self) -> Option<&Visible> { self.visible.as_ref() } @@ -157,6 +165,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_clipboard_format(&self) -> Option<&ClipboardFormat> { self.clipboard_format.as_ref() } @@ -173,6 +182,7 @@ impl ClientData { } #[inline] + #[must_use] pub fn get_auto_size_picture(&self) -> Option<&AutoSizePicture> { self.auto_size_picture.as_ref() } diff --git a/src/structs/vml/spreadsheet/clipboard_format.rs b/src/structs/vml/spreadsheet/clipboard_format.rs index 5f6dc227..cc901e44 100644 --- a/src/structs/vml/spreadsheet/clipboard_format.rs +++ b/src/structs/vml/spreadsheet/clipboard_format.rs @@ -1,7 +1,7 @@ use super::ClipboardFormatValues; -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::EnumValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct ClipboardFormat { impl ClipboardFormat { #[inline] + #[must_use] pub fn get_value(&self) -> &ClipboardFormatValues { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/comment_column_target.rs b/src/structs/vml/spreadsheet/comment_column_target.rs index 8b1f6419..6862fb2b 100644 --- a/src/structs/vml/spreadsheet/comment_column_target.rs +++ b/src/structs/vml/spreadsheet/comment_column_target.rs @@ -1,8 +1,10 @@ -use crate::helper::coordinate::*; -use crate::reader::driver::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, is_remove_coordinate, +}; +use crate::reader::driver::xml_read_loop; use crate::structs::UInt32Value; use crate::traits::AdjustmentValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +17,7 @@ pub struct CommentColumnTarget { impl CommentColumnTarget { #[inline] + #[must_use] pub fn get_value(&self) -> u32 { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/comment_row_target.rs b/src/structs/vml/spreadsheet/comment_row_target.rs index 0c0f68e0..e05b36e4 100644 --- a/src/structs/vml/spreadsheet/comment_row_target.rs +++ b/src/structs/vml/spreadsheet/comment_row_target.rs @@ -1,8 +1,10 @@ -use crate::helper::coordinate::*; -use crate::reader::driver::*; +use crate::helper::coordinate::{ + adjustment_insert_coordinate, adjustment_remove_coordinate, is_remove_coordinate, +}; +use crate::reader::driver::xml_read_loop; use crate::structs::UInt32Value; use crate::traits::AdjustmentValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -15,6 +17,7 @@ pub struct CommentRowTarget { impl CommentRowTarget { #[inline] + #[must_use] pub fn get_value(&self) -> u32 { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/move_with_cells.rs b/src/structs/vml/spreadsheet/move_with_cells.rs index ba6615d4..107438d7 100644 --- a/src/structs/vml/spreadsheet/move_with_cells.rs +++ b/src/structs/vml/spreadsheet/move_with_cells.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::TrueFalseBlankValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct MoveWithCells { impl MoveWithCells { #[inline] + #[must_use] pub fn get_value(&self) -> Option { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/resize_with_cells.rs b/src/structs/vml/spreadsheet/resize_with_cells.rs index fb597caf..8bd7e1ac 100644 --- a/src/structs/vml/spreadsheet/resize_with_cells.rs +++ b/src/structs/vml/spreadsheet/resize_with_cells.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::TrueFalseBlankValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct ResizeWithCells { impl ResizeWithCells { #[inline] + #[must_use] pub fn get_value(&self) -> Option { self.value.get_value() } diff --git a/src/structs/vml/spreadsheet/visible.rs b/src/structs/vml/spreadsheet/visible.rs index 343711bf..e9a1a246 100644 --- a/src/structs/vml/spreadsheet/visible.rs +++ b/src/structs/vml/spreadsheet/visible.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::xml_read_loop; use crate::structs::TrueFalseBlankValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct Visible { impl Visible { #[inline] + #[must_use] pub fn get_value(&self) -> Option { self.value.get_value() } diff --git a/src/structs/vml/stroke.rs b/src/structs/vml/stroke.rs index 02c953ff..d6550917 100644 --- a/src/structs/vml/stroke.rs +++ b/src/structs/vml/stroke.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -14,6 +14,7 @@ pub struct Stroke { } impl Stroke { + #[must_use] pub fn get_color(&self) -> &str { self.color.get_value_str() } @@ -23,6 +24,7 @@ impl Stroke { self } + #[must_use] pub fn get_color_2(&self) -> &str { self.color_2.get_value_str() } @@ -32,6 +34,7 @@ impl Stroke { self } + #[must_use] pub fn get_dash_style(&self) -> &str { self.dash_style.get_value_str() } diff --git a/src/structs/vml/text_box.rs b/src/structs/vml/text_box.rs index 1ea5c589..865e89aa 100644 --- a/src/structs/vml/text_box.rs +++ b/src/structs/vml/text_box.rs @@ -1,6 +1,6 @@ -use crate::reader::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; use crate::structs::StringValue; -use crate::writer::driver::*; +use crate::writer::driver::{write_end_tag, write_start_tag, write_text_node_no_escape}; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; @@ -23,6 +23,7 @@ impl Default for TextBox { } impl TextBox { + #[must_use] pub fn get_style(&self) -> &str { self.style.get_value_str() } @@ -32,6 +33,7 @@ impl TextBox { self } + #[must_use] pub fn get_innder(&self) -> &str { self.innder.get_value_str() } @@ -49,7 +51,7 @@ impl TextBox { set_string_from_xml!(self, e, style, "style"); let mut buf = Vec::new(); - let mut inner_text = String::from(""); + let mut inner_text = String::new(); reader.config_mut().check_end_names = false; loop { match reader.read_event_into(&mut buf) { @@ -69,9 +71,9 @@ impl TextBox { } }); for (key, value) in &attrs { - tag = format!("{} {}=\"{}\"", tag, key, value); + tag = format!("{tag} {key}=\"{value}\""); } - inner_text = format!("{}<{}/>", inner_text, tag); + inner_text = format!("{inner_text}<{tag}/>"); } Ok(Event::Start(ref e)) => { let mut tag = std::str::from_utf8(e.name().into_inner()) @@ -89,20 +91,20 @@ impl TextBox { } }); for (key, value) in &attrs { - tag = format!("{} {}=\"{}\"", tag, key, value); + tag = format!("{tag} {key}=\"{value}\""); } - inner_text = format!("{}<{}>", inner_text, tag); + inner_text = format!("{inner_text}<{tag}>"); } Ok(Event::Text(ref e)) => { let s = e.unescape().unwrap().to_string(); - inner_text = format!("{}{}", inner_text, s); + inner_text = format!("{inner_text}{s}"); } Ok(Event::End(ref e)) => { if e.name().into_inner() == b"v:textbox" { break; } let s = std::str::from_utf8(e.name().into_inner()).unwrap(); - inner_text = format!("{}", inner_text, s); + inner_text = format!("{inner_text}"); } Ok(Event::Eof) => break, Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e), diff --git a/src/structs/workbook_protection.rs b/src/structs/workbook_protection.rs index e790e8c9..b1ecdc1f 100644 --- a/src/structs/workbook_protection.rs +++ b/src/structs/workbook_protection.rs @@ -2,9 +2,9 @@ use super::BooleanValue; use super::StringValue; use super::UInt32Value; -use crate::helper::crypt::*; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::helper::crypt::{encrypt_revisions_protection, encrypt_workbook_protection}; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -28,6 +28,7 @@ pub struct WorkbookProtection { } impl WorkbookProtection { #[inline] + #[must_use] pub fn get_workbook_algorithm_name(&self) -> &str { self.workbook_algorithm_name.get_value_str() } @@ -39,6 +40,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_workbook_hash_value(&self) -> &str { self.workbook_hash_value.get_value_str() } @@ -50,6 +52,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_workbook_salt_value(&self) -> &str { self.workbook_salt_value.get_value_str() } @@ -61,6 +64,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_workbook_spin_count(&self) -> u32 { self.workbook_spin_count.get_value() } @@ -72,6 +76,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_workbook_password_raw(&self) -> &str { self.workbook_password.get_value_str() } @@ -89,6 +94,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_revisions_algorithm_name(&self) -> &str { self.revisions_algorithm_name.get_value_str() } @@ -100,6 +106,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_revisions_hash_value(&self) -> &str { self.revisions_hash_value.get_value_str() } @@ -111,6 +118,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_revisions_salt_value(&self) -> &str { self.revisions_salt_value.get_value_str() } @@ -122,6 +130,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_revisions_spin_count(&self) -> u32 { self.revisions_spin_count.get_value() } @@ -133,6 +142,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_revisions_password_raw(&self) -> &str { self.revisions_password.get_value_str() } @@ -150,6 +160,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_lock_revision(&self) -> bool { self.lock_revision.get_value() } @@ -161,6 +172,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_lock_structure(&self) -> bool { self.lock_structure.get_value() } @@ -172,6 +184,7 @@ impl WorkbookProtection { } #[inline] + #[must_use] pub fn get_lock_windows(&self) -> bool { self.lock_windows.get_value() } diff --git a/src/structs/workbook_view.rs b/src/structs/workbook_view.rs index 33b03a55..b2cd69d7 100644 --- a/src/structs/workbook_view.rs +++ b/src/structs/workbook_view.rs @@ -1,6 +1,6 @@ use super::UInt32Value; -use crate::reader::driver::*; -use crate::writer::driver::*; +use crate::reader::driver::{get_attribute, set_string_from_xml}; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct WorkbookView { impl WorkbookView { #[inline] + #[must_use] pub fn get_active_tab(&self) -> u32 { self.active_tab.get_value() } @@ -29,7 +30,7 @@ impl WorkbookView { _reader: &mut Reader, e: &BytesStart, ) { - set_string_from_xml!(self, e, active_tab, "activeTab") + set_string_from_xml!(self, e, active_tab, "activeTab"); } pub(crate) fn write_to(&self, writer: &mut Writer>>) { diff --git a/src/structs/worksheet.rs b/src/structs/worksheet.rs index 33e5ca74..ce494334 100644 --- a/src/structs/worksheet.rs +++ b/src/structs/worksheet.rs @@ -1,7 +1,9 @@ -use crate::helper::const_str::*; -use crate::helper::coordinate::*; -use crate::helper::range::*; -use crate::reader::xlsx::worksheet::*; +use crate::helper::const_str::PIVOT_CACHE_DEF_NS; +use crate::helper::coordinate::{ + column_index_from_string, coordinate_from_index, string_from_column_index, CellCoordinates, +}; +use crate::helper::range::{get_coordinate_list, get_start_and_end_point}; +use crate::reader::xlsx::worksheet::read_lite; use crate::structs::drawing::spreadsheet::WorksheetDrawing; use crate::structs::office2010::excel::DataValidations as DataValidations2010; use crate::structs::raw::RawWorksheet; @@ -112,7 +114,7 @@ impl Worksheet { let CellCoordinates { col, row } = coordinate.into(); self.get_cell((col, row)) .map(|v| v.get_value().into()) - .unwrap_or("".into()) + .unwrap_or_default() } /// Get value number. @@ -134,7 +136,7 @@ impl Worksheet { T: Into, { let CellCoordinates { col, row } = coordinate.into(); - self.get_cell((col, row)).and_then(|v| v.get_value_number()) + self.get_cell((col, row)).and_then(Cell::get_value_number) } /// Get formatted value. @@ -165,11 +167,13 @@ impl Worksheet { // ************************ /// Get Cell List. #[inline] + #[must_use] pub fn get_cell_collection(&self) -> Vec<&Cell> { self.cell_collection.get_collection() } #[inline] + #[must_use] pub fn get_cell_collection_sorted(&self) -> Vec<&Cell> { self.cell_collection.get_collection_sorted() } @@ -181,6 +185,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_collection_to_hashmap(&self) -> &HashMap<(u32, u32), Box> { self.cell_collection.get_collection_to_hashmap() } @@ -268,22 +273,26 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_collection_by_column(&self, column_num: u32) -> Vec<&Cell> { self.cell_collection.get_collection_by_column(column_num) } #[inline] + #[must_use] pub fn get_collection_by_row(&self, row_num: u32) -> Vec<&Cell> { self.cell_collection.get_collection_by_row(row_num) } #[inline] + #[must_use] pub fn get_collection_by_column_to_hashmap(&self, column_num: u32) -> HashMap { self.cell_collection .get_collection_by_column_to_hashmap(column_num) } #[inline] + #[must_use] pub fn get_collection_by_row_to_hashmap(&self, row_num: u32) -> HashMap { self.cell_collection .get_collection_by_row_to_hashmap(row_num) @@ -326,7 +335,7 @@ impl Worksheet { /// # Arguments /// * `coordinate` - Specify the coordinates. ex) `"A1"` or `(1, 1)` or `(1, 1)` /// # Return value - /// * `&CellValue` - CellValue. + /// * `&CellValue` - `CellValue`. /// # Examples /// ``` /// let book = umya_spreadsheet::new_file(); @@ -347,7 +356,7 @@ impl Worksheet { /// # Arguments /// * `coordinate` - Specify the coordinates. ex) `"A1"` or `(1, 1)` or `(1, 1)` /// # Return value - /// * `&mut CellValue` - CellValue with mutable. + /// * `&mut CellValue` - `CellValue` with mutable. /// # Examples /// ``` /// let mut book = umya_spreadsheet::new_file(); @@ -368,7 +377,7 @@ impl Worksheet { /// # Arguments /// * `range` - range. ex) "A1:C5" /// # Return value - /// *`Vec<&CellValue>` - CellValue List. + /// *`Vec<&CellValue>` - `CellValue` List. /// # Examples /// ``` /// let mut book = umya_spreadsheet::new_file(); @@ -376,6 +385,7 @@ impl Worksheet { /// let mut cell_value_List = worksheet.get_cell_value_by_range("A1:C5"); /// ``` #[inline] + #[must_use] pub fn get_cell_value_by_range(&self, range: &str) -> Vec<&CellValue> { self.cell_collection.get_cell_value_by_range(range) } @@ -477,6 +487,7 @@ impl Worksheet { // ************************ /// Get Comments #[inline] + #[must_use] pub fn get_comments(&self) -> &[Comment] { &self.comments } @@ -489,6 +500,7 @@ impl Worksheet { /// Get Comments convert to hashmap. #[inline] + #[must_use] pub fn get_comments_to_hashmap(&self) -> HashMap { let mut result = HashMap::default(); for comment in &self.comments { @@ -516,6 +528,7 @@ impl Worksheet { /// Has Comments. #[inline] + #[must_use] pub fn has_comments(&self) -> bool { !self.comments.is_empty() } @@ -523,15 +536,16 @@ impl Worksheet { // ************************ // Conditional // ************************ - /// Get ConditionalFormatting list. + /// Get `ConditionalFormatting` list. #[inline] + #[must_use] pub fn get_conditional_formatting_collection(&self) -> &[ConditionalFormatting] { &self.conditional_formatting_collection } - /// Set ConditionalFormatting. + /// Set `ConditionalFormatting`. /// # Arguments - /// * `value` - ConditionalSet List (Vec) + /// * `value` - `ConditionalSet` List (Vec) #[inline] pub fn set_conditional_formatting_collection( &mut self, @@ -540,9 +554,9 @@ impl Worksheet { self.conditional_formatting_collection = value.into(); } - /// Add ConditionalFormatting. + /// Add `ConditionalFormatting`. /// # Arguments - /// * `value` - ConditionalFormatting + /// * `value` - `ConditionalFormatting` #[inline] pub fn add_conditional_formatting_collection(&mut self, value: ConditionalFormatting) { self.conditional_formatting_collection.push(value); @@ -579,6 +593,7 @@ impl Worksheet { // ************************ // Get Merge Cells #[inline] + #[must_use] pub fn get_merge_cells(&self) -> &[Range] { self.merge_cells.get_range_collection() } @@ -623,6 +638,7 @@ impl Worksheet { // ************************ // Get Auto Filter (Option). #[inline] + #[must_use] pub fn get_auto_filter(&self) -> Option<&AutoFilter> { self.auto_filter.as_ref() } @@ -660,6 +676,7 @@ impl Worksheet { // ************************ /// Get Column Dimension List. #[inline] + #[must_use] pub fn get_column_dimensions(&self) -> &[Column] { self.column_dimensions.get_column_collection() } @@ -684,6 +701,7 @@ impl Worksheet { /// # Arguments /// * `column` - Column Char. ex) "A" #[inline] + #[must_use] pub fn get_column_dimension(&self, column: &str) -> Option<&Column> { let column_upper = column.to_uppercase(); let col = column_index_from_string(column_upper); @@ -704,6 +722,7 @@ impl Worksheet { /// # Arguments /// * `col` - Column Number. #[inline] + #[must_use] pub fn get_column_dimension_by_number(&self, col: u32) -> Option<&Column> { self.get_column_dimensions_crate().get_column(col) } @@ -742,12 +761,14 @@ impl Worksheet { // Row Dimensions // ************************ #[inline] + #[must_use] pub fn has_sheet_data(&self) -> bool { self.row_dimensions.has_sheet_data() } /// Get Row Dimension List. #[inline] + #[must_use] pub fn get_row_dimensions(&self) -> Vec<&Row> { self.row_dimensions.get_row_dimensions() } @@ -760,6 +781,7 @@ impl Worksheet { /// Get Row Dimension convert Hashmap. #[inline] + #[must_use] pub fn get_row_dimensions_to_hashmap(&self) -> &HashMap> { self.row_dimensions.get_row_dimensions_to_hashmap() } @@ -771,6 +793,7 @@ impl Worksheet { /// Get Row Dimension. #[inline] + #[must_use] pub fn get_row_dimension(&self, row: u32) -> Option<&Row> { self.row_dimensions.get_row_dimension(row) } @@ -806,28 +829,30 @@ impl Worksheet { // ************************ // WorksheetDrawing // ************************ - /// Get WorksheetDrawing. + /// Get `WorksheetDrawing`. #[inline] + #[must_use] pub fn get_worksheet_drawing(&self) -> &WorksheetDrawing { &self.worksheet_drawing } - /// Get WorksheetDrawing in mutable. + /// Get `WorksheetDrawing` in mutable. #[inline] pub fn get_worksheet_drawing_mut(&mut self) -> &mut WorksheetDrawing { &mut self.worksheet_drawing } - /// Set WorksheetDrawing. + /// Set `WorksheetDrawing`. /// # Arguments - /// * `value` - WorksheetDrawing + /// * `value` - `WorksheetDrawing` #[inline] pub fn set_worksheet_drawing(&mut self, value: WorksheetDrawing) { self.worksheet_drawing = value; } - /// Has WorksheetDrawing. + /// Has `WorksheetDrawing`. #[inline] + #[must_use] pub fn has_drawing_object(&self) -> bool { self.worksheet_drawing.has_drawing_object() } @@ -1009,6 +1034,7 @@ impl Worksheet { /// Get Code Name. #[inline] + #[must_use] pub fn get_code_name(&self) -> Option<&str> { self.code_name.get_value() } @@ -1023,6 +1049,7 @@ impl Worksheet { /// Get Header Footer. #[inline] + #[must_use] pub fn get_header_footer(&self) -> &HeaderFooter { &self.header_footer } @@ -1044,6 +1071,7 @@ impl Worksheet { /// Get Active Cell. #[inline] + #[must_use] pub fn get_active_cell(&self) -> &str { &self.active_cell } @@ -1071,6 +1099,7 @@ impl Worksheet { /// Get Sheet Id. #[inline] + #[must_use] pub fn get_sheet_id(&self) -> &str { &self.sheet_id } @@ -1084,12 +1113,14 @@ impl Worksheet { /// Has Code Name. #[inline] + #[must_use] pub fn has_code_name(&self) -> bool { self.code_name.has_value() } /// Get Tab Color. #[inline] + #[must_use] pub fn get_tab_color(&self) -> Option<&Color> { self.tab_color.as_ref() } @@ -1121,25 +1152,28 @@ impl Worksheet { } /// Calculate Worksheet Dimension. + #[must_use] pub fn calculate_worksheet_dimension(&self) -> String { let (column, row) = self.cell_collection.get_highest_column_and_row(); if row == 0 { return "A1".to_string(); } let column_str = string_from_column_index(column); - format!("A1:{}{}", column_str, row) + format!("A1:{column_str}{row}") } // Get Highest Column and Row Index /// # Return value /// *`(u32, u32)` - (column, row) #[inline] + #[must_use] pub fn get_highest_column_and_row(&self) -> (u32, u32) { self.cell_collection.get_highest_column_and_row() } // Get Highest Column Index #[inline] + #[must_use] pub fn get_highest_column(&self) -> u32 { let (column, _row) = self.cell_collection.get_highest_column_and_row(); column @@ -1147,18 +1181,20 @@ impl Worksheet { // Get Highest Row Index #[inline] + #[must_use] pub fn get_highest_row(&self) -> u32 { let (_column, row) = self.cell_collection.get_highest_column_and_row(); row } - /// Get SheetName. + /// Get `SheetName`. #[inline] + #[must_use] pub fn get_name(&self) -> &str { &self.title } - /// Set SheetName. + /// Set `SheetName`. /// # Arguments /// * `sheet_name` - Sheet Name. [Caution] no duplicate other worksheet. pub fn set_name>(&mut self, sheet_name: S) -> &mut Self { @@ -1176,6 +1212,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_state(&self) -> &SheetStateValues { self.state.get_value() } @@ -1198,6 +1235,7 @@ impl Worksheet { // Get Sheet State #[inline] + #[must_use] pub fn get_sheet_state(&self) -> &str { &self.sheet_state } @@ -1213,6 +1251,7 @@ impl Worksheet { // Get Page Setup. #[inline] + #[must_use] pub fn get_page_setup(&self) -> &PageSetup { &self.page_setup } @@ -1225,7 +1264,7 @@ impl Worksheet { /// Set Page Setup. /// # Arguments - /// * `value` - PageSetup. + /// * `value` - `PageSetup`. #[inline] pub fn set_page_setup(&mut self, value: PageSetup) -> &mut Self { self.page_setup = value; @@ -1234,6 +1273,7 @@ impl Worksheet { // Get Page Margins. #[inline] + #[must_use] pub fn get_page_margins(&self) -> &PageMargins { &self.page_margins } @@ -1246,7 +1286,7 @@ impl Worksheet { /// Set Page Margins. /// # Arguments - /// * `value` - PageMargins. + /// * `value` - `PageMargins`. #[inline] pub fn set_page_margins(&mut self, value: PageMargins) -> &mut Self { self.page_margins = value; @@ -1255,6 +1295,7 @@ impl Worksheet { // Get SheetViews. #[inline] + #[must_use] pub fn get_sheets_views(&self) -> &SheetViews { &self.sheet_views } @@ -1265,9 +1306,9 @@ impl Worksheet { &mut self.sheet_views } - /// Set SheetViews. + /// Set `SheetViews`. /// # Arguments - /// * `value` - SheetViews. + /// * `value` - `SheetViews`. #[inline] pub fn set_sheets_views(&mut self, value: SheetViews) -> &mut Self { self.sheet_views = value; @@ -1276,6 +1317,7 @@ impl Worksheet { // Get Ole Objects. #[inline] + #[must_use] pub fn get_ole_objects(&self) -> &OleObjects { &self.ole_objects } @@ -1288,7 +1330,7 @@ impl Worksheet { /// Set Ole Objects. /// # Arguments - /// * `value` - OleObjects. + /// * `value` - `OleObjects`. #[inline] pub fn set_ole_objects(&mut self, value: OleObjects) -> &mut Self { self.ole_objects = value; @@ -1297,6 +1339,7 @@ impl Worksheet { /// Get Defined Name (Vec). #[inline] + #[must_use] pub fn get_defined_names(&self) -> &[DefinedName] { &self.defined_names } @@ -1317,7 +1360,7 @@ impl Worksheet { /// Add Defined Name. /// # Arguments - /// * `value` - DefinedName. + /// * `value` - `DefinedName`. #[inline] pub fn add_defined_names(&mut self, value: DefinedName) { self.defined_names.push(value); @@ -1325,7 +1368,7 @@ impl Worksheet { /// Add Defined Name. /// # Arguments - /// * `name` - Name. ex) "DefinedName01" + /// * `name` - Name. ex) "`DefinedName01`" /// * `address` - Address. ex) "A1:A2" #[inline] pub fn add_defined_name>(&mut self, name: S, address: S) -> Result<(), &str> { @@ -1338,6 +1381,7 @@ impl Worksheet { /// Get Print Options. #[inline] + #[must_use] pub fn get_print_options(&self) -> &PrintOptions { &self.print_options } @@ -1350,7 +1394,7 @@ impl Worksheet { /// Set Print Options. /// # Arguments - /// * `value` - PrintOptions. + /// * `value` - `PrintOptions`. #[inline] pub fn set_print_options(&mut self, value: PrintOptions) -> &mut Self { self.print_options = value; @@ -1359,6 +1403,7 @@ impl Worksheet { /// Get Column Breaks. #[inline] + #[must_use] pub fn get_column_breaks(&self) -> &ColumnBreaks { &self.column_breaks } @@ -1371,7 +1416,7 @@ impl Worksheet { /// Set Column Breaks. /// # Arguments - /// * `value` - ColumnBreaks. + /// * `value` - `ColumnBreaks`. #[inline] pub fn set_column_breaks(&mut self, value: ColumnBreaks) -> &mut Self { self.column_breaks = value; @@ -1380,6 +1425,7 @@ impl Worksheet { /// Get Row Breaks. #[inline] + #[must_use] pub fn get_row_breaks(&self) -> &RowBreaks { &self.row_breaks } @@ -1392,7 +1438,7 @@ impl Worksheet { /// Set Row Breaks. /// # Arguments - /// * `value` - RowBreaks. + /// * `value` - `RowBreaks`. #[inline] pub fn set_row_breaks(&mut self, value: RowBreaks) -> &mut Self { self.row_breaks = value; @@ -1400,6 +1446,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn has_table(&self) -> bool { !self.tables.is_empty() } @@ -1410,6 +1457,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_tables(&self) -> &[Table] { &self.tables } @@ -1420,6 +1468,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn has_pivot_table(&self) -> bool { !self.pivot_tables.is_empty() } @@ -1430,6 +1479,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_pivot_tables(&self) -> &[PivotTable] { &self.pivot_tables } @@ -1440,6 +1490,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_data_validations(&self) -> Option<&DataValidations> { self.data_validations.as_ref() } @@ -1462,6 +1513,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_data_validations_2010(&self) -> Option<&DataValidations2010> { self.data_validations_2010.as_ref() } @@ -1484,6 +1536,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_sheet_format_properties(&self) -> &SheetFormatProperties { &self.sheet_format_properties } @@ -1503,6 +1556,7 @@ impl Worksheet { /// # Return value /// * `&Vec` - Image Object List. #[inline] + #[must_use] pub fn get_image_collection(&self) -> &[Image] { self.get_worksheet_drawing().get_image_collection() } @@ -1566,6 +1620,7 @@ impl Worksheet { /// # Return value /// * `&Vec` - Chart Object List. #[inline] + #[must_use] pub fn get_chart_collection(&self) -> &[Chart] { self.get_worksheet_drawing().get_chart_collection() } @@ -1718,6 +1773,7 @@ impl Worksheet { } #[inline] + #[must_use] pub fn get_sheet_protection(&self) -> Option<&SheetProtection> { self.sheet_protection.as_ref() } @@ -1787,18 +1843,10 @@ impl Worksheet { // impossible) let range_upper = range.to_uppercase(); let (row_start, row_end, col_start, col_end) = get_start_and_end_point(&range_upper); - if (col_start as i32 + column) < 1 { - panic!("Out of Range."); - } - if (row_start as i32 + row) < 1 { - panic!("Out of Range."); - } - if (col_end as i32 + column) > 16384 { - panic!("Out of Range."); - } - if (row_end as i32 + row) > 1048576 { - panic!("Out of Range."); - } + assert!(((col_start as i32 + column) >= 1), "Out of Range."); + assert!(((row_start as i32 + row) >= 1), "Out of Range."); + assert!(((col_end as i32 + column) <= 16384), "Out of Range."); + assert!(((row_end as i32 + row) <= 1048576), "Out of Range."); // Iterate row by row, collecting cell information (do I copy) let cells = self.cell_collection.get_cell_by_range(range); @@ -1806,15 +1854,13 @@ impl Worksheet { // Delete cell information as iterating through in move mode if is_move { - get_coordinate_list(&range_upper) - .iter() - .for_each(|(col_num, row_num)| { - self.cell_collection.remove(*col_num, *row_num); - self.cell_collection.remove( - (*col_num as i32 + column) as u32, - (*row_num as i32 + row) as u32, - ); - }); + for (col_num, row_num) in &get_coordinate_list(&range_upper) { + self.cell_collection.remove(*col_num, *row_num); + self.cell_collection.remove( + (*col_num as i32 + column) as u32, + (*row_num as i32 + row) as u32, + ); + } } // repaste by setting cell values diff --git a/src/structs/worksheet_source.rs b/src/structs/worksheet_source.rs index 326b89c6..20efac5e 100644 --- a/src/structs/worksheet_source.rs +++ b/src/structs/worksheet_source.rs @@ -1,7 +1,7 @@ // worksheetSource -use crate::reader::driver::*; +use crate::reader::driver::get_attribute; use crate::structs::Address; -use crate::writer::driver::*; +use crate::writer::driver::write_start_tag; use quick_xml::events::BytesStart; use quick_xml::Reader; use quick_xml::Writer; @@ -13,6 +13,7 @@ pub struct WorksheetSource { } impl WorksheetSource { + #[must_use] pub fn get_address(&self) -> &Address { &self.address } diff --git a/src/structs/writer_manager.rs b/src/structs/writer_manager.rs index 3ee97e18..73d84ea9 100644 --- a/src/structs/writer_manager.rs +++ b/src/structs/writer_manager.rs @@ -1,7 +1,12 @@ -use crate::helper::const_str::*; +use crate::helper::const_str::{ + CHART_TYPE, COMMENTS_TYPE, CORE_PROPS_TYPE, CUSTOM_PROPS_TYPE, DRAWING_TYPE, OLE_OBJECT_TYPE, + PKG_CHARTS, PKG_DRAWINGS, PKG_EMBEDDINGS, PKG_PRNTR_SETTINGS, PKG_TABLES, SHARED_STRINGS_TYPE, + SHEET_TYPE, STYLES_TYPE, TABLE_TYPE, THEME_TYPE, VBA_TYPE, WORKBOOK_MACRO_TYPE, WORKBOOK_TYPE, + XPROPS_TYPE, +}; use crate::structs::Spreadsheet; use crate::structs::XlsxError; -use crate::writer::driver::*; +use crate::writer::driver::{make_file_from_bin, make_file_from_writer}; use quick_xml::Writer; use std::io; use std::io::Cursor; @@ -30,11 +35,13 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { } #[inline] + #[must_use] pub fn get_is_light(&self) -> bool { self.is_light } #[inline] + #[must_use] pub fn get_num_tables(&self) -> i32 { self.table_no } @@ -91,7 +98,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/drawing{}.xml", PKG_DRAWINGS, index); + let file_path = format!("{PKG_DRAWINGS}/drawing{index}.xml"); if !self.check_file_exist(&file_path) { self.add_writer(&file_path, writer)?; return Ok(index); @@ -106,7 +113,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/vmlDrawing{}.vml", PKG_DRAWINGS, index); + let file_path = format!("{PKG_DRAWINGS}/vmlDrawing{index}.vml"); if !self.check_file_exist(&file_path) { self.add_writer(&file_path, writer)?; return Ok(index); @@ -121,7 +128,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("xl/comments{}.xml", index); + let file_path = format!("xl/comments{index}.xml"); if !self.check_file_exist(&file_path) { self.add_writer(&file_path, writer)?; return Ok(index); @@ -136,7 +143,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/chart{}.xml", PKG_CHARTS, index); + let file_path = format!("{PKG_CHARTS}/chart{index}.xml"); if !self.check_file_exist(&file_path) { self.add_writer(&file_path, writer)?; return Ok(index); @@ -148,7 +155,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/oleObject{}.bin", PKG_EMBEDDINGS, index); + let file_path = format!("{PKG_EMBEDDINGS}/oleObject{index}.bin"); if !self.check_file_exist(&file_path) { self.add_bin(&file_path, writer)?; return Ok(index); @@ -160,7 +167,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/Microsoft_Excel_Worksheet{}.xlsx", PKG_EMBEDDINGS, index); + let file_path = format!("{PKG_EMBEDDINGS}/Microsoft_Excel_Worksheet{index}.xlsx"); if !self.check_file_exist(&file_path) { self.add_bin(&file_path, writer)?; return Ok(index); @@ -172,7 +179,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut index = 0; loop { index += 1; - let file_path = format!("{}/printerSettings{}.bin", PKG_PRNTR_SETTINGS, index); + let file_path = format!("{PKG_PRNTR_SETTINGS}/printerSettings{index}.bin"); if !self.check_file_exist(&file_path) { self.add_bin(&file_path, writer)?; return Ok(index); @@ -186,14 +193,14 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { writer: Writer>>, table_no: i32, ) -> Result { - let file_path = format!("{}/table{}.xml", PKG_TABLES, table_no); + let file_path = format!("{PKG_TABLES}/table{table_no}.xml"); self.add_writer(&file_path, writer)?; Ok(table_no) } #[inline] pub(crate) fn has_extension(&self, extension: &str) -> bool { - let extension = format!(".{}", extension); + let extension = format!(".{extension}"); self.files.iter().any(|file| file.ends_with(&extension)) } @@ -205,7 +212,7 @@ impl<'a, W: io::Seek + io::Write> WriterManager<'a, W> { let mut list: Vec<(String, String)> = Vec::new(); for file in &self.files { - let file = format!("/{}", file); + let file = format!("/{file}"); let mut content_type = ""; // Override workbook diff --git a/src/writer/csv.rs b/src/writer/csv.rs index 110f0517..b0ee143a 100644 --- a/src/writer/csv.rs +++ b/src/writer/csv.rs @@ -25,14 +25,14 @@ pub fn write_writer( // get max column and row. let (max_column, max_row) = worksheet.get_highest_column_and_row(); - let mut data = String::from(""); + let mut data = String::new(); for row in 0u32..max_row { let mut row_vec: Vec = Vec::new(); for column in 0u32..max_column { // get value. let mut value = match worksheet.get_cell((column + 1, row + 1)) { Some(cell) => cell.get_cell_value().get_value().into(), - None => String::from(""), + None => String::new(), }; // do trim. if option.get_do_trim() { @@ -83,7 +83,7 @@ pub fn write_writer( /// option.set_csv_encode_value(structs::CsvEncodeValues::ShiftJis); /// option.set_do_trim(true); /// option.set_wrap_with_char("\""); -/// let _ = writer::csv::write(&book, path, Some(&option)); +/// let _unused = writer::csv::write(&book, path, Some(&option)); /// ``` pub fn write>( spreadsheet: &Spreadsheet, @@ -101,7 +101,7 @@ pub fn write>( }; if let Err(v) = write_writer( spreadsheet, - &mut io::BufWriter::new(fs::File::create(path_tmp.as_ref() as &Path)?), + &mut io::BufWriter::new(fs::File::create::<&Path>(path_tmp.as_ref())?), option, ) { fs::remove_file(path_tmp)?; diff --git a/src/writer/driver.rs b/src/writer/driver.rs index 85047dfb..7af4ea9c 100644 --- a/src/writer/driver.rs +++ b/src/writer/driver.rs @@ -1,4 +1,4 @@ -use quick_xml::escape::*; +use quick_xml::escape::partial_escape; use quick_xml::events::{BytesEnd, BytesStart, BytesText, Event}; use quick_xml::Writer; use std::borrow::Cow; @@ -69,7 +69,7 @@ pub(crate) fn write_new_line(writer: &mut Writer>>) { } #[inline] -pub(crate) fn make_file_from_writer( +pub(crate) fn make_file_from_writer( path: &str, arv: &mut zip::ZipWriter, writer: Writer>>, @@ -80,7 +80,7 @@ pub(crate) fn make_file_from_writer( } #[inline] -pub(crate) fn make_file_from_bin( +pub(crate) fn make_file_from_bin( path: &str, arv: &mut zip::ZipWriter, writer: &[u8], @@ -99,7 +99,7 @@ pub(crate) fn make_file_from_bin( #[inline] pub(crate) fn to_path<'a>(path: &'a str, dir: Option<&'a str>) -> Cow<'a, str> { match dir { - Some(dir) => Cow::Owned(format!("{}/{}", dir, path)), + Some(dir) => Cow::Owned(format!("{dir}/{path}")), None => Cow::Borrowed(path), } } diff --git a/src/writer/xlsx.rs b/src/writer/xlsx.rs index 345240f3..dd8883ac 100644 --- a/src/writer/xlsx.rs +++ b/src/writer/xlsx.rs @@ -1,5 +1,5 @@ use super::driver; -use crate::helper::crypt::*; +use crate::helper::crypt::encrypt; use crate::structs::Spreadsheet; use crate::structs::WriterManager; use crate::XlsxError; @@ -33,8 +33,8 @@ mod workbook_rels; mod worksheet; mod worksheet_rels; -fn make_buffer(spreadsheet: &Spreadsheet, is_light: bool) -> Result, XlsxError> { - let mut arv = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); +fn make_buffer(spreadsheet: &Spreadsheet, is_light: bool) -> Result, XlsxError> { + let mut arv = zip::ZipWriter::new(io::Cursor::new(Vec::new())); let mut writer_manager = WriterManager::new(&mut arv); writer_manager.set_is_light(is_light); @@ -128,7 +128,7 @@ fn make_buffer(spreadsheet: &Spreadsheet, is_light: bool) -> Result printer_settings::write(worksheet, &mut writer_manager)?, - None => String::from(""), + None => String::new(), }; // Add tables @@ -213,7 +213,7 @@ pub fn write_writer_light( /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let path = std::path::Path::new("./tests/result_files/zzz.xlsx"); -/// let _ = umya_spreadsheet::writer::xlsx::write(&book, path); +/// let _unused = umya_spreadsheet::writer::xlsx::write(&book, path); /// ``` pub fn write>(spreadsheet: &Spreadsheet, path: P) -> Result<(), XlsxError> { let extension = path.as_ref().extension().unwrap().to_str().unwrap(); @@ -222,7 +222,7 @@ pub fn write>(spreadsheet: &Spreadsheet, path: P) -> Result<(), X .with_extension(format!("{}{}", extension, "tmp")); if let Err(v) = write_writer( spreadsheet, - &mut io::BufWriter::new(fs::File::create(&path_tmp)?), + &mut io::BufWriter::new(File::create(&path_tmp)?), ) { fs::remove_file(path_tmp)?; return Err(v); @@ -241,7 +241,7 @@ pub fn write>(spreadsheet: &Spreadsheet, path: P) -> Result<(), X /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let path = std::path::Path::new("./tests/result_files/zzz.xlsx"); -/// let _ = umya_spreadsheet::writer::xlsx::write_light(&book, path); +/// let _unused = umya_spreadsheet::writer::xlsx::write_light(&book, path); /// ``` pub fn write_light>(spreadsheet: &Spreadsheet, path: P) -> Result<(), XlsxError> { let extension = path.as_ref().extension().unwrap().to_str().unwrap(); @@ -250,7 +250,7 @@ pub fn write_light>(spreadsheet: &Spreadsheet, path: P) -> Result .with_extension(format!("{}{}", extension, "tmp")); if let Err(v) = write_writer_light( spreadsheet, - &mut io::BufWriter::new(fs::File::create(&path_tmp)?), + &mut io::BufWriter::new(File::create(&path_tmp)?), ) { fs::remove_file(path_tmp)?; return Err(v); @@ -270,7 +270,7 @@ pub fn write_light>(spreadsheet: &Spreadsheet, path: P) -> Result /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let path = std::path::Path::new("./tests/result_files/zzz_password.xlsx"); -/// let _ = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password"); +/// let _unused = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password"); /// ``` pub fn write_with_password>( spreadsheet: &Spreadsheet, @@ -307,7 +307,7 @@ pub fn write_with_password>( /// ``` /// let mut book = umya_spreadsheet::new_file(); /// let path = std::path::Path::new("./tests/result_files/zzz_password.xlsx"); -/// let _ = umya_spreadsheet::writer::xlsx::write_with_password_light(&book, path, "password"); +/// let _unused = umya_spreadsheet::writer::xlsx::write_with_password_light(&book, path, "password"); /// ``` pub fn write_with_password_light>( spreadsheet: &Spreadsheet, @@ -344,7 +344,7 @@ pub fn write_with_password_light>( /// ``` /// let from_path = std::path::Path::new("./tests/test_files/aaa.xlsx"); /// let to_path = std::path::Path::new("./tests/result_files/zzz_password2.xlsx"); -/// let _ = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password"); +/// let _unused = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password"); /// ``` pub fn set_password>( from_path: P, diff --git a/src/writer/xlsx/chart.rs b/src/writer/xlsx/chart.rs index e11ddc88..6eb8124c 100644 --- a/src/writer/xlsx/chart.rs +++ b/src/writer/xlsx/chart.rs @@ -1,4 +1,4 @@ -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; use crate::structs::drawing::charts::ChartSpace; use crate::structs::Spreadsheet; diff --git a/src/writer/xlsx/comment.rs b/src/writer/xlsx/comment.rs index b54430f7..0ac20ccf 100644 --- a/src/writer/xlsx/comment.rs +++ b/src/writer/xlsx/comment.rs @@ -1,6 +1,6 @@ -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag, write_text_node}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::SHEET_MAIN_NS; use crate::structs::Worksheet; use crate::structs::WriterManager; use quick_xml::events::{BytesDecl, Event}; diff --git a/src/writer/xlsx/content_types.rs b/src/writer/xlsx/content_types.rs index 966b48c5..ec1920e2 100644 --- a/src/writer/xlsx/content_types.rs +++ b/src/writer/xlsx/content_types.rs @@ -2,9 +2,11 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{make_file_from_writer, write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{ + CONTENT_TYPES, CONTYPES_NS, PRNTR_SETTINGS_TYPE, REL_TYPE, VML_DRAWING_TYPE, WORKBOOK, +}; use crate::structs::Spreadsheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/doc_props_app.rs b/src/writer/xlsx/doc_props_app.rs index ba42457e..212f1889 100644 --- a/src/writer/xlsx/doc_props_app.rs +++ b/src/writer/xlsx/doc_props_app.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_APP; use crate::structs::Spreadsheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/doc_props_core.rs b/src/writer/xlsx/doc_props_core.rs index 63e7746d..c020dea0 100644 --- a/src/writer/xlsx/doc_props_core.rs +++ b/src/writer/xlsx/doc_props_core.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_CORE; use crate::structs::Spreadsheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/doc_props_custom.rs b/src/writer/xlsx/doc_props_custom.rs index 725f549c..1bb216ee 100644 --- a/src/writer/xlsx/doc_props_custom.rs +++ b/src/writer/xlsx/doc_props_custom.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::ARC_CUSTOM; use crate::structs::Spreadsheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/drawing.rs b/src/writer/xlsx/drawing.rs index 43ed52bd..cf8ea7cd 100644 --- a/src/writer/xlsx/drawing.rs +++ b/src/writer/xlsx/drawing.rs @@ -2,7 +2,7 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; use crate::structs::Worksheet; use crate::structs::WriterManager; @@ -14,7 +14,7 @@ pub(crate) fn write( let mut rel_list: Vec<(String, String)> = Vec::new(); if !worksheet.has_drawing_object() { - return Ok((String::from(""), rel_list)); + return Ok((String::new(), rel_list)); } let mut writer = Writer::new(io::Cursor::new(Vec::new())); diff --git a/src/writer/xlsx/drawing_rels.rs b/src/writer/xlsx/drawing_rels.rs index 9fb72a5e..80f6a555 100644 --- a/src/writer/xlsx/drawing_rels.rs +++ b/src/writer/xlsx/drawing_rels.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{CHART_NS, IMAGE_NS, PKG_DRAWINGS_RELS, REL_NS}; use crate::structs::Worksheet; use crate::structs::WriterManager; @@ -37,7 +37,7 @@ pub(crate) fn write( &mut writer, r_id, CHART_NS, - format!("../charts/chart{}.xml", chart_no).as_str(), + format!("../charts/chart{chart_no}.xml").as_str(), "", ); r_id += 1; @@ -50,7 +50,7 @@ pub(crate) fn write( &mut writer, r_id, IMAGE_NS, - format!("../media/{}", value).as_str(), + format!("../media/{value}").as_str(), "", ); } @@ -59,7 +59,7 @@ pub(crate) fn write( write_end_tag(&mut writer, "Relationships"); if is_write { - let file_path = format!("{PKG_DRAWINGS_RELS}{}.xml.rels", drawing_no); + let file_path = format!("{PKG_DRAWINGS_RELS}{drawing_no}.xml.rels"); return writer_mng.add_writer(&file_path, writer); } Ok(()) @@ -72,7 +72,7 @@ fn write_relationship( p_target: &str, p_target_mode: &str, ) -> bool { - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); let mut attributes: Vec<(&str, &str)> = Vec::new(); attributes.push(("Id", &r_id_str)); attributes.push(("Type", p_type)); diff --git a/src/writer/xlsx/media.rs b/src/writer/xlsx/media.rs index 61dd7649..62fdc4d1 100644 --- a/src/writer/xlsx/media.rs +++ b/src/writer/xlsx/media.rs @@ -1,7 +1,7 @@ use std::io; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_MEDIA; use crate::structs::Worksheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/rels.rs b/src/writer/xlsx/rels.rs index e1fa3d16..44b093ee 100644 --- a/src/writer/xlsx/rels.rs +++ b/src/writer/xlsx/rels.rs @@ -2,9 +2,12 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{ + ARC_APP, ARC_CORE, ARC_CUSTOM, COREPROPS_REL, CUSTOMUI_NS, CUSTOM_PROPS_REL, OFCDOC_NS, + PKG_WORKBOOK, REL_NS, XPROPS_REL, +}; use crate::structs::Spreadsheet; use crate::structs::WriterManager; @@ -71,7 +74,7 @@ fn write_relationship( ) { let tag_name = "Relationship"; let mut attributes: Vec<(&str, &str)> = Vec::new(); - let r_id = format!("rId{}", p_id); + let r_id = format!("rId{p_id}"); attributes.push(("Id", r_id.as_str())); attributes.push(("Type", p_type)); attributes.push(("Target", p_target)); diff --git a/src/writer/xlsx/shared_strings.rs b/src/writer/xlsx/shared_strings.rs index bc2f5adb..c637993d 100644 --- a/src/writer/xlsx/shared_strings.rs +++ b/src/writer/xlsx/shared_strings.rs @@ -1,19 +1,18 @@ -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_SHARED_STRINGS; use crate::structs::SharedStringTable; use crate::structs::WriterManager; use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use std::result; use std::sync::Arc; use std::sync::RwLock; pub(crate) fn write( shared_string_table: Arc>, writer_mng: &mut WriterManager, -) -> result::Result<(), XlsxError> { +) -> Result<(), XlsxError> { if shared_string_table .read() .unwrap() diff --git a/src/writer/xlsx/styles.rs b/src/writer/xlsx/styles.rs index 9b9a69a1..26ae1c14 100644 --- a/src/writer/xlsx/styles.rs +++ b/src/writer/xlsx/styles.rs @@ -1,6 +1,6 @@ -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_STYLES; use crate::structs::Stylesheet; use crate::structs::WriterManager; use quick_xml::events::{BytesDecl, Event}; diff --git a/src/writer/xlsx/table.rs b/src/writer/xlsx/table.rs index 32183c7c..eaad0329 100644 --- a/src/writer/xlsx/table.rs +++ b/src/writer/xlsx/table.rs @@ -1,7 +1,10 @@ use std::io; -use super::{driver::*, XlsxError}; -use crate::helper::const_str::*; +use super::{ + driver::{write_end_tag, write_new_line, write_start_tag, write_text_node}, + XlsxError, +}; +use crate::helper::const_str::SHEET_MAIN_NS; use crate::structs::{Worksheet, WriterManager}; use quick_xml::{ events::{BytesDecl, Event}, @@ -13,7 +16,7 @@ pub(crate) fn write( writer_mng: &mut WriterManager, ) -> Result, XlsxError> { let mut table_no_list = Vec::::new(); - for table in worksheet.get_tables().iter() { + for table in worksheet.get_tables() { let mut writer = Writer::new(io::Cursor::new(Vec::new())); // XML header @@ -62,7 +65,7 @@ pub(crate) fn write( false, ); let mut col_id = 1; - for col in cols.iter() { + for col in cols { let mut attributes: Vec<(&str, &str)> = Vec::new(); let col_id_str = col_id.to_string(); attributes.push(("id", &col_id_str)); @@ -96,19 +99,19 @@ pub(crate) fn write( ("name", style_info.get_name()), ( "showFirstColumn", - &(style_info.is_show_first_col() as i32).to_string(), + &i32::from(style_info.is_show_first_col()).to_string(), ), ( "showLastColumn", - &(style_info.is_show_last_col() as i32).to_string(), + &i32::from(style_info.is_show_last_col()).to_string(), ), ( "showRowStripes", - &(style_info.is_show_row_stripes() as i32).to_string(), + &i32::from(style_info.is_show_row_stripes()).to_string(), ), ( "showColumnStripes", - &(style_info.is_show_col_stripes() as i32).to_string(), + &i32::from(style_info.is_show_col_stripes()).to_string(), ), ], true, diff --git a/src/writer/xlsx/theme.rs b/src/writer/xlsx/theme.rs index 57164a31..0639253a 100644 --- a/src/writer/xlsx/theme.rs +++ b/src/writer/xlsx/theme.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::write_new_line; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_THEME; use crate::structs::drawing::Theme; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/vba_project_bin.rs b/src/writer/xlsx/vba_project_bin.rs index ddd9dddf..dcdd321c 100644 --- a/src/writer/xlsx/vba_project_bin.rs +++ b/src/writer/xlsx/vba_project_bin.rs @@ -1,7 +1,7 @@ use std::io; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::PKG_VBA_PROJECT; use crate::structs::Spreadsheet; use crate::structs::WriterManager; diff --git a/src/writer/xlsx/vml_drawing.rs b/src/writer/xlsx/vml_drawing.rs index 23707ee5..a7091a31 100644 --- a/src/writer/xlsx/vml_drawing.rs +++ b/src/writer/xlsx/vml_drawing.rs @@ -1,6 +1,6 @@ -use super::driver::*; +use super::driver::{write_end_tag, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{EXCEL_NS, OFFICE_NS, VML_NS}; use crate::structs::Worksheet; use crate::structs::WriterManager; use quick_xml::Writer; @@ -12,7 +12,7 @@ pub(crate) fn write( ) -> Result<(String, Vec<(String, String)>), XlsxError> { let mut rel_list: Vec<(String, String)> = Vec::new(); if !worksheet.has_legacy_drawing() { - return Ok((String::from(""), rel_list)); + return Ok((String::new(), rel_list)); } let mut writer = Writer::new(io::Cursor::new(Vec::new())); diff --git a/src/writer/xlsx/vml_drawing_rels.rs b/src/writer/xlsx/vml_drawing_rels.rs index cf560b4f..2b4a5e1f 100644 --- a/src/writer/xlsx/vml_drawing_rels.rs +++ b/src/writer/xlsx/vml_drawing_rels.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{IMAGE_NS, PKG_VML_DRAWING_RELS, REL_NS}; use crate::structs::Worksheet; use crate::structs::WriterManager; @@ -37,7 +37,7 @@ pub(crate) fn write( &mut writer, r_id, IMAGE_NS, - format!("../media/{}", value).as_str(), + format!("../media/{value}").as_str(), "", ); } @@ -47,7 +47,7 @@ pub(crate) fn write( write_end_tag(&mut writer, "Relationships"); if is_write { - let file_path = format!("{PKG_VML_DRAWING_RELS}{}.vml.rels", vml_drawing_no); + let file_path = format!("{PKG_VML_DRAWING_RELS}{vml_drawing_no}.vml.rels"); return writer_mng.add_writer(&file_path, writer); } Ok(()) @@ -61,7 +61,7 @@ fn write_relationship( p_target_mode: &str, ) -> bool { let tag_name = "Relationship"; - let r_id_str = format!("rId{}", r_id); + let r_id_str = format!("rId{r_id}"); let mut attributes: Vec<(&str, &str)> = Vec::new(); attributes.push(("Id", &r_id_str)); attributes.push(("Type", p_type)); diff --git a/src/writer/xlsx/workbook.rs b/src/writer/xlsx/workbook.rs index 31f8ec6a..4acdbb03 100644 --- a/src/writer/xlsx/workbook.rs +++ b/src/writer/xlsx/workbook.rs @@ -2,9 +2,9 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{PKG_WORKBOOK, REL_OFC_NS, SHEET_MAIN_NS}; use crate::structs::Spreadsheet; use crate::structs::WriterManager; @@ -76,7 +76,7 @@ pub(crate) fn write( for worksheet in spreadsheet.get_sheet_collection_no_check() { let mut attributes: Vec<(&str, &str)> = Vec::new(); let id = index.to_string(); - let r_id = format!("rId{}", index); + let r_id = format!("rId{index}"); attributes.push(("name", worksheet.get_name())); attributes.push(("sheetId", &id)); attributes.push(("r:id", &r_id)); @@ -127,7 +127,7 @@ pub(crate) fn write( if !pivot_cache_definition_collection.is_empty() { write_start_tag(&mut writer, "pivotCaches", vec![], false); for (_, val2, _) in pivot_cache_definition_collection { - let r_id = format!("rId{}", index); + let r_id = format!("rId{index}"); write_start_tag( &mut writer, "pivotCache", diff --git a/src/writer/xlsx/workbook_rels.rs b/src/writer/xlsx/workbook_rels.rs index 12c39db5..a9734652 100644 --- a/src/writer/xlsx/workbook_rels.rs +++ b/src/writer/xlsx/workbook_rels.rs @@ -2,9 +2,12 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{make_file_from_writer, write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{ + PIVOT_CACHE_DEF_NS, PKG_WORKBOOK_RELS, REL_NS, SHARED_STRINGS_NS, STYLES_NS, THEME_NS, + VBA_PROJECT_NS, WORKSHEET_NS, +}; use crate::structs::Spreadsheet; use crate::structs::WriterManager; @@ -34,7 +37,7 @@ pub(crate) fn write( // relationships worksheet for _ in spreadsheet.get_sheet_collection_no_check() { - let path_str = format!("worksheets/sheet{}.xml", index); + let path_str = format!("worksheets/sheet{index}.xml"); write_relationship(&mut writer, &index.to_string(), WORKSHEET_NS, &path_str, ""); index += 1; } @@ -108,7 +111,7 @@ fn write_relationship( ) { let tag_name = "Relationship"; let mut attributes: Vec<(&str, &str)> = Vec::new(); - let r_id = format!("rId{}", p_id); + let r_id = format!("rId{p_id}"); attributes.push(("Id", r_id.as_str())); attributes.push(("Type", p_type)); attributes.push(("Target", p_target)); diff --git a/src/writer/xlsx/worksheet.rs b/src/writer/xlsx/worksheet.rs index ad6a1325..702bc3ae 100644 --- a/src/writer/xlsx/worksheet.rs +++ b/src/writer/xlsx/worksheet.rs @@ -1,6 +1,8 @@ -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{ + MC_NS, PKG_SHEET, REL_OFC_NS, SHEETML_AC_NS, SHEET_DRAWING_NS, SHEET_MAIN_NS, SHEET_MS_MAIN_NS, +}; use crate::structs::Cell; use crate::structs::SharedStringTable; use crate::structs::Stylesheet; @@ -287,7 +289,7 @@ pub(crate) fn write( vec![("count", &tables.len().to_string())], false, ); - for _table in worksheet.get_tables().iter() { + for _table in worksheet.get_tables() { let r_id_str = format!("rId{}", &r_id); write_start_tag( &mut writer, @@ -317,6 +319,6 @@ pub(crate) fn write( write_end_tag(&mut writer, "worksheet"); - let target = format!("{PKG_SHEET}{}.xml", sheet_no); + let target = format!("{PKG_SHEET}{sheet_no}.xml"); writer_mng.add_writer(&target, writer) } diff --git a/src/writer/xlsx/worksheet_rels.rs b/src/writer/xlsx/worksheet_rels.rs index 89897642..e63e2606 100644 --- a/src/writer/xlsx/worksheet_rels.rs +++ b/src/writer/xlsx/worksheet_rels.rs @@ -2,9 +2,12 @@ use quick_xml::events::{BytesDecl, Event}; use quick_xml::Writer; use std::io; -use super::driver::*; +use super::driver::{write_end_tag, write_new_line, write_start_tag}; use super::XlsxError; -use crate::helper::const_str::*; +use crate::helper::const_str::{ + COMMENTS_NS, DRAWINGS_NS, HYPERLINK_NS, IMAGE_NS, OLE_OBJECT_NS, PACKAGE_NS, PKG_SHEET_RELS, + PRINTER_SETTINGS_NS, REL_NS, TABLE_NS, VML_DRAWING_NS, +}; use crate::structs::Worksheet; use crate::structs::WriterManager; @@ -55,12 +58,12 @@ pub(crate) fn write( // write pageSetup if worksheet.get_page_setup().get_object_data().is_some() { - let object_name = format!("printerSettings{}.bin", printer_settings_no); + let object_name = format!("printerSettings{printer_settings_no}.bin"); is_write = write_relationship( &mut writer, r_id.to_string().as_str(), PRINTER_SETTINGS_NS, - format!("../printerSettings/{}", object_name).as_str(), + format!("../printerSettings/{object_name}").as_str(), "", ); r_id += 1; @@ -95,7 +98,7 @@ pub(crate) fn write( } // write table relationships - for table_no in table_no_list.iter() { + for table_no in table_no_list { is_write = write_relationship( &mut writer, r_id.to_string().as_str(), @@ -112,24 +115,24 @@ pub(crate) fn write( for ole_object in worksheet.get_ole_objects().get_ole_object() { if ole_object.is_xlsx() { let excel_no = excel_no_list.next().unwrap(); - let object_name = format!("Microsoft_Excel_Worksheet{}.xlsx", excel_no); + let object_name = format!("Microsoft_Excel_Worksheet{excel_no}.xlsx"); write_relationship( &mut writer, r_id.to_string().as_str(), PACKAGE_NS, - format!("../embeddings/{}", object_name).as_str(), + format!("../embeddings/{object_name}").as_str(), "", ); r_id += 1; } if ole_object.is_bin() { let ole_object_no = ole_object_no_list.next().unwrap(); - let object_name = format!("oleObject{}.bin", ole_object_no); + let object_name = format!("oleObject{ole_object_no}.bin"); write_relationship( &mut writer, r_id.to_string().as_str(), OLE_OBJECT_NS, - format!("../embeddings/{}", object_name).as_str(), + format!("../embeddings/{object_name}").as_str(), "", ); r_id += 1; @@ -143,7 +146,7 @@ pub(crate) fn write( &mut writer, r_id.to_string().as_str(), IMAGE_NS, - format!("../media/{}", image_name).as_str(), + format!("../media/{image_name}").as_str(), "", ); r_id += 1; @@ -163,7 +166,7 @@ pub(crate) fn write( write_end_tag(&mut writer, "Relationships"); if is_write { - let file_path = format!("{PKG_SHEET_RELS}{}.xml.rels", worksheet_no); + let file_path = format!("{PKG_SHEET_RELS}{worksheet_no}.xml.rels"); writer_mng.add_writer(&file_path, writer)?; } Ok(()) @@ -178,7 +181,7 @@ fn write_relationship( ) -> bool { let tag_name = "Relationship"; let mut attributes: Vec<(&str, &str)> = Vec::new(); - let r_id = format!("rId{}", p_id); + let r_id = format!("rId{p_id}"); attributes.push(("Id", r_id.as_str())); attributes.push(("Type", p_type)); attributes.push(("Target", p_target)); diff --git a/tests/integration_test.rs b/tests/integration_test.rs index d3f0e7c9..57f30bcb 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -12,7 +12,7 @@ use umya_spreadsheet::*; fn read_and_wite() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); read_and_wite_method(&mut book); book.get_sheet_by_name("Sheet1") @@ -29,19 +29,19 @@ fn read_and_wite() { // writer let path = std::path::Path::new("./tests/result_files/bbb.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn read_and_wite_with_password() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); read_and_wite_method(&mut book); // writer let path = std::path::Path::new("./tests/result_files/bbb_password.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password"); + let _unused = writer::xlsx::write_with_password(&book, path, "password"); } #[test] @@ -49,37 +49,37 @@ fn wite_with_password() { // writer let from_path = std::path::Path::new("./tests/test_files/aaa.xlsx"); let to_path = std::path::Path::new("./tests/result_files/bbb_password2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password"); + let _unused = writer::xlsx::set_password(&from_path, &to_path, "password"); } #[test] fn lazy_read_and_wite() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); read_and_wite_method(&mut book); // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn read_and_wite_libre2() { // reader let path = std::path::Path::new("./tests/test_files/libre2.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/libre2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn read_large_string() { // reader let path = std::path::Path::new("./tests/test_files/aaa_large_string.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); //let _ns = book.get_sheet_by_name_mut("Sheet1").unwrap(); } @@ -88,7 +88,7 @@ fn lazy_read_and_wite_large_string() { // reader let start = Instant::now(); let path = std::path::Path::new("./tests/test_files/aaa_large_string.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); let ns = book.new_sheet("new sheet").unwrap(); let end = start.elapsed(); println!("read:{}.{:03}sec.", end.as_secs(), end.subsec_millis()); @@ -97,7 +97,7 @@ fn lazy_read_and_wite_large_string() { for r in 1..5000 { for c in 1..30 { let cell = ns.get_cell_mut((c, r)); - let _ = cell.set_value_string(format!("r{}c{}", r, c)); + let _unused = cell.set_value_string(format!("r{}c{}", r, c)); } } let end = start.elapsed(); @@ -106,7 +106,7 @@ fn lazy_read_and_wite_large_string() { // writer let start = Instant::now(); let path = std::path::Path::new("./tests/result_files/bbb_large_string.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); let end = start.elapsed(); println!("write:{}.{:03}sec.", end.as_secs(), end.subsec_millis()); } @@ -115,7 +115,7 @@ fn lazy_read_and_wite_large_string() { fn lazy_read_and_wite_no_edit() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let book = reader::xlsx::lazy_read(path).unwrap(); let cells = book.get_lazy_read_sheet_cells(0).unwrap(); assert_eq!("英語", cells.get_cell_value((5, 12)).get_value()); @@ -123,21 +123,21 @@ fn lazy_read_and_wite_no_edit() { // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy_no_edit.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } -fn read_and_wite_method(book: &mut umya_spreadsheet::Spreadsheet) { - let _ = book +fn read_and_wite_method(book: &mut Spreadsheet) { + let _unused = book .get_sheet_mut(0) .unwrap() .get_cell_mut("A1") .set_value("TEST1"); let a1_value = book.get_sheet(0).unwrap().get_value("A1"); assert_eq!("TEST1", a1_value); - let _ = book.get_sheet_mut(0).unwrap().remove_cell((1, 1)); + let _unused = book.get_sheet_mut(0).unwrap().remove_cell((1, 1)); let a1 = book.get_sheet(0).unwrap().get_cell("A1"); assert_eq!(a1, None); - let _ = book.get_sheet_mut(0).unwrap().remove_cell((1, 2)); + let _unused = book.get_sheet_mut(0).unwrap().remove_cell((1, 2)); let a2_value = book.get_sheet(0).unwrap().get_value("A2"); assert_eq!(a2_value, ""); let b5_value = book.get_sheet(0).unwrap().get_value("B5"); @@ -201,18 +201,18 @@ fn read_and_wite_method(book: &mut umya_spreadsheet::Spreadsheet) { book.get_sheet(0).unwrap().get_formatted_value("B37") ); - let _ = book + let _unused = book .get_sheet_by_name_mut("Sheet1") .unwrap() .get_cell_mut("A1") .set_value("49046881.119999997"); - let _ = book + let _unused = book .get_sheet_by_name_mut("Sheet1") .unwrap() .get_style_mut("A1") .get_number_format_mut() - .set_format_code(umya_spreadsheet::NumberingFormat::FORMAT_NUMBER_COMMA_SEPARATED1); + .set_format_code(NumberingFormat::FORMAT_NUMBER_COMMA_SEPARATED1); let value = book .get_sheet_by_name_mut("Sheet1") @@ -220,21 +220,15 @@ fn read_and_wite_method(book: &mut umya_spreadsheet::Spreadsheet) { .get_formatted_value("A1"); assert_eq!("49,046,881.12", &value); - let fg = umya_spreadsheet::Color::default() - .set_argb(umya_spreadsheet::Color::COLOR_BLACK) - .to_owned(); - let fill = umya_spreadsheet::PatternFill::default() - .set_foreground_color(fg) - .to_owned(); + let fg = Color::default().set_argb(Color::COLOR_BLACK).to_owned(); + let fill = PatternFill::default().set_foreground_color(fg).to_owned(); book.get_sheet_by_name_mut("Sheet5") .unwrap() .get_row_dimension_mut(5u32) .get_style_mut() .get_fill_mut() .set_pattern_fill(fill); - let font_color = umya_spreadsheet::Color::default() - .set_argb(umya_spreadsheet::Color::COLOR_WHITE) - .to_owned(); + let font_color = Color::default().set_argb(Color::COLOR_WHITE).to_owned(); book.get_sheet_by_name_mut("Sheet5") .unwrap() .get_row_dimension_mut(5u32) @@ -242,7 +236,7 @@ fn read_and_wite_method(book: &mut umya_spreadsheet::Spreadsheet) { .get_font_mut() .set_color(font_color); - let _ = book + let _unused = book .get_sheet_by_name_mut("Sheet7") .unwrap() .get_cell_mut("A1") @@ -260,53 +254,53 @@ fn read_and_wite_method(book: &mut umya_spreadsheet::Spreadsheet) { fn read_and_wite_by_empty() { // reader let path = std::path::Path::new("./tests/test_files/aaa_empty.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_empty.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn lazy_read_and_wite_by_empty() { // reader let path = std::path::Path::new("./tests/test_files/aaa_empty.xlsx"); - let book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let book = reader::xlsx::lazy_read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy_empty.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn read_and_wite_xlsm() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsm"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); read_and_wite_xlsm_method(&mut book); // writer let path = std::path::Path::new("./tests/result_files/bbb.xlsm"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn lazy_read_and_wite_xlsm() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsm"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); read_and_wite_xlsm_method(&mut book); // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy.xlsm"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn lazy_read_and_wite_xlsm2() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsm"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); let sheet = book.get_sheet_by_name_mut("Sheet1").unwrap(); let cell = sheet.get_cell_mut((1, 2)); @@ -314,22 +308,22 @@ fn lazy_read_and_wite_xlsm2() { // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy2.xlsm"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn lazy_read_and_wite_xlsm_no_edit() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsm"); - let book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let book = reader::xlsx::lazy_read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_lazy_no_edit.xlsm"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } -fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { - let _ = book +fn read_and_wite_xlsm_method(book: &mut Spreadsheet) { + let _unused = book .get_sheet_mut(0) .unwrap() .get_cell_mut((1, 1)) @@ -345,27 +339,27 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { // copy sheet let mut clone_sheet = book.get_sheet(0).unwrap().clone(); clone_sheet.set_name("New Sheet"); - let _ = book.add_sheet(clone_sheet); + let _unused = book.add_sheet(clone_sheet); // remove sheet let mut clone_sheet = book.get_sheet(0).unwrap().clone(); clone_sheet.set_name("DeletedSheet"); - let _ = book.add_sheet(clone_sheet); + let _unused = book.add_sheet(clone_sheet); book.get_sheet_by_name("DeletedSheet").unwrap(); book.remove_sheet_by_name("DeletedSheet").unwrap(); // add chart (line chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("A1"); to_marker.set_coordinate("B2"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::LineChart, + ChartType::LineChart, from_marker, to_marker, area_chart_series_list, @@ -376,23 +370,23 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .set_title("Chart Title") .set_horizontal_title("Horizontal Title") .set_vertical_title("Vertical Title") - .set_grouping(umya_spreadsheet::drawing::charts::GroupingValues::Standard); + .set_grouping(drawing::charts::GroupingValues::Standard); book.get_sheet_by_name_mut("Sheet7") .unwrap() .add_chart(chart); // add chart (pie chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("B1"); to_marker.set_coordinate("C2"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::PieChart, + ChartType::PieChart, from_marker, to_marker, area_chart_series_list, @@ -408,17 +402,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (doughnut chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("C1"); to_marker.set_coordinate("D2"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::DoughnutChart, + ChartType::DoughnutChart, from_marker, to_marker, area_chart_series_list, @@ -434,17 +428,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (area chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("D1"); to_marker.set_coordinate("E2"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::AreaChart, + ChartType::AreaChart, from_marker, to_marker, area_chart_series_list, @@ -460,17 +454,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (bar chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("E1"); to_marker.set_coordinate("F2"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::BarChart, + ChartType::BarChart, from_marker, to_marker, area_chart_series_list, @@ -486,17 +480,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (bar 3d chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("A2"); to_marker.set_coordinate("B3"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::Bar3DChart, + ChartType::Bar3DChart, from_marker, to_marker, area_chart_series_list, @@ -512,17 +506,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (line 3d chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("B2"); to_marker.set_coordinate("C3"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::Line3DChart, + ChartType::Line3DChart, from_marker, to_marker, area_chart_series_list, @@ -538,17 +532,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (pie 3d chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("C2"); to_marker.set_coordinate("D3"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::Pie3DChart, + ChartType::Pie3DChart, from_marker, to_marker, area_chart_series_list, @@ -564,17 +558,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (area 3d chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("D2"); to_marker.set_coordinate("E3"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::Area3DChart, + ChartType::Area3DChart, from_marker, to_marker, area_chart_series_list, @@ -590,17 +584,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (of pie chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("E2"); to_marker.set_coordinate("F3"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::OfPieChart, + ChartType::OfPieChart, from_marker, to_marker, area_chart_series_list, @@ -616,8 +610,8 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (bubble chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("A3"); to_marker.set_coordinate("B4"); let area_chart_series_list = vec![ @@ -627,10 +621,10 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { ]; let series_title_list = vec!["Line1", "Line2", "Line3"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::BubbleChart, + ChartType::BubbleChart, from_marker, to_marker, area_chart_series_list, @@ -646,8 +640,8 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (radar chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("B3"); to_marker.set_coordinate("C4"); let area_chart_series_list = vec![ @@ -657,10 +651,10 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { ]; let series_title_list = vec!["Line1", "Line2", "Line3"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::RadarChart, + ChartType::RadarChart, from_marker, to_marker, area_chart_series_list, @@ -676,17 +670,17 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // add chart (scatter chart) - let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); - let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let mut from_marker = drawing::spreadsheet::MarkerType::default(); + let mut to_marker = drawing::spreadsheet::MarkerType::default(); from_marker.set_coordinate("C3"); to_marker.set_coordinate("D4"); let area_chart_series_list = vec!["New Sheet!$G$7:$G$10", "New Sheet!$H$7:$H$10"]; let series_title_list = vec!["Line1", "Line2"]; let series_point_title_list = vec!["Point1", "Point2", "Point3", "Point4"]; - let mut chart = umya_spreadsheet::structs::Chart::default(); + let mut chart = Chart::default(); chart .new_chart( - umya_spreadsheet::structs::ChartType::ScatterChart, + ChartType::ScatterChart, from_marker, to_marker, area_chart_series_list, @@ -702,10 +696,10 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { .add_chart(chart); // Add Image - let _ = book.new_sheet("Sheet Image"); - let mut marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default(); + let _unused = book.new_sheet("Sheet Image"); + let mut marker = drawing::spreadsheet::MarkerType::default(); marker.set_coordinate("B3"); - let mut image = umya_spreadsheet::structs::Image::default(); + let mut image = Image::default(); image.new_image("./images/sample1.png", marker); book.get_sheet_by_name_mut("Sheet Image") .unwrap() @@ -716,7 +710,7 @@ fn read_and_wite_xlsm_method(book: &mut umya_spreadsheet::Spreadsheet) { fn insert_and_remove_cells() { // reader let path = std::path::Path::new("./tests/test_files/aaa_insertCell.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); book.insert_new_row("Sheet1", 2, 3); book.insert_new_column("Sheet1", "B", 3); @@ -727,7 +721,7 @@ fn insert_and_remove_cells() { // writer let path = std::path::Path::new("./tests/result_files/bbb_insertCell.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] @@ -736,12 +730,12 @@ fn new_sheet_and_edit() { const TEST_SHEET: &str = "Sheet2233"; let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); // set cell value let sheet = book.new_sheet(TEST_SHEET).unwrap(); let cell = sheet.get_cell_mut("A2"); - let _ = cell.set_value("test"); + let _unused = cell.set_value("test"); // set style by range let mut style = Style::default(); @@ -749,9 +743,9 @@ fn new_sheet_and_edit() { sheet.set_style_by_range("A3:A4", style); let path = std::path::Path::new("./tests/result_files/bbb_new_sheet_value.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); let a2_value = book .get_sheet_by_name_mut(TEST_SHEET) .unwrap() @@ -790,11 +784,11 @@ fn new_sheet_and_edit() { #[test] fn new_file_and_edit() { // new file. - let mut book = umya_spreadsheet::new_file(); + let mut book = new_file(); // new worksheet. - let _ = book.new_sheet("Sheet2"); - let _ = book.new_sheet("Sheet3"); + let _unused = book.new_sheet("Sheet2"); + let _unused = book.new_sheet("Sheet3"); // change value. book.get_sheet_by_name_mut("Sheet2") @@ -863,13 +857,13 @@ fn new_file_and_edit() { .get_style_mut("A1") .get_borders_mut() .get_bottom_mut() - .set_border_style(umya_spreadsheet::Border::BORDER_MEDIUM); + .set_border_style(Border::BORDER_MEDIUM); book.get_sheet_by_name_mut("Sheet2") .unwrap() .get_style_mut((3, 2)) .get_borders_mut() .get_left_mut() - .set_border_style(umya_spreadsheet::Border::BORDER_THIN); + .set_border_style(Border::BORDER_THIN); // change font color. book.get_sheet_by_name_mut("Sheet2") @@ -883,15 +877,15 @@ fn new_file_and_edit() { book.get_sheet_by_name_mut("Sheet2") .unwrap() .get_style_mut("A1") - .set_background_color(umya_spreadsheet::Color::COLOR_BLUE); + .set_background_color(Color::COLOR_BLUE); book.get_sheet_by_name_mut("Sheet2") .unwrap() .get_style_mut("A2") .set_background_color_with_pattern( - umya_spreadsheet::Color::COLOR_BLUE, - umya_spreadsheet::Color::COLOR_RED, - umya_spreadsheet::PatternValues::DarkGrid, + Color::COLOR_BLUE, + Color::COLOR_RED, + PatternValues::DarkGrid, ); let worksheet = book.get_sheet_by_name_mut("Sheet3").unwrap(); @@ -977,23 +971,23 @@ fn new_file_and_edit() { // writer. let path = std::path::Path::new("./tests/result_files/eee.xlsx"); - umya_spreadsheet::writer::xlsx::write(&book, path).unwrap(); + writer::xlsx::write(&book, path).unwrap(); } #[test] fn new_and_wite() { // new file. - let book = umya_spreadsheet::new_file(); + let book = new_file(); // writer. let path = std::path::Path::new("./tests/result_files/fff.xlsx"); - umya_spreadsheet::writer::xlsx::write(&book, path).unwrap(); + writer::xlsx::write(&book, path).unwrap(); } #[test] fn duplicate_sheet() { - let mut book = umya_spreadsheet::new_file(); - let _ = book.new_sheet("Sheet2"); + let mut book = new_file(); + let _unused = book.new_sheet("Sheet2"); if book.new_sheet("Sheet2").is_ok() { panic!("getting new sheet..") } @@ -1001,7 +995,7 @@ fn duplicate_sheet() { #[test] fn witer_csv() { - let mut book = umya_spreadsheet::new_file(); + let mut book = new_file(); book.set_active_sheet(1); let sheet = book.new_sheet("Sheet2").unwrap(); // --- @@ -1018,82 +1012,82 @@ fn witer_csv() { // --- // writer - let mut option = umya_spreadsheet::structs::CsvWriterOption::default(); - option.set_csv_encode_value(umya_spreadsheet::structs::CsvEncodeValues::ShiftJis); + let mut option = CsvWriterOption::default(); + option.set_csv_encode_value(CsvEncodeValues::ShiftJis); option.set_do_trim(true); option.set_wrap_with_char("\""); let path = std::path::Path::new("./tests/result_files/bbb.csv"); - let _ = umya_spreadsheet::writer::csv::write(&book, path, Some(&option)); + let _unused = writer::csv::write(&book, path, Some(&option)); } #[test] fn new_file_empty_worksheet() { let book = umya_spreadsheet::new_file_empty_worksheet(); let path = std::path::Path::new("./tests/result_files/empty_worksheet.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn google() { // reader let path = std::path::Path::new("./tests/test_files/google.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/google.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn libre() { // reader let path = std::path::Path::new("./tests/test_files/libre.xlsm"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/libre.xlsm"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn read_and_wite_theme() { // reader let path = std::path::Path::new("./tests/test_files/aaa_theme.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_theme.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn openpyxl() { let path = std::path::Path::new("./tests/test_files/openpyxl.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); let sheet = book.get_active_sheet(); assert_eq!(sheet.get_cell("A1").unwrap().get_value(), "TEST"); assert_eq!(sheet.get_cell("A2").unwrap().get_value(), " TEST "); let path = std::path::Path::new("./tests/result_files/openpyxl.xlsx"); - umya_spreadsheet::writer::xlsx::write(&book, path).unwrap(); + writer::xlsx::write(&book, path).unwrap(); } #[test] fn read_and_wite_2() { // reader let path = std::path::Path::new("./tests/test_files/aaa_2.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_110() { let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let sheet = book.get_sheet_by_name_mut("Sheet1").unwrap(); let cell = sheet.get_cell_mut("A1"); @@ -1102,29 +1096,29 @@ fn issue_110() { // work on 0.9 cell.set_value("test"); let path = std::path::Path::new("./tests/result_files/aaa_issue_110.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn compression_test() { // reader let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); // writer let path = std::path::Path::new("./tests/result_files/bbb_comp_standard.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); // writer let path = std::path::Path::new("./tests/result_files/bbb_comp_light.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write_light(&book, path); + let _unused = writer::xlsx::write_light(&book, path); } #[test] fn move_range_test() { // reader let path = std::path::Path::new("./tests/test_files/aaa_move_range.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let sheet_name = "Sheet1"; let range = "C5:F9"; @@ -1144,24 +1138,24 @@ fn move_range_test() { .move_range(range_2, 0, 1); let path = std::path::Path::new("./tests/result_files/bbb_move_range.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write_light(&book, path); + let _unused = writer::xlsx::write_light(&book, path); } #[test] fn issue_72() { let xlsx_path = std::path::Path::new("./tests/test_files/wps_comment.xlsx"); - let wb = umya_spreadsheet::reader::xlsx::read(xlsx_path).unwrap(); + let wb = reader::xlsx::read(xlsx_path).unwrap(); // save to new file let path = std::path::Path::new("./tests/result_files/wps_comment_corrupted.xlsx"); - umya_spreadsheet::writer::xlsx::write(&wb, path).unwrap(); + writer::xlsx::write(&wb, path).unwrap(); } #[test] fn issue_129() { let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); let img = book .get_sheet_by_name("Sheet1") .unwrap() @@ -1175,13 +1169,13 @@ fn issue_129() { assert_eq!(img.get_row(), 16); let path = std::path::Path::new("./tests/result_files/issue_129.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn wb_with_shared_strings() { let path = std::path::Path::new("./tests/test_files/wb_with_shared_strings.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); let sheet = book.get_sheet_by_name("Sheet To Read From").unwrap(); assert_eq!(sheet.get_cell("A2").unwrap().get_value(), "11"); @@ -1191,22 +1185,22 @@ fn wb_with_shared_strings() { assert_eq!(sheet.get_cell("A6").unwrap().get_value(), "ABCdef"); let path = std::path::Path::new("./tests/result_files/wb_with_shared_strings.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_test() { let path = std::path::Path::new("./tests/test_files/table.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/table.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn sheetlock_test() { let path = std::path::Path::new("./tests/test_files/sheet_lock.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let mut sheet = book.get_sheet_mut(2).unwrap(); sheet @@ -1215,25 +1209,25 @@ fn sheetlock_test() { .set_sheet(true); let path = std::path::Path::new("./tests/result_files/sheet_lock.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn workbooklock_test() { let path = std::path::Path::new("./tests/test_files/book_lock.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); book.get_workbook_protection_mut() .set_workbook_password("password"); let path = std::path::Path::new("./tests/result_files/book_lock.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_147() { let path = std::path::Path::new("./tests/test_files/issue_147.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let from_sheet = book.get_sheet(0).unwrap(); let source_cell = from_sheet.get_cell((2, 3)).unwrap(); @@ -1243,17 +1237,17 @@ fn issue_147() { to_sheet.set_cell(target_cell); let path = std::path::Path::new("./tests/result_files/issue_147.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn html_to_richtext_test() { let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let mut sheet = book.get_sheet_by_name_mut("Sheet1").unwrap(); let html = r##"test
TEST
TEST
"##; - let richtext = umya_spreadsheet::helper::html::html_to_richtext(html).unwrap(); + let richtext = helper::html::html_to_richtext(html).unwrap(); sheet.get_cell_mut("G16").set_rich_text(richtext); sheet @@ -1263,25 +1257,25 @@ fn html_to_richtext_test() { .set_wrap_text(true); let path = std::path::Path::new("./tests/result_files/bbb_html_to_richtext.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_162() { let path = std::path::Path::new("./tests/test_files/issue_162.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_162.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_172() { - let value = umya_spreadsheet::helper::date::convert_date(2024, 2, 3, 10, 59, 00); + let value = helper::date::convert_date(2024, 2, 3, 10, 59, 00); let mut numbering_format = NumberingFormat::default(); numbering_format.set_format_code("dd-mmm-yy"); - let mut book = umya_spreadsheet::new_file(); + let mut book = new_file(); let mut sheet = book.get_sheet_mut(0).unwrap(); sheet.get_cell_mut("A1").set_value_number(value); sheet @@ -1294,7 +1288,7 @@ fn issue_172() { #[test] fn issue_177() { - let test = umya_spreadsheet::helper::coordinate::CellCoordinates::from("A1"); + let test = helper::coordinate::CellCoordinates::from("A1"); let test2 = test.clone(); assert_eq!(test.row, test2.row); assert_eq!(test.col, test2.col); @@ -1303,16 +1297,16 @@ fn issue_177() { #[test] fn issue_178() { let path = std::path::Path::new("./tests/test_files/issue_178.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_178.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_181() { let path = std::path::Path::new("./tests/test_files/issue_181.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let mut sheet = book.get_sheet_by_name_mut("LOV").unwrap(); sheet.remove_row(2, 1); for (key, row) in sheet.get_row_dimensions_to_hashmap() { @@ -1321,15 +1315,15 @@ fn issue_181() { assert_eq!(row.get_height(), 35.0); } let path = std::path::Path::new("./tests/result_files/issue_181.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_181_2() { let path = std::path::Path::new("./tests/test_files/issue_181_2.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); - let shee1: &mut umya_spreadsheet::structs::Worksheet = book.get_sheet_mut(0).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); + let shee1: &mut Worksheet = book.get_sheet_mut(0).unwrap(); let new_row_index = 4; shee1.insert_new_row(new_row_index, 5); shee1.get_cell_mut((1, new_row_index)).set_value("123"); @@ -1340,23 +1334,23 @@ fn issue_181_2() { shee1.remove_column("B", 1); let path = std::path::Path::new("./tests/result_files/issue_181_2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_178_2() { let path = std::path::Path::new("./tests/test_files/issue_178_2.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_178_2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_185() { let path = std::path::Path::new("./tests/test_files/issue_185.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); assert_eq!( book.get_sheet(0) .unwrap() @@ -1370,7 +1364,7 @@ fn issue_185() { #[test] fn issue_187() { let path = std::path::Path::new("./tests/test_files/issue_187.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let mut sheet = book.get_sheet_mut(0).unwrap(); let mut cell = sheet.get_cell("C4").unwrap().clone(); @@ -1386,40 +1380,40 @@ fn issue_187() { sheet.set_cell(cell); let path = std::path::Path::new("./tests/result_files/issue_187.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_188() { let path = std::path::Path::new("./tests/test_files/issue_188.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_188.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_188_2() { let path = std::path::Path::new("./tests/test_files/issue_188_2.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_188_2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_189() { let path = std::path::Path::new("./tests/test_files/issue_189.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_189.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn expect_red_indexed_color() { let path = std::path::Path::new("./tests/test_files/red_indexed_color.xlsx"); - let book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let book = reader::xlsx::read(path).unwrap(); let cell = book.get_sheet(0).unwrap().get_cell("A1").unwrap(); @@ -1431,7 +1425,7 @@ fn expect_red_indexed_color() { #[test] fn issue_190() { let path = std::path::Path::new("./tests/test_files/issue_190.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); // remove book.get_sheet_mut(0).unwrap().remove_column("E", 1); @@ -1442,13 +1436,13 @@ fn issue_190() { book.get_sheet_mut(1).unwrap().insert_new_row(4, 1); let path = std::path::Path::new("./tests/result_files/issue_190.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_194() { let path = std::path::Path::new("./tests/test_files/issue_194.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); book.get_sheet_mut(0).unwrap().insert_new_column("D", 1); assert_eq!( @@ -1477,60 +1471,60 @@ fn issue_194() { ); let path = std::path::Path::new("./tests/result_files/issue_194.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_200() { let input_buffer = std::fs::read("./tests/test_files/issue_200.xlsx").unwrap(); let cursor = std::io::Cursor::new(input_buffer); - let workbook = umya_spreadsheet::reader::xlsx::read_reader(cursor, true).unwrap(); + let workbook = reader::xlsx::read_reader(cursor, true).unwrap(); let output_file = std::fs::File::create("./tests/result_files/issue_200.xlsx").unwrap(); - umya_spreadsheet::writer::xlsx::write_writer(&workbook, output_file).unwrap(); + writer::xlsx::write_writer(&workbook, output_file).unwrap(); } #[test] fn issue_201() { let path = std::path::Path::new("./tests/test_files/issue_201.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let mut cell = book.get_sheet_mut(0).unwrap().get_cell_mut("B1"); cell.set_formula_result_default(""); let path = std::path::Path::new("./tests/result_files/issue_201.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_206() { let path = std::path::Path::new("./tests/test_files/issue_206.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_206.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_194_2() { let path = std::path::Path::new("./tests/test_files/issue_194_2.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_194_2.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_188_3() { let path = std::path::Path::new("./tests/test_files/issue_188_3.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_188_3.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_184() { let path = std::path::Path::new("./tests/test_files/issue_184.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let theme = book.get_theme(); let color = book .get_sheet(0) @@ -1548,7 +1542,7 @@ fn issue_184() { #[test] fn issue_188_4() { let path = std::path::Path::new("./tests/test_files/issue_188_4.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); assert_eq!( book.get_sheet(0) @@ -1588,13 +1582,13 @@ fn issue_188_4() { ); let path = std::path::Path::new("./tests/result_files/issue_188_4.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_210() { let path = std::path::Path::new("./tests/test_files/issue_210.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let sheet = book.get_sheet(0).unwrap(); for cell in sheet.get_cell_collection() { if let Some(varA) = cell.get_style().get_alignment() { @@ -1616,15 +1610,15 @@ fn issue_210() { #[test] fn issue_208() { let path = std::path::Path::new("./tests/test_files/issue_208.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_208.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_184_2() { let path = std::path::Path::new("./tests/test_files/issue_184_2.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let data = vec![ ("A1", "FFFFFF"), @@ -1674,26 +1668,26 @@ fn issue_184_2() { #[test] fn issue_215() { let path = std::path::Path::new("./tests/test_files/issue_215.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_215.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_216() { let path = std::path::Path::new("./tests/test_files/issue_216.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); } #[test] fn issue_217() { let path = std::path::Path::new("./tests/test_files/issue_217.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); book.get_sheet_mut(2) .unwrap() - .set_state(umya_spreadsheet::SheetStateValues::Hidden); + .set_state(SheetStateValues::Hidden); let path = std::path::Path::new("./tests/result_files/issue_217.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] @@ -1730,22 +1724,22 @@ fn issue_218() { out_sheet.set_conditional_formatting_collection(vec![new_cond]); let path = std::path::Path::new("./tests/result_files/issue_218.xlsx"); - let _ = writer::xlsx::write(&out_book, path); + let _unused = writer::xlsx::write(&out_book, path); } #[test] fn issue_219() { let path = std::path::Path::new("./tests/test_files/issue_219.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_219.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_220() { let path = std::path::Path::new("./tests/test_files/issue_220.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); book.get_sheet_mut(0) .unwrap() @@ -1768,21 +1762,21 @@ fn issue_220() { .set_value("TEST1"); let path = std::path::Path::new("./tests/result_files/issue_220.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_222() { let path = std::path::Path::new("./tests/test_files/issue_222.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_222.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_224() { - let mut book = umya_spreadsheet::new_file(); + let mut book = new_file(); let mut sheet = book.get_sheet_mut(0).unwrap(); let mut num = NumberingFormat::default(); num.set_format_code("[<1]0;0"); @@ -1797,16 +1791,16 @@ fn issue_224() { #[test] fn issue_225() { let path = std::path::Path::new("./tests/test_files/issue_225.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_225.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_227() { let path = std::path::Path::new("./tests/test_files/aaa.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); book.read_sheet_by_name("Sheet2"); let sheet = book.get_sheet_by_name("Sheet2").unwrap(); assert_eq!("3", sheet.get_cell("B6").unwrap().get_value()); @@ -1827,34 +1821,34 @@ fn issue_230() { #[test] fn issue_232() { let path = std::path::Path::new("./tests/test_files/issue_232.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); + let mut book = reader::xlsx::lazy_read(path).unwrap(); let path = std::path::Path::new("./tests/result_files/issue_232.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_233() { let path = std::path::Path::new("./tests/test_files/issue_233.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); // book.get_sheet_mut(0).unwrap().cleanup(); let path = std::path::Path::new("./tests/result_files/issue_233.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_244() { let path = std::path::Path::new("./tests/test_files/issue_244.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let sheet = book.get_sheet_mut(0).unwrap(); let mut comment = Comment::default(); comment.new_comment("B2"); comment.set_text_string("TEST"); - let media_object = umya_spreadsheet::helper::binary::make_media_object("./images/sample1.png"); + let media_object = helper::binary::make_media_object("./images/sample1.png"); comment .get_shape_mut() .get_fill_mut() @@ -1864,13 +1858,13 @@ fn issue_244() { sheet.add_comments(comment); let path = std::path::Path::new("./tests/result_files/issue_244.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] fn issue_246() { let path = std::path::Path::new("./tests/test_files/issue_246.xlsx"); - let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap(); + let mut book = reader::xlsx::read(path).unwrap(); let sheet = book.get_sheet_mut(0).unwrap(); sheet.copy_row_styling(3, 5, None, None); @@ -1880,7 +1874,7 @@ fn issue_246() { sheet.copy_col_styling(10, 13, Some(11), Some(15)); let path = std::path::Path::new("./tests/result_files/issue_246.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); } #[test] @@ -1895,5 +1889,5 @@ fn issue_248() { .set_show_grid_lines(false); let path = std::path::Path::new("./tests/result_files/issue_248.xlsx"); - let _ = umya_spreadsheet::writer::xlsx::write(&book, path); + let _unused = writer::xlsx::write(&book, path); }