Checklist
-
Development environment:
- Rule - Use a stable compilation toolchain (DENV-STABLE)
- Rule - Track Cargo.lock in version control system (DENV-CARGO-LOCK)
- Rule - Keep default values for critical variables in cargo profiles (DENV-CARGO-OPTS)
- Rule - Keep default values for compiler environment variables when running cargo (DENV-CARGO-ENVVARS)
- Rule - Use linter regularly (DENV-LINTER)
- Rule - Use Rust formatter (rustfmt) (DENV-FORMAT)
- Rule - Manually check automatic fixes (DENV-AUTOFIX)
-
Libraries:
- Rule - Check for outdated dependencies versions (cargo-outdated) (LIBS-OUTDATED)
- Rule - Check for security vulnerabilities report on dependencies (cargo-audit) (LIBS-AUDIT)
-
Language guarantees:
- Rule - No Undefined Behavior (UB-NOUB)
-
Naming:
- Rule - Respect naming conventions (LANG-NAMING)
-
Integer operations:
- Rule - Use appropriate arithmetic operations regarding potential overflows (LANG-ARITH)
-
Error handling:
-
Recommendation - Implement custom
Error
type wrapping all possible errors (LANG-ERRWRAP) -
Recommendation - Use the
?
operator and do not use thetry!
macro (LANG-ERRDO) -
Rule - Don't use functions that can cause
panic!
(LANG-NOPANIC) -
Rule - Test properly array indexing or use the
get
method (LANG-ARRINDEXING) -
Rule - Handle correctly
panic!
in FFI (LANG-FFIPANIC)
-
Recommendation - Implement custom
-
Central traits:
-
Recommendation - Justify
Drop
implementation (LANG-DROP) -
Rule - Do not panic in
Drop
implementation (LANG-DROP-NO-PANIC) -
Rule - Do not allow cycles of reference-counted
Drop
(LANG-DROP-NO-CYCLE) -
Recommendation - Do not rely only on
Drop
to ensure security (LANG-DROP-SEC)
-
Recommendation - Justify
-
Generalities:
- Rule - Don't use unsafe blocks (LANG-UNSAFE)
-
Memory management:
-
Rule - Do not use
forget
(MEM-FORGET) -
Recommendation - Use clippy lint to detect use of
forget
(MEM-FORGET-LINT) -
Rule - Do not use
leak
function (MEM-LEAK) -
Rule - Do release value wrapped in
ManuallyDrop
(MEM-MANUALLYDROP) -
Rule - Do no convert smart pointer into raw pointer in Rust without
unsafe
(MEM-NORAWPOINTER) -
Rule - Always call
from_raw
oninto_raw
ed value (MEM-INTOFROMRAWALWAYS) -
Rule - Call
from_raw
only oninto_raw
ed value (MEM-INTOFROMRAWONLY) - Rule - Do not use uninitialized memory (MEM-UNINIT)
- Rule - Avoid cyclic reference counted pointers (MEM-MUT-REC-RC)
-
Rule - Do not use
-
Foreign Function Interface:
- Rule - Use only C-compatible types in FFI (FFI-CTYPE)
- Rule - Use consistent types at FFI boundaries (FFI-TCONS)
- Recommendation - Use automatic binding generator tools (FFI-AUTOMATE)
-
Rule - Use portable aliases
c_*
when binding to platform-dependent types (FFI-PFTYPE) - Rule - Do not use unchecked non-robust foreign values (FFI-CKNONROBUST)
- Recommendation - Check foreign values in Rust (FFI-CKINRUST)
- Recommendation - Do not use reference types but pointer types (FFI-NOREF)
- Rule - Do not use unchecked foreign references (FFI-CKREF)
- Rule - Check foreign pointers (FFI-CKPTR)
-
Rule - Mark function pointer types in FFI as
extern
andunsafe
(FFI-MARKEDFUNPTR) - Rule - Check foreign function pointers (FFI-CKFUNPTR)
-
Recommendation - Do not use incoming Rust
enum
at FFI boundary (FFI-NOENUM) - Recommendation - Use dedicated Rust types for foreign opaque types (FFI-R-OPAQUE)
-
Recommendation - Use incomplete C/C++
struct
pointers to make type opaque (FFI-C-OPAQUE) -
Rule - Do not use types that implement
Drop
at FFI boundary (FFI-MEM-NODROP) - Rule - Ensure clear data ownership in FFI (FFI-MEM-OWNER)
- Recommendation - Wrap foreign data in memory releasing wrapper (FFI-MEM-WRAPPING)
-
Rule - Handle
panic!
correctly in FFI (FFI-NOPANIC) - Recommendation - Provide safe wrapping to foreign library (FFI-SAFEWRAPPING)
- Recommendation - Expose dedicated C-compatible API only (FFI-CAPI)
-
Standard library:
-
Recommendation - Justify
Send
andSync
implementation (LANG-SYNC-TRAITS) - Rule - Respect the invariants of standard comparison traits (LANG-CMP-INV)
- Recommendation - Use the default method implementation of standard comparison traits (LANG-CMP-DEFAULTS)
- Recommendation - Derive comparison traits when possible (LANG-CMP-DERIVE)
-
Recommendation - Justify