diff options
author | Aleksey Kladov <[email protected]> | 2021-01-14 15:25:19 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-01-14 15:25:19 +0000 |
commit | 8dc68ecdfcc764c7c0dcf5fcedcb51b092d99620 (patch) | |
tree | f0f93d744416a1114b34472b91574afe3be14147 /docs/dev | |
parent | 865e05b5b47d3e27e8fe4458662e751e492a0f51 (diff) |
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.
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/style.md | 5 |
1 files changed, 5 insertions, 0 deletions
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 { | |||
215 | 215 | ||
216 | **Rationale:** its useful to see the invariant relied upon by the rest of the function clearly spelled out. | 216 | **Rationale:** its useful to see the invariant relied upon by the rest of the function clearly spelled out. |
217 | 217 | ||
218 | ## Assertions | ||
219 | |||
220 | Assert liberally. | ||
221 | Prefer `stdx::assert_never!` to standard `assert!`. | ||
222 | |||
218 | ## Getters & Setters | 223 | ## Getters & Setters |
219 | 224 | ||
220 | If a field can have any value without breaking invariants, make the field public. | 225 | If a field can have any value without breaking invariants, make the field public. |