FIX: Make clippy happy. automatic update

This commit is contained in:
Nicolás Hatcher
2025-04-15 15:27:21 +02:00
committed by Nicolás Hatcher Andrés
parent 793534b190
commit 7756ef7f48
4 changed files with 13 additions and 34 deletions

View File

@@ -23,19 +23,19 @@ impl Lexer {
// TODO(TD): There are better ways of doing this :)
let rest_of_formula: String = self.chars[self.position..self.len].iter().collect();
let specifier = if rest_of_formula.starts_with("#This Row]") {
self.position += "#This Row]".bytes().len();
self.position += "#This Row]".len();
TableSpecifier::ThisRow
} else if rest_of_formula.starts_with("#All]") {
self.position += "#All]".bytes().len();
self.position += "#All]".len();
TableSpecifier::All
} else if rest_of_formula.starts_with("#Data]") {
self.position += "#Data]".bytes().len();
self.position += "#Data]".len();
TableSpecifier::Data
} else if rest_of_formula.starts_with("#Headers]") {
self.position += "#Headers]".bytes().len();
self.position += "#Headers]".len();
TableSpecifier::Headers
} else if rest_of_formula.starts_with("#Totals]") {
self.position += "#Totals]".bytes().len();
self.position += "#Totals]".len();
TableSpecifier::Totals
} else {
return Err(LexerError {

View File

@@ -197,7 +197,7 @@ pub fn is_english_error_string(name: &str) -> bool {
"#REF!", "#NAME?", "#VALUE!", "#DIV/0!", "#N/A", "#NUM!", "#ERROR!", "#N/IMPL!", "#SPILL!",
"#CALC!", "#CIRC!", "#NULL!",
];
names.iter().any(|e| *e == name)
names.contains(&name)
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]

View File

@@ -178,10 +178,7 @@ impl Lexer {
}
}
self.position = position;
match chars.parse::<f64>() {
Err(_) => None,
Ok(v) => Some(v),
}
chars.parse::<f64>().ok()
}
fn consume_condition(&mut self) -> Option<(Compare, f64)> {

View File

@@ -75,30 +75,21 @@ pub(crate) fn load_table<R: Read + std::io::Seek>(
// style index of the header row of the table
let header_row_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};
// style index of the header row of the table
let data_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};
// style index of the totals row of the table
let totals_row_dxf_id = if let Some(index_str) = table.attribute("totalsRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};
@@ -143,30 +134,21 @@ pub(crate) fn load_table<R: Read + std::io::Seek>(
// style index of the header row of the table
let header_row_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};
// style index of the header row of the table column
let data_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};
// style index of the totals row of the table column
let totals_row_dxf_id = if let Some(index_str) = table_column.attribute("totalsRowDxfId") {
match index_str.parse::<u32>() {
Ok(i) => Some(i),
Err(_) => None,
}
index_str.parse::<u32>().ok()
} else {
None
};