From: Skgland Date: Tue, 18 Nov 2025 21:13:18 +0000 (+0100) Subject: stub a clippy config X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=5686b69013b9478e0b7cb9ca706dc0d43cdf9016;p=scryer-prolog.git stub a clippy config with things we need to get rid of replace if we want to eliminate panics due to oom --- diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 00000000..523192fe --- /dev/null +++ b/clippy.toml @@ -0,0 +1,26 @@ +disallowed-macros = [ + # https://rust-lang.github.io/rust-clippy/master/#disallowed_macros + + # list of macros that may panic on allocation failure e.g. + + # "std::vec", +] + +disallowed-methods = [ + # https://rust-lang.github.io/rust-clippy/master/#disallowed_method + + # list of methods that may panic on allocation failue + # though not including things that can be used correctly by reversing ahead of time (i.e. std::vec::Vec::try_reserve + std::iter::Extend::extend ). + + # "std::iter::Iter::collect", + # { path = "std::vec::Vec::with_capacity", replacement = "std::vec::Vec::new + std::vec::Vec::try_reserve" }, + # { path = "std::string::String::with_capacity", replacement = "std::string::String::new + std::string::String::try_reserve" }, +] + +disallowed-types = [ + # https://rust-lang.github.io/rust-clippy/master/#disallowed_types + + # list of types that can't be used without risking a panic due to allocation failure + + # { path = "std::collections::BTreeMap", reason = "unlike Vec and HashMap BTreeMap cannot reserve capacity ahead of time (i.e. try_reserve) making it unusable without risk of oom panic"}, +]