Skip to content

Commit db64166

Browse files
committed
Remove no-panic testing because of Windows
- Windows gives different results than macOS - could be fixed by setting lto="thin"?
1 parent b91b3c4 commit db64166

File tree

6 files changed

+2
-30
lines changed

6 files changed

+2
-30
lines changed

Cargo.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
[package]
22
name = "aifc"
3-
version = "0.5.0"
3+
version = "0.5.2"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
99
audio-codec-algorithms = "0.6.0"
10-
no-panic = { version = "0.1", optional = true }
11-
12-
[features]
13-
internal-no-panic = ["dep:no-panic"] # no-panic check is only for testing
1410

1511
[dev-dependencies]
1612
criterion = { version = "0.5.1" }

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ for sample in reader.samples().expect("Can't iterate samples") {
3434
}
3535
```
3636

37-
Writing AIFF-C file (with the default 2 channels, 16 bits/sample, sample rate 44100):
37+
Writing AIFF-C file with the default 2 channels, 16 bits/sample and sample rate 44100:
3838

3939
```rust, no_run
4040
let mut stream = std::io::BufWriter::new(std::fs::File::create("test.aiff").expect("Open failed"));

src/chunks.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
use crate::{cast, AifcError, AifcResult, MarkerId, Write};
44

5-
#[cfg(feature = "internal-no-panic")]
6-
use no_panic::no_panic;
7-
85
fn read_u16_from_pos(data: &[u8], pos: &mut usize) -> AifcResult<u16> {
96
let Some(pos_end) = pos.checked_add(2) else {
107
return Err(AifcError::StdIoError(crate::unexpectedeof()));
@@ -431,7 +428,6 @@ impl Instrument {
431428
/// the base note value.
432429
///
433430
/// This method doesn't check that the instrument values are in a valid range.
434-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
435431
pub fn copy_to_slice(&self, slice: &mut [u8; 20]) {
436432
slice[0] = cast::i8_to_u8(self.base_note);
437433
slice[1] = cast::i8_to_u8(self.detune);

src/f80.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
use crate::cast;
22

3-
#[cfg(feature = "internal-no-panic")]
4-
use no_panic::no_panic;
5-
63
/// Converts a 80-bit extended floating point value to a 64-bit floating point value.
7-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
84
pub fn f80_to_f64(bytes: &[u8]) -> f64 {
95
assert_eq!(bytes.len(), 10);
106

@@ -74,7 +70,6 @@ pub fn f80_to_f64(bytes: &[u8]) -> f64 {
7470
}
7571

7672
/// Converts a 64-bit floating point value to a 80-bit extended floating point value.
77-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
7873
pub fn f64_to_f80(value: f64) -> [u8; 10] {
7974
if !value.is_finite() {
8075
if !value.is_nan() {

src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
clippy::checked_conversions,
7171
)]
7272

73-
#[cfg(feature = "internal-no-panic")]
74-
use no_panic::no_panic;
75-
7673
// silly way to test rust code blocks in README.md
7774
// https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html
7875
#[doc = include_str!("../README.md")]
@@ -223,7 +220,6 @@ pub enum SampleFormat {
223220
impl SampleFormat {
224221
/// Returns the size of the decoded sample in bytes.
225222
/// Custom formats always return 0.
226-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
227223
pub fn decoded_size(&self) -> usize {
228224
match &self {
229225
SampleFormat::U8 => 1,
@@ -242,7 +238,6 @@ impl SampleFormat {
242238

243239
/// Returns the size of the sample in the stream in bytes.
244240
/// CompressedIma4 returns 0. Custom formats return 1 (they are assumed to write single bytes).
245-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
246241
#[inline(always)]
247242
fn encoded_size(&self) -> u64 {
248243
match &self {
@@ -261,7 +256,6 @@ impl SampleFormat {
261256
}
262257

263258
/// Calculates the sample count based on byte length and sample format.
264-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
265259
fn calculate_sample_len(&self, sample_byte_len: u32) -> Option<u64> {
266260
match self {
267261
SampleFormat::CompressedIma4 => {
@@ -277,7 +271,6 @@ impl SampleFormat {
277271
}
278272

279273
/// The maximum channel count for the sample format.
280-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
281274
fn maximum_channel_count(&self) -> i16 {
282275
match self {
283276
SampleFormat::CompressedIma4 => 2,
@@ -287,7 +280,6 @@ impl SampleFormat {
287280

288281
/// Returns the COMM chunk's bits per sample value for the writer.
289282
/// Compressed formats and custom formats return 0.
290-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
291283
fn bits_per_sample(&self) -> u8 {
292284
match &self {
293285
SampleFormat::U8 => 8,
@@ -341,7 +333,6 @@ struct CountingWrite<W> where W: Write {
341333
}
342334

343335
impl<W: Write> CountingWrite<W> {
344-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
345336
pub fn new(handle: W) -> CountingWrite<W> {
346337
CountingWrite {
347338
handle,
@@ -367,17 +358,14 @@ impl<W: Write> Write for CountingWrite<W> {
367358
}
368359
}
369360

370-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
371361
fn is_even_u32(value: u32) -> bool {
372362
value & 1 == 0
373363
}
374364

375-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
376365
fn is_even_u64(value: u64) -> bool {
377366
value & 1 == 0
378367
}
379368

380-
#[cfg_attr(feature = "internal-no-panic", no_panic)]
381369
fn is_even_usize(value: usize) -> bool {
382370
value & 1 == 0
383371
}

tools/test.sh

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ else
1818
cargo test
1919
fi
2020

21-
# check that some functions never panic
22-
cargo test --release --features internal-no-panic
23-
2421
# build the toisto tester for the test suite
2522
cargo build --example aifc-toisto
2623

0 commit comments

Comments
 (0)