FIX: Make clippy happy. automatic update
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
793534b190
commit
7756ef7f48
@@ -23,19 +23,19 @@ impl Lexer {
|
|||||||
// TODO(TD): There are better ways of doing this :)
|
// TODO(TD): There are better ways of doing this :)
|
||||||
let rest_of_formula: String = self.chars[self.position..self.len].iter().collect();
|
let rest_of_formula: String = self.chars[self.position..self.len].iter().collect();
|
||||||
let specifier = if rest_of_formula.starts_with("#This Row]") {
|
let specifier = if rest_of_formula.starts_with("#This Row]") {
|
||||||
self.position += "#This Row]".bytes().len();
|
self.position += "#This Row]".len();
|
||||||
TableSpecifier::ThisRow
|
TableSpecifier::ThisRow
|
||||||
} else if rest_of_formula.starts_with("#All]") {
|
} else if rest_of_formula.starts_with("#All]") {
|
||||||
self.position += "#All]".bytes().len();
|
self.position += "#All]".len();
|
||||||
TableSpecifier::All
|
TableSpecifier::All
|
||||||
} else if rest_of_formula.starts_with("#Data]") {
|
} else if rest_of_formula.starts_with("#Data]") {
|
||||||
self.position += "#Data]".bytes().len();
|
self.position += "#Data]".len();
|
||||||
TableSpecifier::Data
|
TableSpecifier::Data
|
||||||
} else if rest_of_formula.starts_with("#Headers]") {
|
} else if rest_of_formula.starts_with("#Headers]") {
|
||||||
self.position += "#Headers]".bytes().len();
|
self.position += "#Headers]".len();
|
||||||
TableSpecifier::Headers
|
TableSpecifier::Headers
|
||||||
} else if rest_of_formula.starts_with("#Totals]") {
|
} else if rest_of_formula.starts_with("#Totals]") {
|
||||||
self.position += "#Totals]".bytes().len();
|
self.position += "#Totals]".len();
|
||||||
TableSpecifier::Totals
|
TableSpecifier::Totals
|
||||||
} else {
|
} else {
|
||||||
return Err(LexerError {
|
return Err(LexerError {
|
||||||
|
|||||||
@@ -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!",
|
"#REF!", "#NAME?", "#VALUE!", "#DIV/0!", "#N/A", "#NUM!", "#ERROR!", "#N/IMPL!", "#SPILL!",
|
||||||
"#CALC!", "#CIRC!", "#NULL!",
|
"#CALC!", "#CIRC!", "#NULL!",
|
||||||
];
|
];
|
||||||
names.iter().any(|e| *e == name)
|
names.contains(&name)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
@@ -178,10 +178,7 @@ impl Lexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.position = position;
|
self.position = position;
|
||||||
match chars.parse::<f64>() {
|
chars.parse::<f64>().ok()
|
||||||
Err(_) => None,
|
|
||||||
Ok(v) => Some(v),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn consume_condition(&mut self) -> Option<(Compare, f64)> {
|
fn consume_condition(&mut self) -> Option<(Compare, f64)> {
|
||||||
|
|||||||
@@ -75,30 +75,21 @@ pub(crate) fn load_table<R: Read + std::io::Seek>(
|
|||||||
|
|
||||||
// style index of the header row of the table
|
// style index of the header row of the table
|
||||||
let header_row_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
|
let header_row_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// style index of the header row of the table
|
// style index of the header row of the table
|
||||||
let data_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
|
let data_dxf_id = if let Some(index_str) = table.attribute("headerRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// style index of the totals row of the table
|
// style index of the totals row of the table
|
||||||
let totals_row_dxf_id = if let Some(index_str) = table.attribute("totalsRowDxfId") {
|
let totals_row_dxf_id = if let Some(index_str) = table.attribute("totalsRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@@ -143,30 +134,21 @@ pub(crate) fn load_table<R: Read + std::io::Seek>(
|
|||||||
|
|
||||||
// style index of the header row of the table
|
// style index of the header row of the table
|
||||||
let header_row_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
|
let header_row_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// style index of the header row of the table column
|
// style index of the header row of the table column
|
||||||
let data_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
|
let data_dxf_id = if let Some(index_str) = table_column.attribute("headerRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// style index of the totals row of the table column
|
// style index of the totals row of the table column
|
||||||
let totals_row_dxf_id = if let Some(index_str) = table_column.attribute("totalsRowDxfId") {
|
let totals_row_dxf_id = if let Some(index_str) = table_column.attribute("totalsRowDxfId") {
|
||||||
match index_str.parse::<u32>() {
|
index_str.parse::<u32>().ok()
|
||||||
Ok(i) => Some(i),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user