aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/README.md7
-rw-r--r--docs/dev/lsp-extensions.md10
-rw-r--r--docs/dev/style.md25
3 files changed, 41 insertions, 1 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 36edddc70..90e74f226 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -35,7 +35,12 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0
35* [E-easy](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy), 35* [E-easy](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy),
36 [E-medium](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-medium), 36 [E-medium](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-medium),
37 [E-hard](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-hard), 37 [E-hard](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-hard),
38 labels are *estimates* for how hard would be to write a fix. 38 [E-unknown](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AE-unknown),
39 labels are *estimates* for how hard would be to write a fix. Each triaged issue should have one of these labels.
40* [S-actionable](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AS-actionable) and
41 [S-unactionable](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3AS-unactionable)
42 specify if there are concrete steps to resolve or advance an issue. Roughly, actionable issues need only work to be fixed,
43 while unactionable ones are effectively wont-fix. Each triaged issue should have one of these labels.
39* [fun](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3Afun) 44* [fun](https://github.com/rust-analyzer/rust-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3Afun)
40 is for cool, but probably hard stuff. 45 is for cool, but probably hard stuff.
41 46
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 3f861f3e0..43a69d6ce 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,3 +1,13 @@
1<!---
2lsp_ext.rs hash: 286f8bbac885531a
3
4If you need to change the above hash to make the test pass, please check if you
5need to adjust this doc as well and ping this issue:
6
7 https://github.com/rust-analyzer/rust-analyzer/issues/4604
8
9--->
10
1# LSP Extensions 11# LSP Extensions
2 12
3This document describes LSP extensions used by rust-analyzer. 13This document describes LSP extensions used by rust-analyzer.
diff --git a/docs/dev/style.md b/docs/dev/style.md
index 59067d234..435de63e3 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -186,6 +186,31 @@ impl Person {
186} 186}
187``` 187```
188 188
189## Constructors
190
191Prefer `Default` to zero-argument `new` function
192
193```rust
194// Good
195#[derive(Default)]
196struct Foo {
197 bar: Option<Bar>
198}
199
200// Not as good
201struct Foo {
202 bar: Option<Bar>
203}
204
205impl Foo {
206 fn new() -> Foo {
207 Foo { bar: None }
208 }
209}
210```
211
212Prefer `Default` even it has to be implemented manually.
213
189## Avoid Monomorphization 214## Avoid Monomorphization
190 215
191Rust uses monomorphization to compile generic code, meaning that for each instantiation of a generic functions with concrete types, the function is compiled afresh, *per crate*. 216Rust uses monomorphization to compile generic code, meaning that for each instantiation of a generic functions with concrete types, the function is compiled afresh, *per crate*.