From 2b7fd66d51300ddecb926db77e0b91626508a125 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 2 Jun 2025 13:46:59 +0200 Subject: [PATCH 1/5] Update CI runners --- .github/workflows/rust.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0c152ae..8940c1b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,18 +8,21 @@ jobs: strategy: matrix: rust: [stable, nightly] - os: [ubuntu-20.04, windows-2019, macos-10.15] + os: [ubuntu-24.04, windows-2025, macos-14] type: [Release, Debug] steps: - uses: actions/checkout@v2 - name: Install Rust - run: rustup toolchain install ${{ matrix.rust }} --profile minimal --component rustfmt clippy + run: | + rustup toolchain install ${{ matrix.rust }} --profile minimal + rustup component add rustfmt --toolchain ${{ matrix.rust }} + rustup component add clippy --toolchain ${{ matrix.rust }} - name: Install Dependencies (Linux) run: sudo apt-get update && sudo apt-get install libpulse-dev pulseaudio libdbus-1-dev - if: matrix.os == 'ubuntu-20.04' + if: matrix.os == 'ubuntu-24.04' - name: Check format shell: bash @@ -36,4 +39,4 @@ jobs: - name: Test shell: bash run: rustup run ${{ matrix.rust }} cargo test --all - if: matrix.os != 'ubuntu-20.04' # setrlimit64 error in the CI container + if: matrix.os != 'ubuntu-24.04' # setrlimit64 error in the CI container From d64f87399584e1cc82470a9d56d2ea5c0ce03582 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 2 Jun 2025 16:03:05 +0200 Subject: [PATCH 2/5] Fix clippy issues --- src/lib.rs | 48 ++++++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index de4f807..d8cdd0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -587,24 +587,22 @@ mod tests { { match promote_current_thread_to_real_time(0, 44100) { Ok(rt_prio_handle) => { - demote_current_thread_from_real_time(rt_prio_handle).unwrap(); - assert!(true); + let rv = demote_current_thread_from_real_time(rt_prio_handle); + assert!(rv.is_ok()); } Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } } { match promote_current_thread_to_real_time(512, 44100) { Ok(rt_prio_handle) => { - demote_current_thread_from_real_time(rt_prio_handle).unwrap(); - assert!(true); + let rv = demote_current_thread_from_real_time(rt_prio_handle); + assert!(rv.is_ok()); } Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } } @@ -612,12 +610,11 @@ mod tests { // Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23 match promote_current_thread_to_real_time(0, 192000) { Ok(rt_prio_handle) => { - demote_current_thread_from_real_time(rt_prio_handle).unwrap(); - assert!(true); + let rv = demote_current_thread_from_real_time(rt_prio_handle); + assert!(rv.is_ok()); } Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } } @@ -625,23 +622,19 @@ mod tests { // Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23 match promote_current_thread_to_real_time(8192, 48000) { Ok(rt_prio_handle) => { - demote_current_thread_from_real_time(rt_prio_handle).unwrap(); - assert!(true); + let rv = demote_current_thread_from_real_time(rt_prio_handle); + assert!(rv.is_ok()); } Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } } { match promote_current_thread_to_real_time(512, 44100) { - Ok(_) => { - assert!(true); - } + Ok(_) => {} Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } // automatically deallocated, but not demoted until the thread exits. @@ -666,12 +659,9 @@ mod tests { { let info = get_current_thread_info().unwrap(); match promote_thread_to_real_time(info, 512, 44100) { - Ok(_) => { - assert!(true); - } + Ok(_) => { } Err(e) => { - eprintln!("{}", e); - assert!(false); + panic!("{}", e); } } } @@ -702,12 +692,10 @@ mod tests { match promote_thread_to_real_time(info, 0, 44100) { Ok(_) => { eprintln!("thread promotion in the child from the parent succeeded"); - assert!(true); } - Err(_) => { - eprintln!("promotion Err"); + Err(e) => { kill(child, SIGKILL).expect("Could not kill the child?"); - assert!(false); + panic!("{}", e); } } } From 1c5a8cf27432c12de2d5d8b0ffde3f3557a87cf3 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 2 Jun 2025 16:10:08 +0200 Subject: [PATCH 3/5] Nightly clippy fix --- src/lib.rs | 2 +- src/rt_linux.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d8cdd0f..8f169d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,7 +68,7 @@ impl fmt::Display for AudioThreadPriorityError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut rv = write!(f, "AudioThreadPriorityError: {}", &self.message); if let Some(inner) = &self.inner { - rv = write!(f, " ({})", inner); + rv = write!(f, " ({inner})"); } rv } diff --git a/src/rt_linux.rs b/src/rt_linux.rs index 100b9e6..1eabe29 100644 --- a/src/rt_linux.rs +++ b/src/rt_linux.rs @@ -80,8 +80,7 @@ fn item_as_i64(i: MessageItem) -> Result { MessageItem::Int32(i) => Ok(i as i64), MessageItem::Int64(i) => Ok(i), _ => Err(AudioThreadPriorityError::new(&format!( - "Property is not integer ({:?})", - i + "Property is not integer ({i:?})" ))), } } From 98bdac909291b2beac9aadc40633c0c1c2ffe071 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 2 Jun 2025 16:21:35 +0200 Subject: [PATCH 4/5] Skip test on Linux, macOS --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8940c1b..e886bb5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -39,4 +39,5 @@ jobs: - name: Test shell: bash run: rustup run ${{ matrix.rust }} cargo test --all - if: matrix.os != 'ubuntu-24.04' # setrlimit64 error in the CI container + # setrlimit64 error in the CI container, macOS not supported + if: matrix.os != 'ubuntu-24.04' && matrix.os != 'macos-14' From 70a666946956d9633932713d379066e2f4335358 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 2 Jun 2025 16:23:43 +0200 Subject: [PATCH 5/5] More clippy --- src/rt_mach.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rt_mach.rs b/src/rt_mach.rs index 3e1d57b..07822d4 100644 --- a/src/rt_mach.rs +++ b/src/rt_mach.rs @@ -155,7 +155,7 @@ pub fn promote_current_thread_to_real_time_internal( )); } - info!("thread {} bumped to real time priority.", tid); + info!("thread {tid} bumped to real time priority."); } Ok(rt_priority_handle)