disallowed-types = [ { path = "futures::channel::oneshot::Sender", reason = "Use tor_async_utils::oneshot to avoid bug with select macro" }, { path = "futures::channel::oneshot::Receiver", reason = "Use tor_async_utils::oneshot to avoid bug with select macro" }, { path = "futures::task::SpawnExt", reason = "use `tor_rtcompat::SpawnExt`, which is compatible with tokio-console" }, ] # Sometimes clippy doesn't find the method and falsely claims it doesn't exist # https://github.com/rust-lang/rust-clippy/issues/17006 # In that case, we write `allow-invalid = true` and have code in-tree that checks that the method *does* exist. # (See tor_basic_utils::RngExt::gen_range_checked for an example.) # That will detect if the method has been renamed, so that our prohibition remains effective. # (It's not perfect: the crate might provide aliases, wrappers, or other methods with the same problem). disallowed-methods = [ { path = "rand::random_range", reason = "Prefer tor_basic_utils::RngExt::gen_range_checked to avoid uncontrolled panics, or gen_range_infallible if applicable" }, { path = "rand::RngExt::random_range", allow-invalid = true, reason = "Prefer tor_basic_utils::RngExt::gen_range_checked to avoid uncontrolled panics, or gen_range_infallible if applicable" }, { path = "futures::channel::oneshot::channel", reason = "Use tor_async_utils::oneshot to avoid bug with select macro" }, { path = "std::path::Path::display", reason = "See tor_basic_utils::PathExt::display_lossy" }, # { path = "std::time::SystemTime::now", reason = "prefer using SleepProvider::wallclock instead when possible" }, { path = "std::path::Path::exists", reason = "Prefer using std::Path::try_exists or std::fs::exists" }, { path = "retry_error::RetryError::push", reason = "Use push_timed with mockable time sources instead of push which calls SystemTime::now" }, { path = "tor_checkable::TimeBound::if_valid_now", reason = "Use if_valid_at with mockable time sources instead of if_valid_now which calls SystemTime::now" }, { path = "retry_error::RetryError::extend", reason = "Use push_timed in a loop with mockable time sources instead of extend which calls push internally" }, { path = "std::time::Instant::now", reason = "For wasm compatibility, use `web_time_compat::InstantExt::get` instead." }, { path = "std::time::SystemTime::now", reason = "For wasm compatibility, use `web_time_compat::SystemTimeExt::get` instead." }, { path = "time::OffsetDateTime::now_utc", reason = "For wasm compatibility, use `web_time_compat::SystemTimeExt::get().into()` instead." }, ]