mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 21:47:04 +00:00
style-guide: Avoid hyphenating "semicolon"
This commit is contained in:
parent
3e2449c2b1
commit
a9d1db3145
@ -140,7 +140,7 @@ union Foo {
|
||||
|
||||
Put the whole struct on one line if possible. Types in the parentheses should be
|
||||
separated by a comma and space with no trailing comma. No spaces around the
|
||||
parentheses or semi-colon:
|
||||
parentheses or semicolon:
|
||||
|
||||
```rust
|
||||
pub struct Foo(String, u8);
|
||||
@ -231,7 +231,7 @@ impl Bar
|
||||
|
||||
`extern crate foo;`
|
||||
|
||||
Use spaces around keywords, no spaces around the semi-colon.
|
||||
Use spaces around keywords, no spaces around the semicolon.
|
||||
|
||||
|
||||
### Modules
|
||||
@ -246,7 +246,7 @@ mod foo;
|
||||
```
|
||||
|
||||
Use spaces around keywords and before the opening brace, no spaces around the
|
||||
semi-colon.
|
||||
semicolon.
|
||||
|
||||
### macro\_rules!
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
### Let statements
|
||||
|
||||
There should be spaces after the `:` and on both sides of the `=` (if they are
|
||||
present). No space before the semi-colon.
|
||||
present). No space before the semicolon.
|
||||
|
||||
```rust
|
||||
// A comment.
|
||||
@ -194,7 +194,7 @@ used to determine whether a let-else statement is *short*.
|
||||
### Macros in statement position
|
||||
|
||||
A macro use in statement position should use parentheses or square brackets as
|
||||
delimiters and should be terminated with a semi-colon. There should be no spaces
|
||||
delimiters and should be terminated with a semicolon. There should be no spaces
|
||||
between the name, `!`, the delimiters, or the `;`.
|
||||
|
||||
```rust
|
||||
@ -205,13 +205,13 @@ a_macro!(...);
|
||||
|
||||
### Expressions in statement position
|
||||
|
||||
There should be no space between the expression and the semi-colon.
|
||||
There should be no space between the expression and the semicolon.
|
||||
|
||||
```
|
||||
<expr>;
|
||||
```
|
||||
|
||||
All expressions in statement position should be terminated with a semi-colon,
|
||||
All expressions in statement position should be terminated with a semicolon,
|
||||
unless they end with a block or are used as the value for a block.
|
||||
|
||||
E.g.,
|
||||
@ -229,7 +229,7 @@ loop {
|
||||
}
|
||||
```
|
||||
|
||||
Use a semi-colon where an expression has void type, even if it could be
|
||||
Use a semicolon where an expression has void type, even if it could be
|
||||
propagated. E.g.,
|
||||
|
||||
```rust
|
||||
|
Loading…
Reference in New Issue
Block a user