diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0c152ae..e886bb5 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,5 @@ 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 + # setrlimit64 error in the CI container, macOS not supported + if: matrix.os != 'ubuntu-24.04' && matrix.os != 'macos-14' diff --git a/src/lib.rs b/src/lib.rs index de4f807..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 } @@ -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); } } } 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:?})" ))), } } 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)