Skip to content

Commit

Permalink
fix: remove Option-wrapping of return type, is never None
Browse files Browse the repository at this point in the history
  • Loading branch information
sftse committed Oct 30, 2024
1 parent 1a8568a commit fb267a3
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/xls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ impl<RS: Read + Seek> Xls<RS> {
}
//0x0201 => cells.push(parse_blank(r.data)?), // 513: Blank
0x0203 => cells.push(parse_number(r.data, &self.formats, self.is_1904)?), // 515: Number
0x0204 => cells.extend(parse_label(r.data, &encoding, biff)?), // 516: Label [MS-XLS 2.4.148]
0x0205 => cells.push(parse_bool_err(r.data)?), // 517: BoolErr
0x0204 => cells.push(parse_label(r.data, &encoding, biff)?), // 516: Label [MS-XLS 2.4.148]
0x0205 => cells.push(parse_bool_err(r.data)?), // 517: BoolErr
0x0207 => {
// 519 String (formula value)
let val = Data::String(parse_string(r.data, &encoding, biff)?);
Expand Down Expand Up @@ -489,7 +489,7 @@ impl<RS: Read + Seek> Xls<RS> {
let Ok(s) = parse_label(r.data, &encoding, biff) else {
continue;
};
cells.extend(s);
cells.push(s);
}
_ => {}
}
Expand Down Expand Up @@ -804,11 +804,7 @@ fn parse_string(r: &[u8], encoding: &XlsEncoding, biff: Biff) -> Result<String,
Ok(s)
}

fn parse_label(
r: &[u8],
encoding: &XlsEncoding,
biff: Biff,
) -> Result<Option<Cell<Data>>, XlsError> {
fn parse_label(r: &[u8], encoding: &XlsEncoding, biff: Biff) -> Result<Cell<Data>, XlsError> {
if r.len() < 6 {
return Err(XlsError::Len {
typ: "label",
Expand All @@ -819,10 +815,10 @@ fn parse_label(
let row = read_u16(r);
let col = read_u16(&r[2..]);
let _ixfe = read_u16(&r[4..]);
Ok(Some(Cell::new(
Ok(Cell::new(
(row as u32, col as u32),
Data::String(parse_string(&r[6..], encoding, biff)?),
)))
))
}

fn parse_label_sst(r: &[u8], strings: &[String]) -> Result<Option<Cell<Data>>, XlsError> {
Expand Down

0 comments on commit fb267a3

Please sign in to comment.