Skip to content

Commit a9d9ff6

Browse files
committed
Rollup merge of #25866 - jooert:update_guidelines, r=steveklabnik
So that rust-guidelines can be deleted and src/doc/style can prosper as the official home of the rust guidelines. 😃
2 parents 6da2a76 + adac861 commit a9d9ff6

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/doc/style/features/functions-and-methods/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ for any operation that is clearly associated with a particular
2020
type.
2121

2222
Methods have numerous advantages over functions:
23+
2324
* They do not need to be imported or qualified to be used: all you
2425
need is a value of the appropriate type.
2526
* Their invocation performs autoborrowing (including mutable borrows).

src/doc/style/features/functions-and-methods/input.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn foo(a: u8) { ... }
159159
Note that
160160
[`ascii::Ascii`](http://static.rust-lang.org/doc/master/std/ascii/struct.Ascii.html)
161161
is a _wrapper_ around `u8` that guarantees the highest bit is zero; see
162-
[newtype patterns]() for more details on creating typesafe wrappers.
162+
[newtype patterns](../types/newtype.md) for more details on creating typesafe wrappers.
163163
164164
Static enforcement usually comes at little run-time cost: it pushes the
165165
costs to the boundaries (e.g. when a `u8` is first converted into an

src/doc/style/features/let.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Prefer
3434

3535
```rust
3636
let foo = match bar {
37-
Baz => 0,
37+
Baz => 0,
3838
Quux => 1
3939
};
4040
```
@@ -44,7 +44,7 @@ over
4444
```rust
4545
let foo;
4646
match bar {
47-
Baz => {
47+
Baz => {
4848
foo = 0;
4949
}
5050
Quux => {
@@ -61,8 +61,8 @@ conditional expression.
6161
Prefer
6262

6363
```rust
64-
s.iter().map(|x| x * 2)
65-
.collect::<Vec<_>>()
64+
let v = s.iter().map(|x| x * 2)
65+
.collect::<Vec<_>>();
6666
```
6767

6868
over

src/doc/style/ownership/builders.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If `T` is such a data structure, consider introducing a `T` _builder_:
1616
value. When possible, choose a better name: e.g. `Command` is the builder for
1717
`Process`.
1818
2. The builder constructor should take as parameters only the data _required_ to
19-
to make a `T`.
19+
make a `T`.
2020
3. The builder should offer a suite of convenient methods for configuration,
2121
including setting up compound inputs (like slices) incrementally.
2222
These methods should return `self` to allow chaining.

0 commit comments

Comments
 (0)