Skip to content

Commit bbf4990

Browse files
committed
fix(ci): satisfy Rust 1.98 chunks lint
1 parent 8cdd55c commit bbf4990

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

  • crates
    • deckprobe-format-office-legacy/src
    • deckprobe-format-pdf/src

crates/deckprobe-format-office-legacy/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,10 @@ fn parse_summary_information(bytes: &[u8]) -> BTreeMap<u32, SummaryValue> {
712712
let end = start.checked_add(length as usize * 2)?.min(bytes.len());
713713
let words = bytes
714714
.get(start..end)?
715-
.chunks_exact(2)
716-
.map(|pair| u16::from_le_bytes([pair[0], pair[1]]))
715+
.as_chunks::<2>()
716+
.0
717+
.iter()
718+
.map(|pair| u16::from_le_bytes(*pair))
717719
.take_while(|value| *value != 0)
718720
.collect::<Vec<_>>();
719721
Some(SummaryValue::Text(String::from_utf16_lossy(&words)))

crates/deckprobe-format-pdf/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,10 @@ fn object_text(document: &Document, object: &Object) -> Option<String> {
11291129
fn decode_pdf_string(bytes: &[u8]) -> String {
11301130
if bytes.starts_with(&[0xfe, 0xff]) {
11311131
let words = bytes[2..]
1132-
.chunks_exact(2)
1133-
.map(|pair| u16::from_be_bytes([pair[0], pair[1]]))
1132+
.as_chunks::<2>()
1133+
.0
1134+
.iter()
1135+
.map(|pair| u16::from_be_bytes(*pair))
11341136
.collect::<Vec<_>>();
11351137
String::from_utf16_lossy(&words)
11361138
} else {

0 commit comments

Comments
 (0)