Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ clippy-fix:
# Check for API changes.
check-api:
contrib/check-for-api-changes.sh

# run `semgrep`
semgrep:
env SEMGREP_ENABLE_VERSION_CHECK=0 \
semgrep --error --no-rewrite-rule-ids --config contrib/semgrep.yml
1 change: 1 addition & 0 deletions src/primitives/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ impl std::error::Error for SegwitCodeLengthError {
}

impl From<CodeLengthError> for SegwitCodeLengthError {
#[inline]
fn from(e: CodeLengthError) -> Self { Self(e.encoded_length) }
}

Expand Down