From 8dc68ecdfcc764c7c0dcf5fcedcb51b092d99620 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 14 Jan 2021 18:25:19 +0300 Subject: Introduce more appropriate assertion mechanism rust-analyzer is a long-running program, so we *should* handle assertion failures. See also https://www.sqlite.org/assert.html. --- docs/dev/style.md | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/dev') diff --git a/docs/dev/style.md b/docs/dev/style.md index 9859f6148..21330948b 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md @@ -215,6 +215,11 @@ if idx >= len { **Rationale:** its useful to see the invariant relied upon by the rest of the function clearly spelled out. +## Assertions + +Assert liberally. +Prefer `stdx::assert_never!` to standard `assert!`. + ## Getters & Setters If a field can have any value without breaking invariants, make the field public. -- cgit v1.2.3