[PR #652] [MERGED] clean up imports & clippy lints #1000

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

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/652
Author: @leshow
Created: 2/25/2021
Status: Merged
Merged: 3/9/2021
Merged by: @ashthespy

Base: tokio_migrationHead: cleanup


📝 Commits (2)

📊 Changes

27 files changed (+167 additions, -207 deletions)

View changed files

📝 audio/src/fetch.rs (+23 -36)
📝 audio/src/lewton_decoder.rs (+5 -5)
📝 audio/src/lib.rs (+3 -3)
📝 audio/src/passthrough_decoder.rs (+7 -7)
📝 audio/src/range_set.rs (+10 -13)
📝 connect/src/discovery.rs (+10 -13)
📝 core/src/apresolve.rs (+2 -2)
📝 core/src/authentication.rs (+4 -4)
📝 core/src/channel.rs (+3 -3)
📝 core/src/diffie_hellman.rs (+2 -2)
📝 core/src/mercury/mod.rs (+21 -23)
📝 core/src/mercury/sender.rs (+2 -2)
📝 core/src/session.rs (+2 -7)
📝 core/src/spotify_id.rs (+4 -4)
📝 core/tests/connect.rs (+30 -29)
📝 metadata/src/lib.rs (+1 -1)
📝 playback/src/audio_backend/gstreamer.rs (+3 -5)
📝 playback/src/audio_backend/jackaudio.rs (+1 -1)
📝 playback/src/audio_backend/mod.rs (+1 -1)
📝 playback/src/audio_backend/pulseaudio.rs (+2 -2)

...and 7 more files

📄 Description

I based this off the tokio_migration branch since that seems to be the most up to date. When I familiarize myself with a codebase I often go through and clean up little things. I cleaned up:

  • the imports (merged & formatted)
  • removed stuff from edition 2015 that's no longer needed (extern crate)
  • removed last instance of error_chain
  • applied lots of clippy lints
  • StreamLoaderController in audio had methods which didn't need to be &mut self anymore

There should be no real code changes here, it's all just cleanups.

There's more I'd like to do but this is already big enough for a PR. I'd like to start removing the unwrap and expects in the code. The common practice these days is to use a boxed error type for binary, and Error derive (like thiserror) on library code. Given that, I think we should consider anyhow for the binary, we can replace unwrap/expect with .context and use ?.

Now that the code is written in async/await format, there looks to be a lot more we could potentially simplify. Anyway, let me know what you think for now! Thanks!


🔄 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/652 **Author:** [@leshow](https://github.com/leshow) **Created:** 2/25/2021 **Status:** ✅ Merged **Merged:** 3/9/2021 **Merged by:** [@ashthespy](https://github.com/ashthespy) **Base:** `tokio_migration` ← **Head:** `cleanup` --- ### 📝 Commits (2) - [`6a33eb4`](https://github.com/librespot-org/librespot/commit/6a33eb4efa72f2062af9153a4fb0a75ac40e2ab3) minor cleanup - [`3388508`](https://github.com/librespot-org/librespot/commit/3388508141bbbfe97f978381e2878bd898ceaa6c) use current_thread ### 📊 Changes **27 files changed** (+167 additions, -207 deletions) <details> <summary>View changed files</summary> 📝 `audio/src/fetch.rs` (+23 -36) 📝 `audio/src/lewton_decoder.rs` (+5 -5) 📝 `audio/src/lib.rs` (+3 -3) 📝 `audio/src/passthrough_decoder.rs` (+7 -7) 📝 `audio/src/range_set.rs` (+10 -13) 📝 `connect/src/discovery.rs` (+10 -13) 📝 `core/src/apresolve.rs` (+2 -2) 📝 `core/src/authentication.rs` (+4 -4) 📝 `core/src/channel.rs` (+3 -3) 📝 `core/src/diffie_hellman.rs` (+2 -2) 📝 `core/src/mercury/mod.rs` (+21 -23) 📝 `core/src/mercury/sender.rs` (+2 -2) 📝 `core/src/session.rs` (+2 -7) 📝 `core/src/spotify_id.rs` (+4 -4) 📝 `core/tests/connect.rs` (+30 -29) 📝 `metadata/src/lib.rs` (+1 -1) 📝 `playback/src/audio_backend/gstreamer.rs` (+3 -5) 📝 `playback/src/audio_backend/jackaudio.rs` (+1 -1) 📝 `playback/src/audio_backend/mod.rs` (+1 -1) 📝 `playback/src/audio_backend/pulseaudio.rs` (+2 -2) _...and 7 more files_ </details> ### 📄 Description I based this off the `tokio_migration` branch since that seems to be the most up to date. When I familiarize myself with a codebase I often go through and clean up little things. I cleaned up: - the imports (merged & formatted) - removed stuff from edition 2015 that's no longer needed (extern crate) - removed last instance of error_chain - applied lots of clippy lints - `StreamLoaderController` in audio had methods which didn't need to be `&mut self` anymore There should be no _real_ code changes here, it's all just cleanups. There's more I'd like to do but this is already big enough for a PR. I'd like to start removing the `unwrap` and `expect`s in the code. The common practice these days is to use a boxed error type for binary, and `Error` derive (like `thiserror`) on library code. Given that, I think we should consider `anyhow` for the binary, we can replace `unwrap`/`expect` with `.context` and use `?`. Now that the code is written in async/await format, there looks to be a lot more we could potentially simplify. Anyway, let me know what you think for now! Thanks! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:00:46 +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#1000
No description provided.