Skip to content

Commit

Permalink
Introduce semgrep
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tcharding committed Jan 26, 2024
1 parent 44015f1 commit 8771d4a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contrib/semgrep.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8771d4a

Please sign in to comment.