From 11e435861c8eaf5046beeb7db23e413a05bf8bcd Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 24 Oct 2023 13:45:39 +1100 Subject: [PATCH] Introduce semgrep Introduce usage of semgrep by doing: - Add a `semgrep` config file in `contrib/semgrep.yml`. - Add a single rule to check that all `From` impls are inlined --- contrib/semgrep.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 contrib/semgrep.yml diff --git a/contrib/semgrep.yml b/contrib/semgrep.yml new file mode 100644 index 000000000..0cb5b3e1e --- /dev/null +++ b/contrib/semgrep.yml @@ -0,0 +1,11 @@ +rules: + +- id: inline-from-impls + patterns: + - pattern: |- + impl From<$F> for $T { fn from(...) -> $SELF { ... } } + - pattern-not-regex: "inline" + message: Use inline attribute on `From` implementations. + languages: + - rust + severity: ERROR