diff options
author | Tamir Duberstein <tamird@gmail.com> | 2025-04-16 13:15:42 -0400 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-04-23 12:05:22 +0200 |
commit | 1b04b466c873f62413bf65a05a558f036660aedc (patch) | |
tree | 4f28ce9cc1f562e7c4f827b0f126f36766e5dc01 /rust/kernel/alloc/layout.rs | |
parent | dbb0b840a0cd2ebabbc94a0040e366c7f1a70f7b (diff) |
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: Andrew Ballance <andrewjballance@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir 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: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/layout.rs')
0 files changed, 0 insertions, 0 deletions