aboutsummaryrefslogtreecommitdiff
path: root/docs/dev
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/lsp-extensions.md3
-rw-r--r--docs/dev/style.md21
2 files changed, 21 insertions, 3 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 8a6f9f06e..73be59a82 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -602,8 +602,7 @@ interface TestInfo {
602 602
603This request is sent from client to server to move item under cursor or selection in some direction. 603This request is sent from client to server to move item under cursor or selection in some direction.
604 604
605**Method:** `experimental/moveItemUp` 605**Method:** `experimental/moveItem`
606**Method:** `experimental/moveItemDown`
607 606
608**Request:** `MoveItemParams` 607**Request:** `MoveItemParams`
609 608
diff --git a/docs/dev/style.md b/docs/dev/style.md
index c594946be..48ce4b92a 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -842,7 +842,26 @@ Re-using originally single-purpose function often leads to bad coupling.
842 842
843## Helper Variables 843## Helper Variables
844 844
845Introduce helper variables freely, especially for multiline conditions. 845Introduce helper variables freely, especially for multiline conditions:
846
847```rust
848// GOOD
849let rustfmt_not_installed =
850 captured_stderr.contains("not installed") || captured_stderr.contains("not available");
851
852match output.status.code() {
853 Some(1) if !rustfmt_not_installed => Ok(None),
854 _ => Err(format_err!("rustfmt failed:\n{}", captured_stderr)),
855};
856
857// BAD
858match output.status.code() {
859 Some(1)
860 if !captured_stderr.contains("not installed")
861 && !captured_stderr.contains("not available") => Ok(None),
862 _ => Err(format_err!("rustfmt failed:\n{}", captured_stderr)),
863};
864```
846 865
847**Rationale:** like blocks, single-use variables are a cognitively cheap abstraction, as they have access to all the context. 866**Rationale:** like blocks, single-use variables are a cognitively cheap abstraction, as they have access to all the context.
848Extra variables help during debugging, they make it easy to print/view important intermediate results. 867Extra variables help during debugging, they make it easy to print/view important intermediate results.