refactor(rust): restrict test-only functions

check_from_deezer and the lyrics cache_size accessor are only called by
unit tests in their own crate, so compile them only for tests and narrow
them to the crate.

call_download is only used by the extensions integration tests, which
can only reach public items; the download manager goes through
call_download_provider. Keep it public but hide it from the docs.

RequestLease::wait_cancelled stays public: the extensions crate's unit
tests call it across the crate boundary and a later coalescer change is
expected to use it.
This commit is contained in:
zarzet committed 2026-10-18 22:22:57 +07:00
1 parent ef5fa1cb46
commit d60baee4a7
3 files changed
+7 -2

No files matched your search

@@ -570,6 +570,9 @@ impl ExtensionRuntime {
/// Native provider-manager entry point. Resolver/callback/retry time shares
/// one allowance; established native media reads pause only that allowance.
// Public only for the integration tests in `tests/`; the download manager
// uses `call_download_provider`.
#[doc(hidden)]
pub fn call_download(
&self,
method: &str,
@@ -162,7 +162,8 @@ impl LyricsService {
Ok(())
}
pub fn cache_size(&self) -> usize {
#[cfg(test)]
pub(crate) fn cache_size(&self) -> usize {
self.inner.cache.len()
}
@@ -148,7 +148,8 @@ impl AvailabilityService {
self.with_raw(check, |resolver, check| album(resolver, id, check))
}
pub fn check_from_deezer(
#[cfg(test)]
pub(crate) fn check_from_deezer(
&self,
id: &str,
check: &Check<'_>,