[PR #1635] [MERGED] Make SpotifyId base62 / base16 methods infallible #1470

Closed
opened 2026-02-27 20:02:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1635
Author: @wfraser
Created: 11/12/2025
Status: Merged
Merged: 11/14/2025
Merged by: @photovoltex

Base: devHead: spotify-id-base62-infallible


📝 Commits (4)

  • 2950d73 make SpotifyId::to_base62() infallible
  • 51c4480 make {SpotifyId, FileId}::to_base16() infallible too
  • 7f3203f fix core unit tests
  • f2e80f0 changelog entry

📊 Changes

9 files changed (+168 additions, -264 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 core/src/cache.rs (+6 -11)
📝 core/src/file_id.rs (+8 -6)
📝 core/src/spclient.rs (+8 -8)
📝 core/src/spotify_id.rs (+14 -42)
📝 core/src/spotify_uri.rs (+8 -10)
📝 metadata/src/playlist/annotation.rs (+1 -1)
📝 playback/src/player.rs (+1 -4)
📝 src/player_event_handler.rs (+118 -182)

📄 Description

For both of these, the only error case is a non-utf8 string, which is impossible since we're building it from a fixed alphabet.

This allows removing a bunch of unnecessary error handling branches.

Also, for base16, there's no need to implement parsing/formatting, just use the stdlib's hex conversion/formatting code.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/1635 **Author:** [@wfraser](https://github.com/wfraser) **Created:** 11/12/2025 **Status:** ✅ Merged **Merged:** 11/14/2025 **Merged by:** [@photovoltex](https://github.com/photovoltex) **Base:** `dev` ← **Head:** `spotify-id-base62-infallible` --- ### 📝 Commits (4) - [`2950d73`](https://github.com/librespot-org/librespot/commit/2950d73abe8ac765f046bff8818de6f3c7527b3c) make SpotifyId::to_base62() infallible - [`51c4480`](https://github.com/librespot-org/librespot/commit/51c4480c64a1bae1c31132907528498450bdbbf2) make {SpotifyId, FileId}::to_base16() infallible too - [`7f3203f`](https://github.com/librespot-org/librespot/commit/7f3203f835681fbebdaff6e119f159dd952e76d4) fix core unit tests - [`f2e80f0`](https://github.com/librespot-org/librespot/commit/f2e80f040a3d1b2e7ef205acf180b63acd75c0cd) changelog entry ### 📊 Changes **9 files changed** (+168 additions, -264 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `core/src/cache.rs` (+6 -11) 📝 `core/src/file_id.rs` (+8 -6) 📝 `core/src/spclient.rs` (+8 -8) 📝 `core/src/spotify_id.rs` (+14 -42) 📝 `core/src/spotify_uri.rs` (+8 -10) 📝 `metadata/src/playlist/annotation.rs` (+1 -1) 📝 `playback/src/player.rs` (+1 -4) 📝 `src/player_event_handler.rs` (+118 -182) </details> ### 📄 Description For both of these, the only error case is a non-utf8 string, which is impossible since we're building it from a fixed alphabet. This allows removing a bunch of unnecessary error handling branches. Also, for base16, there's no need to implement parsing/formatting, just use the stdlib's hex conversion/formatting code. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:02:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#1470
No description provided.