Lint: as_chunks in the font scan too
The system font scan reads collection offsets and table records with chunks_exact; clippy 1.99 asks for as_chunks there as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9TrG4w49oSRYbP3cqxA3D
This commit is contained in:
parent
719e648de1
commit
a4d93b1462
|
|
@ -259,7 +259,7 @@ fn file_face_names(path: &Path) -> Vec<(String, String)> {
|
||||||
// A collection lists where each face's table directory starts.
|
// A collection lists where each face's table directory starts.
|
||||||
let starts: Vec<u32> = if head.starts_with(b"ttcf") {
|
let starts: Vec<u32> = if head.starts_with(b"ttcf") {
|
||||||
let n = be32(&head, 8).unwrap_or(0).min(MAX_FACES) as usize;
|
let n = be32(&head, 8).unwrap_or(0).min(MAX_FACES) as usize;
|
||||||
read_at(12, n * 4).map(|b| b.chunks_exact(4).filter_map(|c| be32(c, 0)).collect()).unwrap_or_default()
|
read_at(12, n * 4).map(|b| b.as_chunks::<4>().0.iter().map(|c| u32::from_be_bytes(*c)).collect()).unwrap_or_default()
|
||||||
} else {
|
} else {
|
||||||
vec![0]
|
vec![0]
|
||||||
};
|
};
|
||||||
|
|
@ -269,7 +269,7 @@ fn file_face_names(path: &Path) -> Vec<(String, String)> {
|
||||||
let dir = read_at(start.into(), 12)?;
|
let dir = read_at(start.into(), 12)?;
|
||||||
let tables = u16::from_be_bytes(dir.get(4..6)?.try_into().ok()?) as usize;
|
let tables = u16::from_be_bytes(dir.get(4..6)?.try_into().ok()?) as usize;
|
||||||
let records = read_at(u64::from(start) + 12, tables * 16)?;
|
let records = read_at(u64::from(start) + 12, tables * 16)?;
|
||||||
let rec = records.chunks_exact(16).find(|r| r.starts_with(b"name"))?;
|
let rec: &[u8] = records.as_chunks::<16>().0.iter().find(|r| r.starts_with(b"name"))?;
|
||||||
let (offset, len) = (be32(rec, 8)?, be32(rec, 12)?);
|
let (offset, len) = (be32(rec, 8)?, be32(rec, 12)?);
|
||||||
if len > MAX_NAME_TABLE {
|
if len > MAX_NAME_TABLE {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue