Skip to content

Commit

Permalink
Merge pull request #361 from jqnatividad/typos_n_clippy
Browse files Browse the repository at this point in the history
Typos n clippy
  • Loading branch information
tafia authored Oct 2, 2023
2 parents 43c28b8 + be17df5 commit 60a5614
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
- docs: add `deserialize_with` example in readme
- fix: Skip phonetic run
- fix: Fix XLS float parsing error
- docs: Correct MBSC to MBCS in vba.rs (mispelled before)
- docs: Correct MBSC to MBCS in vba.rs (misspelled before)
- style: use 2018 edition paths
- fix: Add the ability to read formula values from XLSB
- fix: support integral date types
Expand Down
12 changes: 6 additions & 6 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ where
}

fn deserialize_map<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value, Self::Error> {
if !self.has_headers() {
visitor.visit_seq(self)
} else {
if self.has_headers() {
visitor.visit_map(self)
} else {
visitor.visit_seq(self)
}
}

Expand All @@ -405,10 +405,10 @@ where
_cells: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error> {
if !self.has_headers() {
visitor.visit_seq(self)
} else {
if self.has_headers() {
visitor.visit_map(self)
} else {
visitor.visit_seq(self)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/xls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,12 +1320,12 @@ fn parse_formula(
}
}
}
if stack.len() != 1 {
if stack.len() == 1 {
Ok(formula)
} else {
Err(XlsError::InvalidFormula {
stack_size: stack.len(),
})
} else {
Ok(formula)
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/xlsb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl<RS: Read + Seek> Xlsb<RS> {
}
}

fn worksheet_range_from_path(&mut self, path: String) -> Result<Range<DataType>, XlsbError> {
fn worksheet_range_from_path(&mut self, path: &str) -> Result<Range<DataType>, XlsbError> {
let mut iter = RecordIter::from_zip(&mut self.zip, &path)?;
let mut buf = vec![0; 1024];
let formats = &self.formats;
Expand Down Expand Up @@ -651,7 +651,7 @@ impl<RS: Read + Seek> Reader<RS> for Xlsb<RS> {
Some((_, path)) => path.clone(),
None => return None,
};
Some(self.worksheet_range_from_path(path))
Some(self.worksheet_range_from_path(&path))
}

/// MS-XLSB 2.1.7.62
Expand All @@ -669,7 +669,7 @@ impl<RS: Read + Seek> Reader<RS> for Xlsb<RS> {
sheets
.into_iter()
.filter_map(|(name, path)| {
let ws = self.worksheet_range_from_path(path).ok()?;
let ws = self.worksheet_range_from_path(&path).ok()?;
Some((name, ws))
})
.collect()
Expand Down Expand Up @@ -1079,10 +1079,10 @@ fn parse_formula(
}
}

if stack.len() != 1 {
Err(XlsbError::StackLen)
} else {
if stack.len() == 1 {
Ok(formula)
} else {
Err(XlsbError::StackLen)
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/xlsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum XlsxError {
/// There is no column component in the range string
RangeWithoutColumnComponent,
/// There is no row component in the range string
RangeWithoutRowCompontent,
RangeWithoutRowComponent,
/// Unexpected error
Unexpected(&'static str),
/// Unrecognized data
Expand Down Expand Up @@ -121,7 +121,7 @@ impl std::fmt::Display for XlsxError {
XlsxError::RangeWithoutColumnComponent => {
write!(f, "Range is missing the expected column component.")
}
XlsxError::RangeWithoutRowCompontent => {
XlsxError::RangeWithoutRowComponent => {
write!(f, "Range is missing the expected row component.")
}
XlsxError::Unexpected(e) => write!(f, "{}", e),
Expand Down Expand Up @@ -380,7 +380,7 @@ impl<RS: Read + Seek> Xlsx<RS> {
Ok(Event::Start(ref e)) if e.local_name().as_ref() == b"definedName" => {
if let Some(a) = e
.attributes()
.filter_map(|a| a.ok())
.filter_map(std::result::Result::ok)
.find(|a| a.key == QName(b"name"))
{
let name = a.decode_and_unescape_value(&xml)?.to_string();
Expand Down Expand Up @@ -1213,7 +1213,7 @@ fn get_row_and_optional_column(range: &[u8]) -> Result<(u32, Option<u32>), XlsxE
}
let row = row
.checked_sub(1)
.ok_or(XlsxError::RangeWithoutRowCompontent)?;
.ok_or(XlsxError::RangeWithoutRowComponent)?;
Ok((row, col.checked_sub(1)))
}

Expand Down

0 comments on commit 60a5614

Please sign in to comment.