mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
clippy: fix items_after_statements lint
https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
This commit is contained in:
committed by
Daniel Hofstetter
parent
ff6b2ef716
commit
c2acff22ee
@@ -85,12 +85,6 @@ fn test_short_format_i() {
|
||||
#[test]
|
||||
#[cfg(not(target_os = "openbsd"))]
|
||||
fn test_lookup() {
|
||||
let args = ["--lookup"];
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let actual = ts.ucmd().args(&args).succeeds().stdout_move_str();
|
||||
let expect = unwrap_or_return!(expected_result(&ts, &[])).stdout_move_str();
|
||||
let v_actual: Vec<&str> = actual.split_whitespace().collect();
|
||||
let v_expect: Vec<&str> = expect.split_whitespace().collect();
|
||||
// The "Idle" field (index 3 in header) contains a dynamic time value that can change
|
||||
// between when the two commands run (e.g., "00:09" vs "00:10"), causing flaky tests.
|
||||
// We filter out values matching the idle time pattern (HH:MM format) to avoid race conditions.
|
||||
@@ -120,6 +114,13 @@ fn test_lookup() {
|
||||
.map(|(_, s)| (*s).to_string())
|
||||
.collect()
|
||||
}
|
||||
|
||||
let args = ["--lookup"];
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let actual = ts.ucmd().args(&args).succeeds().stdout_move_str();
|
||||
let expect = unwrap_or_return!(expected_result(&ts, &[])).stdout_move_str();
|
||||
let v_actual: Vec<&str> = actual.split_whitespace().collect();
|
||||
let v_expect: Vec<&str> = expect.split_whitespace().collect();
|
||||
let v_actual_filtered = filter_idle_times(&v_actual);
|
||||
let v_expect_filtered = filter_idle_times(&v_expect);
|
||||
assert_eq!(v_actual_filtered, v_expect_filtered);
|
||||
|
||||
@@ -794,9 +794,6 @@ fn test_files0_stops_after_stdout_write_error() {
|
||||
|
||||
#[test]
|
||||
fn files0_from_dir() {
|
||||
// On Unix, `read(open("."))` fails. On Windows, `open(".")` fails. Thus, the errors happen in
|
||||
// different contexts. On WASI, the error string may differ (e.g., "Bad file descriptor").
|
||||
let wasm = std::env::var("UUTESTS_WASM_RUNNER").is_ok();
|
||||
#[cfg(not(windows))]
|
||||
macro_rules! dir_err {
|
||||
($p:literal) => {
|
||||
@@ -814,6 +811,10 @@ fn files0_from_dir() {
|
||||
#[cfg(not(windows))]
|
||||
const DOT_ERR: &str = dir_err!(".");
|
||||
|
||||
// On Unix, `read(open("."))` fails. On Windows, `open(".")` fails. Thus, the errors happen in
|
||||
// different contexts. On WASI, the error string may differ (e.g., "Bad file descriptor").
|
||||
let wasm = std::env::var("UUTESTS_WASM_RUNNER").is_ok();
|
||||
|
||||
let cmd = new_ucmd!().args(&["--files0-from=dir with spaces"]).fails();
|
||||
if wasm {
|
||||
cmd.stderr_contains("wc: 'dir with spaces': read error:");
|
||||
@@ -874,6 +875,8 @@ fn test_invalid_byte_sequence_word_count() {
|
||||
#[test]
|
||||
#[cfg_attr(wasi_runner, ignore = "WASI sandbox: host paths not visible")]
|
||||
fn test_simd_respects_glibc_tunables() {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
// Ensure debug output reflects that SIMD paths are disabled via GLIBC_TUNABLES
|
||||
let debug_output = new_ucmd!()
|
||||
.args(&["-l", "--debug", "/dev/null"])
|
||||
@@ -892,7 +895,6 @@ fn test_simd_respects_glibc_tunables() {
|
||||
|
||||
// WC results should be identical with and without GLIBC_TUNABLES overrides
|
||||
let sample_sizes = [0usize, 1, 7, 128, 513, 999];
|
||||
use std::fmt::Write as _;
|
||||
for &lines in &sample_sizes {
|
||||
let content: String = (0..lines).fold(String::new(), |mut acc, i| {
|
||||
// Build the input buffer efficiently without allocating per line.
|
||||
|
||||
Reference in New Issue
Block a user