Skip to content

Commit 1ec23e7

Browse files
bors[bot]matklad
andauthored
Merge #5757
5757: Document the most important CI invariant r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 674af60 + 200161c commit 1ec23e7

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

docs/dev/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ In general, API is centered around UI concerns -- the result of the call is what
165165
The results are 100% Rust specific though.
166166
Shout outs to LSP developers for popularizing the idea that "UI" is a good place to draw a boundary at.
167167

168+
## CI
169+
170+
CI does not test rust-analyzer, CI is a core part of rust-analyzer, and is maintained with above average standard of quality.
171+
CI is reproducible -- it can only be broken by changes to files in this repository, any dependence on externalities is a bug.
172+
168173
# Code Style & Review Process
169174

170175
Do see [./style.md](./style.md).

docs/dev/style.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ There are many benefits to this:
6565
It also makes sense to format snippets more compactly (for example, by placing enum definitions like `enum E { Foo, Bar }` on a single line),
6666
as long as they are still readable.
6767

68-
## Order of Imports
68+
# Order of Imports
6969

7070
Separate import groups with blank lines.
7171
Use one `use` per crate.
@@ -91,7 +91,7 @@ use super::{}
9191
Module declarations come before the imports.
9292
Order them in "suggested reading order" for a person new to the code base.
9393

94-
## Import Style
94+
# Import Style
9595

9696
Qualify items from `hir` and `ast`.
9797

@@ -112,7 +112,7 @@ Avoid local `use MyEnum::*` imports.
112112

113113
Prefer `use crate::foo::bar` to `use super::bar`.
114114

115-
## Order of Items
115+
# Order of Items
116116

117117
Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.
118118
People read things from top to bottom, so place most important things first.
@@ -143,20 +143,20 @@ struct Foo {
143143
}
144144
```
145145

146-
## Variable Naming
146+
# Variable Naming
147147

148148
Use boring and long names for local variables ([yay code completion](https://github.com/rust-analyzer/rust-analyzer/pull/4162#discussion_r417130973)).
149149
The default name is a lowercased name of the type: `global_state: GlobalState`.
150150
Avoid ad-hoc acronyms and contractions, but use the ones that exist consistently (`db`, `ctx`, `acc`).
151151
The default name for "result of the function" local variable is `res`.
152152
The default name for "I don't really care about the name" variable is `it`.
153153

154-
## Collection types
154+
# Collection types
155155

156156
Prefer `rustc_hash::FxHashMap` and `rustc_hash::FxHashSet` instead of the ones in `std::collections`.
157157
They use a hasher that's slightly faster and using them consistently will reduce code size by some small amount.
158158

159-
## Preconditions
159+
# Preconditions
160160

161161
Express function preconditions in types and force the caller to provide them (rather than checking in callee):
162162

@@ -176,7 +176,7 @@ fn frobnicate(walrus: Option<Walrus>) {
176176
}
177177
```
178178

179-
## Premature Pessimization
179+
# Premature Pessimization
180180

181181
Avoid writing code which is slower than it needs to be.
182182
Don't allocate a `Vec` where an iterator would do, don't allocate strings needlessly.
@@ -197,12 +197,12 @@ if words.len() != 2 {
197197
}
198198
```
199199

200-
## Documentation
200+
# Documentation
201201

202202
For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines.
203203
If the line is too long, you want to split the sentence in two :-)
204204

205-
## Commit Style
205+
# Commit Style
206206

207207
We don't have specific rules around git history hygiene.
208208
Maintaining clean git history is encouraged, but not enforced.

0 commit comments

Comments
 (0)