diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-01 19:36:33 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-01 19:36:33 +0000 |
| commit | 505ff4070a3de962dbde66f08b6550cda2eb4eab (patch) | |
| tree | a9fe9f827708ec3164d52083d15dfc59b77f229d /docs | |
| parent | 3f4e9914ff77c76ad3cbdebe1e4e2c0a78818d63 (diff) | |
| parent | 223374969205059f3448ef9e9d7ab1c44d5fa8cf (diff) | |
| download | rust-505ff4070a3de962dbde66f08b6550cda2eb4eab.tar.gz rust-505ff4070a3de962dbde66f08b6550cda2eb4eab.zip | |
Merge #6114
6114: Improve grammar and fix code example in style guide r=kjeremy a=lnicola Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/dev/style.md | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md index bcd86fd3f07..f0fdb5adc44 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md @@ -197,7 +197,7 @@ fn frobnicate(walrus: Option<Walrus>) { } ``` -Avoid preconditions that spawn function boundaries: +Avoid preconditions that span across function boundaries: ```rust @@ -218,9 +218,8 @@ fn foo() { } // Not as good -fn is_string_literal(s: &str) -> Option<&str> { +fn is_string_literal(s: &str) -> bool { s.starts_with('"') && s.ends_with('"') - Some() } fn foo() { @@ -231,8 +230,8 @@ fn foo() { } ``` -In the "Not as good" version, the precondition that `1` is a valid char boundary is checked in `is_string_literal` and utilized in `foo`. -In the "Good" version, precondition check and usage are checked in the same block, and then encoded in the types. +In the "Not as good" version, the precondition that `1` is a valid char boundary is checked in `is_string_literal` and used in `foo`. +In the "Good" version, the precondition check and usage are checked in the same block, and then encoded in the types. # Early Returns |
