From 38e3d266a424512d7c7091744bafaedf19183965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 20 Aug 2026 15:44:25 +0300 Subject: [PATCH] Fix some upcoming clippy lints --- .../src/legacy_protocol/msg/flat.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs b/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs index ae03be9aa7a2..3d11edc2091b 100644 --- a/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs +++ b/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs @@ -67,10 +67,11 @@ pub fn serialize_span_data_index_map(map: &SpanDataIndexMap) -> Vec { } pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap { - debug_assert!(map.len().is_multiple_of(5)); - map.chunks_exact(5) - .map(|span| { - let &[file_id, ast_id, start, end, e] = span else { unreachable!() }; + let (chunks, remainder) = map.as_chunks(); + debug_assert!(remainder.is_empty()); + chunks + .iter() + .map(|&[file_id, ast_id, start, end, e]| { Span { anchor: SpanAnchor { file_id: EditionedFileId::from_raw(file_id), @@ -345,10 +346,9 @@ impl FlatTree { } fn read_vec T, const N: usize>(xs: Vec, f: F) -> Vec { - let mut chunks = xs.chunks_exact(N); - let res = chunks.by_ref().map(|chunk| f(chunk.try_into().unwrap())).collect(); - assert!(chunks.remainder().is_empty()); - res + let (chunks, remainder) = xs.as_chunks(); + assert!(remainder.is_empty()); + chunks.iter().copied().map(f).collect() } fn write_vec [u32; N], const N: usize>(xs: Vec, f: F) -> Vec {