From 8771d4a8d394a8904e525d427400c4fdbbb48eaf 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..10a0f6082 --- /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