Skip to content

Commit db086c8

Browse files
committed
release: 0.5.0
2 parents 916291a + 04db5d6 commit db086c8

13 files changed

+179
-88
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33

44

5+
## [0.5.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.5.0) - 2024-09-05
6+
7+
### Changed
8+
9+
* Miscellaneous code cleanup and lints
10+
* Improved documentation
11+
* Bump MSRV to `1.81`
12+
* Bump `brunch` to `0.6`
13+
14+
15+
516
## [0.4.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.4.0) - 2024-07-29
617

718
### Changed

CREDITS.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Project Dependencies
22
Package: cdtoc
3-
Version: 0.4.0
4-
Generated: 2024-07-29 19:36:09 UTC
3+
Version: 0.5.0
4+
Generated: 2024-09-05 19:43:40 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
88
| [block-buffer](https://github.com/RustCrypto/utils) | 0.10.4 | RustCrypto Developers | Apache-2.0 or MIT |
99
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:alex@alexcrichton.com) | Apache-2.0 or MIT |
1010
| [crypto-common](https://github.com/RustCrypto/traits) | 0.1.6 | RustCrypto Developers | Apache-2.0 or MIT |
11-
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.2 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
11+
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.3 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
1212
| [digest](https://github.com/RustCrypto/traits) | 0.10.7 | RustCrypto Developers | Apache-2.0 or MIT |
1313
| [faster-hex](https://github.com/NervosFoundation/faster-hex) | 0.9.0 | [zhangsoledad](mailto:787953403@qq.com) | MIT |
1414
| [generic-array](https://github.com/fizyk20/generic-array.git) | 0.14.7 | [Bartłomiej Kamiński](mailto:fizyk20@gmail.com) and [Aaron Trent](mailto:novacrazy@gmail.com) | MIT |
1515
| [itoa](https://github.com/dtolnay/itoa) | 1.0.11 | [David Tolnay](mailto:dtolnay@gmail.com) | Apache-2.0 or MIT |
1616
| [sha1](https://github.com/RustCrypto/hashes) | 0.10.6 | RustCrypto Developers | Apache-2.0 or MIT |
17-
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.0 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
17+
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.1 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
1818
| [typenum](https://github.com/paholg/typenum) | 1.17.0 | [Paho Lurie-Gregg](mailto:paho@paholg.com) and [Andre Bogus](mailto:bogusandre@gmail.com) | Apache-2.0 or MIT |

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "cdtoc"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
authors = ["Blobfolio, LLC. <hello@blobfolio.com>"]
55
edition = "2021"
6-
rust-version = "1.80"
6+
rust-version = "1.81"
77
description = "Parser and tools for CDTOC metadata tags."
88
license = "WTFPL"
99
repository = "https://github.com/Blobfolio/cdtoc"
@@ -30,7 +30,7 @@ features = [ "accuraterip", "cddb", "ctdb", "musicbrainz", "serde" ]
3030
default-target = "x86_64-unknown-linux-gnu"
3131

3232
[dev-dependencies]
33-
brunch = "0.5.*"
33+
brunch = "0.6.*"
3434
serde_json = "1.0.*"
3535

3636
[dependencies]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ Add `cdtoc` to your `dependencies` in `Cargo.toml`, like:
6262

6363
```toml
6464
[dependencies]
65-
cdtoc = "0.4.*"
65+
cdtoc = "0.5.*"
6666
```
6767

6868
The disc ID helpers require additional dependencies, so if you aren't using them, be sure to disable the default features (adding back any you _do_ want) to skip the overhead.
6969

7070
```toml
7171
[dependencies.cdtoc]
72-
version = "0.4.*"
72+
version = "0.5.*"
7373
default-features = false
7474
```
7575

src/accuraterip.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl fmt::Display for AccurateRip {
8484
}
8585

8686
impl From<&Toc> for AccurateRip {
87-
#[allow(clippy::cast_possible_truncation)]
87+
#[expect(clippy::cast_possible_truncation, reason = "False positive.")]
8888
fn from(src: &Toc) -> Self {
8989
let mut b: u32 = 0;
9090
let mut c: u32 = 0;
@@ -332,7 +332,15 @@ impl AccurateRip {
332332
/// empty.
333333
pub fn parse_drive_offsets(raw: &[u8])
334334
-> Result<BTreeMap<(&str, &str), i16>, TocError> {
335+
/// # Block Size.
336+
///
337+
/// The size of each raw entry, in bytes.
335338
const BLOCK_SIZE: usize = 69;
339+
340+
/// # Trim Callback.
341+
///
342+
/// This is used to trim both ASCII whitespace and control characters,
343+
/// as the raw data isn't afraid to null-pad its entries.
336344
const fn trim_vm(c: char) -> bool { c.is_ascii_whitespace() || c.is_ascii_control() }
337345

338346
// There should be thousands of blocks, but we _need_ at least one!
@@ -342,7 +350,7 @@ impl AccurateRip {
342350
// little-endian offset; the next 32 hold the vendor/model; the rest
343351
// we can ignore!
344352
let mut out = BTreeMap::default();
345-
for chunk in raw.chunks_exact(69) {
353+
for chunk in raw.chunks_exact(BLOCK_SIZE) {
346354
// The offset is easy!
347355
let offset = i16::from_le_bytes([chunk[0], chunk[1]]);
348356

@@ -387,7 +395,7 @@ impl AccurateRip {
387395
else { Ok(out) }
388396
}
389397

390-
#[allow(unsafe_code)]
398+
#[expect(unsafe_code, reason = "For performance.")]
391399
#[must_use]
392400
/// # Pretty Print.
393401
///
@@ -421,8 +429,9 @@ impl AccurateRip {
421429
faster_hex::hex_encode_fallback(&[self.0[8], self.0[7], self.0[6], self.0[5]], &mut out[13..21]);
422430
faster_hex::hex_encode_fallback(&[self.0[12], self.0[11], self.0[10], self.0[9]], &mut out[22..]);
423431

424-
// Safety: all bytes are ASCII.
425432
debug_assert!(out.is_ascii(), "Bug: AccurateRip checksum is not ASCII?!");
433+
434+
// Safety: all bytes are ASCII.
426435
unsafe { String::from_utf8_unchecked(out) }
427436
}
428437
}

src/cddb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl From<Cddb> for u32 {
7777
}
7878

7979
impl From<&Toc> for Cddb {
80-
#[allow(clippy::cast_possible_truncation)]
80+
#[expect(clippy::cast_possible_truncation, reason = "False positive.")]
8181
fn from(src: &Toc) -> Self {
8282
let mut len = src.audio_len();
8383
let mut a: u32 = 0;

src/ctdb.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ use std::collections::BTreeMap;
1313

1414

1515

16+
/// # Stereo Sample Chunk Size.
17+
///
18+
/// Each CDDA sample has a 16-bit left and 16-bit right value; combined they're
19+
/// four bytes.
1620
const CHUNK_SIZE: usize = 4;
1721

1822

1923

2024
impl Toc {
2125
#[cfg_attr(docsrs, doc(cfg(feature = "ctdb")))]
22-
#[allow(clippy::missing_panics_doc)]
26+
#[expect(clippy::missing_panics_doc, reason = "Panic is unreachable.")]
2327
#[must_use]
2428
/// # CUETools Database ID.
2529
///
@@ -114,7 +118,7 @@ impl Toc {
114118
/// );
115119
/// ```
116120
pub fn ctdb_checksum_url(&self) -> String {
117-
let mut url = "http://db.cuetools.net/lookup2.php?version=3&ctdb=1&fuzzy=1&toc=".to_string();
121+
let mut url = "http://db.cuetools.net/lookup2.php?version=3&ctdb=1&fuzzy=1&toc=".to_owned();
118122
let mut buf = itoa::Buffer::new();
119123

120124
// Leading data?

0 commit comments

Comments
 (0)