Commit 1b04b466 authored by Tamir Duberstein's avatar Tamir Duberstein Committed by Danilo Krummrich
Browse files

rust: alloc: refactor `Vec::truncate` using `dec_len`



Use `checked_sub` to satisfy the safety requirements of `dec_len` and
replace nearly the whole body of `truncate` with a call to `dec_len`.

Reviewed-by: default avatarAndrew Ballance <andrewjballance@gmail.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarTamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250416-vec-set-len-v4-3-112b222604cd@gmail.com


[ Remove #[expect(unused)] from dec_len(). - Danilo ]
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
parent dbb0b840
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment