Skip to content

Commit 441113f

Browse files
committed
style(execve): use name.len() per clippy needless_as_bytes
make fmt / clippy: name.as_bytes().len() → name.len()(字符串可直接调 len())。 Refs: #2149 Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
1 parent 6512d5e commit 441113f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/src/process/execve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn do_execve_internal(
230230
{
231231
let basic_guard = pcb.basic();
232232
let name = basic_guard.name();
233-
comm_len = name.as_bytes().len().min(15);
233+
comm_len = name.len().min(15);
234234
// 回退到 UTF-8 字符边界,避免在多字节字符中间截断导致 from_utf8 失败。
235235
while comm_len > 0 && !name.is_char_boundary(comm_len) {
236236
comm_len -= 1;

0 commit comments

Comments
 (0)