In some crates I need to use some test utilities I've created. Recently I found use for those test utils in my documentation's examples.
As a concrete example, since the Rust API Guidelines recommends using ? in examples, I created an AnyError struct so that I can use ? on different results.
The problem is that this AnyError struct is not meant to be public, it is just a test utility for this kind of cases, yet documentation tests are tested in an environment that is not flagged as test (so no #[cfg(test)] possible on the test_utils module), and seems to be run in an external environment (so pub(crate) won't cut it either) .
Should I really put those test utilities in public? or how would you solve this issue?
PS: I want to keep my dependencies at a minimum, so no dependencies on libs that do something similar to my AnyError struct