1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
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" },
# This appears to be a fairly ugly bug, and since `weak_table` appears to be unmaintained, let's try to catch this early.
{ path = "weak_table::WeakHashSet::retain", reason = "`WeakHashSet::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::PtrWeakHashSet::retain", reason = "`PtrWeakHashSet::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::PtrWeakKeyHashMap::retain", reason = "`PtrWeakKeyHashMap::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::PtrWeakWeakHashMap::retain", reason = "`PtrWeakWeakHashMap::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::WeakKeyHashMap::retain", reason = "`WeakKeyHashMap::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::WeakValueHashMap::retain", reason = "`WeakValueHashMap::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ path = "weak_table::WeakWeakHashMap::retain", reason = "`WeakWeakHashMap::retain` is buggy; see https://github.com/tov/weak-table-rs/issues/22" },
{ 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." },
]
|