From 670fb243fd8514b59ab15e882982320090ed0ae2 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Tue, 28 Apr 2026 05:08:39 +0900 Subject: [PATCH] test_nice.rs: remove unsafe (#12040) --- tests/by-util/test_nice.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 8dac25277..5b99daafe 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -2,17 +2,15 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore libc's setpriority +// spell-checker:ignore getpriority setpriority use uutests::new_ucmd; #[test] #[cfg(not(target_os = "android"))] fn test_get_current_niceness() { - // Test that the nice command with no arguments returns the default nice - // value, which we determine by querying libc's `nice` in our own process. - new_ucmd!() - .succeeds() - .stdout_is(format!("{}\n", unsafe { libc::nice(0) })); + // Test that the nice command with no arguments returns the default nice value + let nice = rustix::process::getpriority_process(None).unwrap(); + new_ucmd!().succeeds().stdout_is(format!("{nice}\n")); } #[test]