Skip to content

Commit 505ff40

Browse files
bors[bot]lnicola
andauthored
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>
2 parents 3f4e991 + 2233749 commit 505ff40

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/dev/style.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn frobnicate(walrus: Option<Walrus>) {
197197
}
198198
```
199199

200-
Avoid preconditions that spawn function boundaries:
200+
Avoid preconditions that span across function boundaries:
201201

202202

203203
```rust
@@ -218,9 +218,8 @@ fn foo() {
218218
}
219219

220220
// Not as good
221-
fn is_string_literal(s: &str) -> Option<&str> {
221+
fn is_string_literal(s: &str) -> bool {
222222
s.starts_with('"') && s.ends_with('"')
223-
Some()
224223
}
225224

226225
fn foo() {
@@ -231,8 +230,8 @@ fn foo() {
231230
}
232231
```
233232

234-
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`.
235-
In the "Good" version, precondition check and usage are checked in the same block, and then encoded in the types.
233+
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`.
234+
In the "Good" version, the precondition check and usage are checked in the same block, and then encoded in the types.
236235

237236
# Early Returns
238237

0 commit comments

Comments
 (0)