Skip to content

Commit aee5be0

Browse files
committed
Add quote, add example for single-letter identifier
1 parent 00db89f commit aee5be0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/contributor/pages/code-style-guide.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
=== Long versus abbreviated
66

77
We use unabbreviated identifier names to avoid ambiguity.
8-
Short (even single letter) variable names are allowed in lambdas (closures) and one-liners.
8+
Short (even single letter) variable names are allowed in lambdas (closures), in one-liners, and when the context allows it.
9+
10+
[quote,Uncle Bob Martin, 'Source: https://twitter.com/unclebobmartin/status/360029878126514177[Twitter]']
11+
The shorter the scope the shorter the variable names, and the longer the function [...] names. And vice versa.
12+
913
The usage of well-known acronyms like CPU, TLS or OIDC are allowed.
1014

1115
[WARNING.code-rule,caption=Examples of incorrect code for this rule]
@@ -34,6 +38,8 @@ let parameter = Some("foo");
3438
let buffer = &[];
3539
3640
fn function(elements: Vec<String>) {}
41+
42+
for i in 0..5 {}
3743
----
3844
3945
====

0 commit comments

Comments
 (0)