Skip to content

Commit de6f2f9

Browse files
Use Vec::extend+std::iter::repeat rather than creating a byte slice
Co-Authored-By: Noah <[email protected]>
1 parent f434898 commit de6f2f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vm/src/obj/objbyteinner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ pub fn bytes_zfill(bytes: &[u8], width: usize) -> Vec<u8> {
14551455
};
14561456
let mut filled = Vec::new();
14571457
filled.extend_from_slice(sign);
1458-
filled.extend_from_slice(&b"0".repeat(width - bytes.len()));
1458+
filled.extend(std::iter::repeat(b'0').take(width - bytes.len()));
14591459
filled.extend_from_slice(s);
14601460
filled
14611461
}

0 commit comments

Comments
 (0)