diff options
author | Aleksey Kladov <[email protected]> | 2021-01-22 12:26:19 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-01-22 12:29:31 +0000 |
commit | 4c92ef03acc5dc983a4ed6c587257e396ef507c0 (patch) | |
tree | bd38a2767c17f4b4de2a429c1961b11528d36ee6 /docs | |
parent | f67a2eedf5118990a9aa17c307176b8b355e9759 (diff) |
Style: use the right string
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/style.md | 12 |
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: | |||
6 | It 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. | 6 | It 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. |
7 | Sending small cleanup PRs (like renaming a single local variable) is encouraged. | 7 | Sending small cleanup PRs (like renaming a single local variable) is encouraged. |
8 | 8 | ||
9 | When reviewing pull requests prefer extending this document to leaving | ||
10 | non-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 | |||
375 | Runtime performance obeys 80%/20% rule -- only a small fraction of code is hot. | 378 | Runtime performance obeys 80%/20% rule -- only a small fraction of code is hot. |
376 | Compile time **does not** obey this rule -- all code has to be compiled. | 379 | Compile time **does not** obey this rule -- all code has to be compiled. |
377 | 380 | ||
381 | ## Appropriate String Types | ||
382 | |||
383 | When interfacing with OS APIs, use `OsString`, even if the original source of | ||
384 | data is utf-8 encoded. **Rationale:** cleanly delineates the boundary when the | ||
385 | data goes into the OS-land. | ||
386 | |||
387 | Use `AbsPathBuf` and `AbsPath` over `std::Path`. **Rationale:** rust-analyzer is | ||
388 | a long-lived process which handles several projects at the same time. It is | ||
389 | important not to leak cwd by accident. | ||
378 | 390 | ||
379 | # Premature Pessimization | 391 | # Premature Pessimization |
380 | 392 | ||