clippy.toml 10 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. await-holding-invalid-types = [
  2. { path = "tracing::span::Entered", reason = "use `tracing::instrument`, `tracing::Instrument::instrument`, or `tracing::Span::in_scope` instead" },
  3. { path = "tracing::span::EnteredSpan", reason = "use `tracing::instrument`, `tracing::Instrument::instrument`, or `tracing::Span::in_scope` instead" },
  4. ]
  5. disallowed-methods = [
  6. { path = "std::panic::catch_unwind", reason = "use `mz_ore::panic::catch_unwind` instead" },
  7. { path = "futures::FutureExt::catch_unwind", reason = "use `mz_ore::future::FutureExt::catch_unwind` instead" },
  8. { path = "futures_executor::block_on", reason = "use `tokio::runtime::Handle::block_on` instead" },
  9. { path = "futures::executor::block_on", reason = "use `tokio::runtime::Handle::block_on` instead" },
  10. { path = "tokio::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  11. { path = "tokio::task::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  12. { path = "tokio::task::spawn_blocking", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  13. { path = "tokio::runtime::Handle::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  14. { path = "tokio::runtime::Handle::spawn_blocking", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  15. { path = "tokio::runtime::Runtime::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  16. { path = "tokio::runtime::Runtime::spawn_blocking", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  17. # Note these wrappers aren't implemented yet, as we haven't needed them.
  18. { path = "tokio::task::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  19. { path = "tokio::task::LocalSet::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  20. # Note that `spawn_blocking` and the local varieties are not yet implemented, as they haven't been needed yet.
  21. { path = "tokio::task::JoinSet::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  22. { path = "tokio::task::JoinSet::spawn_on", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  23. { path = "tokio::task::JoinSet::spawn_blocking", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  24. { path = "tokio::task::JoinSet::spawn_blocking_on", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  25. { path = "tokio::task::JoinSet::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  26. { path = "tokio::task::JoinSet::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead" },
  27. # These are banned because we want to ensure people don't forget to use .name(...), so we require the use of `mz_ore`
  28. # We allow invalid because these paths only exist with tokio_unstable and feature tracing.
  29. # When these features are disabled, clippy warns about the path not existing. We don't use tokio_unstable in the cloud
  30. # repo, so clippy gives erroneous warnings about the path not referring to an existing function.
  31. { path = "tokio::task::Builder::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  32. { path = "tokio::task::Builder::spawn_on", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  33. { path = "tokio::task::Builder::spawn_blocking", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  34. { path = "tokio::task::Builder::spawn_blocking_on", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  35. { path = "tokio::task::Builder::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  36. { path = "tokio::task::join_set::Builder::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  37. { path = "tokio::task::join_set::Builder::spawn", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  38. { path = "tokio::task::join_set::Builder::spawn_on", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  39. { path = "tokio::task::join_set::Builder::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  40. { path = "tokio::task::join_set::Builder::spawn_local", reason = "use the spawn wrappers in `mz_ore::task` instead", allow-invalid = true },
  41. { path = "rdkafka::config::ClientConfig::new", reason = "use the `client::create_new_client_config` wrapper in `kafka_util` instead" },
  42. { path = "aws_config::defaults", reason = "use the `mz_aws_config::defaults` function instead" },
  43. { path = "aws_config::load_defaults", reason = "use the `mz_aws_config::defaults` function instead" },
  44. { path = "aws_config::from_env", reason = "use the `mz_aws_config::defaults` function instead" },
  45. { path = "aws_config::load_from_env", reason = "use the `mz_aws_config::defaults` function instead" },
  46. { path = "aws_sdk_s3::Client::new", reason = "use the `mz_aws_util::s3::new_client` function instead" },
  47. # Prevent access to Differential APIs that want to use the default trace or use a default name, or where we offer
  48. # our own wrapper
  49. { path = "differential_dataflow::Collection::consolidate", reason = "use the `mz_timely_util::operator::CollectionExt::consolidate_named` function instead" },
  50. { path = "differential_dataflow::Collection::consolidate_named", reason = "use the `mz_timely_util::operator::CollectionExt::consolidate_named` function instead" },
  51. { path = "differential_dataflow::operators::arrange::arrangement::Arrange::arrange", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  52. { path = "differential_dataflow::operators::arrange::arrangement::Arrange::arrange_named", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  53. { path = "differential_dataflow::operators::arrange::arrangement::arrange_core", reason = "use the `MzArrange::mz_arrange_core` function instead" },
  54. { path = "differential_dataflow::operators::arrange::arrangement::Arranged::reduce_abelian", reason = "use the `MzArrange::mz_arrange_core` function instead" },
  55. { path = "differential_dataflow::operators::arrange::arrangement::Arranged::reduce_core", reason = "use the `MzArrange::mz_arrange_core` function instead" },
  56. { path = "differential_dataflow::operators::arrange::arrangement::ArrangeByKey::arrange_by_key", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  57. { path = "differential_dataflow::operators::arrange::arrangement::ArrangeByKey::arrange_by_key_named", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  58. { path = "differential_dataflow::operators::arrange::arrangement::ArrangeBySelf::arrange_by_self", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  59. { path = "differential_dataflow::operators::arrange::arrangement::ArrangeBySelf::arrange_by_self_named", reason = "use the `MzArrange::mz_arrange_named` function instead" },
  60. { path = "differential_dataflow::operators::reduce::Count::count", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  61. { path = "differential_dataflow::operators::reduce::Count::count_core", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  62. { path = "differential_dataflow::operators::reduce::Reduce::reduce", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  63. { path = "differential_dataflow::operators::reduce::Reduce::reduce_named", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  64. { path = "differential_dataflow::operators::reduce::ReduceCore::reduce_abelian", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  65. { path = "differential_dataflow::operators::reduce::ReduceCore::reduce_core", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  66. { path = "differential_dataflow::operators::reduce::Threshold::distinct", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  67. { path = "differential_dataflow::operators::reduce::Threshold::distinct_core", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  68. { path = "differential_dataflow::operators::reduce::Threshold::threshold", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  69. { path = "differential_dataflow::operators::reduce::Threshold::threshold_named", reason = "use the `differential_dataflow::operators::reduce::ReduceCore::reduce_abelian` function instead" },
  70. { path = "differential_dataflow::operators::join::Join::antijoin", reason = "use the `differential_dataflow::operators::join::Join::join_core` function instead" },
  71. { path = "differential_dataflow::operators::join::Join::join_map", reason = "use the `differential_dataflow::operators::join::Join::join_core` function instead" },
  72. { path = "differential_dataflow::operators::join::Join::semijoin", reason = "use the `differential_dataflow::operators::join::Join::join_core` function instead" },
  73. # Panic when formatting the same value more than once, like our tracing macros do.
  74. { path = "itertools::Itertools::format", reason = "panics when passed to tracing macros; consider the methods in mz_ore::str instead" },
  75. { path = "itertools::Itertools::format_with", reason = "panics when passed to tracing macros; consider the methods in mz_ore::str instead" },
  76. ]
  77. disallowed-macros = [
  78. { path = "proptest::prop_oneof", reason = "use `proptest::strategy::Union::new` instead" },
  79. { path = "log::log", reason = "use the macros provided by `tracing` instead (database-issues#3001)" },
  80. # TODO: Re-enable once <https://github.com/rust-lang/rust-clippy/issues/13521> is fixed.
  81. # { path = "tracing::instrument", reason = "use `mz_ore::instrument` instead" },
  82. ]
  83. disallowed-types = [
  84. { path = "std::collections::HashMap", reason = "use `std::collections::BTreeMap` or `mz_ore::collections::HashMap` instead" },
  85. { path = "std::collections::HashSet", reason = "use `std::collections::BTreeSet` or `mz_ore::collections::HashSet` instead" },
  86. ]