aboutsummaryrefslogtreecommitdiff
path: root/docs/dev
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-22 12:26:19 +0000
committerAleksey Kladov <[email protected]>2021-01-22 12:29:31 +0000
commit4c92ef03acc5dc983a4ed6c587257e396ef507c0 (patch)
treebd38a2767c17f4b4de2a429c1961b11528d36ee6 /docs/dev
parentf67a2eedf5118990a9aa17c307176b8b355e9759 (diff)
Style: use the right string
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/style.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index 389649398..7e6cd49e0 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -6,6 +6,9 @@ Our approach to "clean code" is two-fold:
6It is explicitly OK for a reviewer to flag only some nits in the PR, and then send a follow-up cleanup PR for things which are easier to explain by example, cc-ing the original author. 6It is explicitly OK for a reviewer to flag only some nits in the PR, and then send a follow-up cleanup PR for things which are easier to explain by example, cc-ing the original author.
7Sending small cleanup PRs (like renaming a single local variable) is encouraged. 7Sending small cleanup PRs (like renaming a single local variable) is encouraged.
8 8
9When reviewing pull requests prefer extending this document to leaving
10non-reusable comments on the pull request itself.
11
9# General 12# General
10 13
11## Scale of Changes 14## Scale of Changes
@@ -375,6 +378,15 @@ This allows for exceptionally good performance, but leads to increased compile t
375Runtime performance obeys 80%/20% rule -- only a small fraction of code is hot. 378Runtime performance obeys 80%/20% rule -- only a small fraction of code is hot.
376Compile time **does not** obey this rule -- all code has to be compiled. 379Compile time **does not** obey this rule -- all code has to be compiled.
377 380
381## Appropriate String Types
382
383When interfacing with OS APIs, use `OsString`, even if the original source of
384data is utf-8 encoded. **Rationale:** cleanly delineates the boundary when the
385data goes into the OS-land.
386
387Use `AbsPathBuf` and `AbsPath` over `std::Path`. **Rationale:** rust-analyzer is
388a long-lived process which handles several projects at the same time. It is
389important not to leak cwd by accident.
378 390
379# Premature Pessimization 391# Premature Pessimization
380 392