From d1301d9c4b578ca16ff020acdb86a1468eb024ac Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Thu, 16 Apr 2026 21:24:29 +0100 Subject: [PATCH 1/2] clippy: warn for large_stack_arrays lint https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#large_stack_arrays --- .clippy.toml | 3 ++- Cargo.toml | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index f5d31e36315..dc3347cd6a0 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,5 +1,6 @@ +allow-mixed-uninlined-format-args = false +array-size-threshold = 262144 avoid-breaking-exported-api = false check-private-items = true cognitive-complexity-threshold = 24 missing-docs-in-crate-items = true -allow-mixed-uninlined-format-args = false diff --git a/Cargo.toml b/Cargo.toml index 9c153196b97..75b6b07c855 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -726,9 +726,6 @@ collapsible_if = { level = "allow", priority = 127 } # remove me # | jq -r '.message.code.code | select(. != null and startswith("clippy::"))' \ # | sort | uniq -c | sort -h -r # -# TODO: -# remove large_stack_arrays when https://github.com/rust-lang/rust-clippy/issues/13774 is fixed -# all = { level = "warn", priority = -1 } cargo = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } @@ -748,7 +745,6 @@ cast_precision_loss = "allow" # 52 cast_lossless = "allow" # 35 ignored_unit_patterns = "allow" # 21 similar_names = "allow" # 20 -large_stack_arrays = "allow" # 20 needless_pass_by_value = "allow" # 16 float_cmp = "allow" # 12 items_after_statements = "allow" # 11 From e9cb33d31254d1a71d9ef6a63031dd57c094c43f Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Thu, 16 Apr 2026 22:05:14 +0100 Subject: [PATCH 2/2] clippy: lower array-size-threshold to ~64 KiB --- .clippy.toml | 2 +- src/uu/wc/src/count_fast.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index dc3347cd6a0..9eedc78eca1 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,5 +1,5 @@ allow-mixed-uninlined-format-args = false -array-size-threshold = 262144 +array-size-threshold = 65538 avoid-breaking-exported-api = false check-private-items = true cognitive-complexity-threshold = 24 diff --git a/src/uu/wc/src/count_fast.rs b/src/uu/wc/src/count_fast.rs index 79c9f822738..b84ac634ef4 100644 --- a/src/uu/wc/src/count_fast.rs +++ b/src/uu/wc/src/count_fast.rs @@ -29,7 +29,7 @@ use libc::S_IFIFO; #[cfg(any(target_os = "linux", target_os = "android"))] use uucore::pipes::{MAX_ROOTLESS_PIPE_SIZE, pipe, splice, splice_exact}; -const BUF_SIZE: usize = 256 * 1024; +const BUF_SIZE: usize = 64 * 1024; /// This is a Linux-specific function to count the number of bytes using the /// `splice` system call, which is faster than using `read`.