Skip to content

Commit

Permalink
💚 Update coverage attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
inflation committed Oct 13, 2023
1 parent 7053403 commit 1a012aa
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion jpegxl-rs/src/decode/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mod tests {
use super::*;

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_derive() {
println!(
"{:?}",
Expand Down
2 changes: 1 addition & 1 deletion jpegxl-rs/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl<'prl, 'mm> JxlEncoderBuilder<'prl, 'mm> {
// Private helper functions
impl JxlEncoder<'_, '_> {
/// Error mapping from underlying C const to [`EncodeError`] enum
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn check_enc_status(&self, status: JxlEncoderStatus) -> Result<(), EncodeError> {
match status {
JxlEncoderStatus::Success => Ok(()),
Expand Down
4 changes: 2 additions & 2 deletions jpegxl-rs/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod tests {
use super::*;

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn decode_invalid_data() -> TestResult {
let decoder = crate::decoder_builder().build()?;
assert!(matches!(
Expand Down Expand Up @@ -121,7 +121,7 @@ mod tests {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn encode_invalid_data() -> TestResult {
let mut encoder = crate::encoder_builder().has_alpha(true).build()?;

Expand Down
6 changes: 3 additions & 3 deletions jpegxl-rs/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {
use super::*;

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn invalid() -> TestResult {
let decoder = decoder_builder().build()?;
assert!(decoder.decode_to_image(&[]).is_err());
Expand All @@ -157,7 +157,7 @@ mod tests {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn simple() -> TestResult {
let parallel_runner = ThreadsRunner::default();
let decoder = decoder_builder()
Expand All @@ -174,7 +174,7 @@ mod tests {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn pixel_type() -> TestResult {
let parallel_runner = ThreadsRunner::default();
let mut decoder = decoder_builder()
Expand Down
2 changes: 1 addition & 1 deletion jpegxl-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ along with jpegxl-rs. If not, see <https://www.gnu.org/licenses/>.
//! ```
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(coverage_nightly, feature(no_coverage))]
#![cfg_attr(coverage_nightly, feature(coverage))]

#[macro_use]
extern crate derive_builder;
Expand Down
8 changes: 4 additions & 4 deletions jpegxl-rs/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) mod tests {

impl MemoryManager for NoManager {
fn alloc(&self) -> AllocFn {
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
unsafe extern "C" fn alloc(_opaque: *mut c_void, _size: usize) -> *mut c_void {
null_mut()
}
Expand All @@ -70,7 +70,7 @@ pub(crate) mod tests {
}

fn free(&self) -> FreeFn {
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
unsafe extern "C" fn free(_opaque: *mut c_void, _address: *mut c_void) {
debug_assert!(false, "Should not be called");
}
Expand All @@ -96,7 +96,7 @@ pub(crate) mod tests {

impl<const N: usize> MemoryManager for BumpManager<N> {
fn alloc(&self) -> AllocFn {
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
unsafe extern "C" fn alloc<const N: usize>(
opaque: *mut c_void,
size: usize,
Expand Down Expand Up @@ -127,7 +127,7 @@ pub(crate) mod tests {
}

fn free(&self) -> FreeFn {
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
unsafe extern "C" fn free(_opaque: *mut c_void, _address: *mut c_void) {}

free
Expand Down
2 changes: 1 addition & 1 deletion jpegxl-rs/src/parallel/resizable_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
use super::*;

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_construction() -> TestResult {
let memory_manager = BumpManager::<{ 1024 * 5 }>::default();
let parallel_runner = ResizableRunner::new(Some(&memory_manager));
Expand Down
6 changes: 3 additions & 3 deletions jpegxl-src/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(coverage_nightly, feature(no_coverage))]
#![cfg_attr(coverage_nightly, feature(coverage))]

use std::{
env,
Expand All @@ -13,7 +13,7 @@ fn source_dir() -> PathBuf {
)
}

#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
pub fn build() {
let source = source_dir();

Expand Down Expand Up @@ -70,7 +70,7 @@ mod tests {
use super::*;

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_source_dir() {
let mut path = source_dir();
assert!(path.is_dir());
Expand Down
16 changes: 8 additions & 8 deletions jpegxl-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ along with jpegxl-sys. If not, see <https://www.gnu.org/licenses/>.

#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
#![cfg_attr(coverage_nightly, feature(no_coverage))]
#![cfg_attr(coverage_nightly, feature(coverage))]

pub mod butteraugli;
pub mod cms;
Expand Down Expand Up @@ -77,15 +77,15 @@ mod test {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_bindings_version() {
unsafe {
assert_eq!(JxlDecoderVersion(), 8002);
assert_eq!(JxlEncoderVersion(), 8002);
}
}

#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
unsafe fn decode(decoder: *mut JxlDecoder, sample: &[u8]) {
use JxlDecoderStatus::{
BasicInfo, Error, FullImage, NeedImageOutBuffer, NeedMoreInput, Success,
Expand Down Expand Up @@ -171,7 +171,7 @@ mod test {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_bindings_decoding() {
unsafe {
let dec = JxlDecoderCreate(ptr::null()); // Default memory manager
Expand All @@ -186,7 +186,7 @@ mod test {

#[test]
#[cfg(feature = "threads")]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_bindings_thread_pool() {
unsafe {
let runner = JxlThreadParallelRunnerCreate(
Expand All @@ -210,7 +210,7 @@ mod test {

#[test]
#[cfg(feature = "threads")]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_bindings_resizable() {
use JxlDecoderStatus::{
BasicInfo, Error, FullImage, NeedImageOutBuffer, NeedMoreInput, Success,
Expand Down Expand Up @@ -321,7 +321,7 @@ mod test {
}
}

#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn encode(pixels: &[u8], x_size: u32, ysize: u32) -> Vec<u8> {
unsafe {
let enc = JxlEncoderCreate(std::ptr::null());
Expand Down Expand Up @@ -395,7 +395,7 @@ mod test {
}

#[test]
#[cfg_attr(coverage_nightly, no_coverage)]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_bindings_encoding() {
let img = image::load_from_memory_with_format(SAMPLE_PNG, image::ImageFormat::Png).unwrap();
let image_buffer = img.into_rgb8();
Expand Down

0 comments on commit 1a012aa

Please sign in to comment.