Skip to content

Commit 3ccc1f8

Browse files
authored
Merge pull request rust-lang#3231 from LucianBuzzo/minor-typo-fixes
Fix minor typos and grammar
2 parents 43206f4 + 8cd8ab5 commit 3ccc1f8

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

Configurations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ mod dolor;
15201520
mod sit;
15211521
```
15221522

1523-
**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1523+
**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics
15241524
of the original source code.
15251525

15261526
## `reorder_impl_items`

Contributing.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing
22

33
There are many ways to contribute to Rustfmt. This document lays out what they
4-
are and has information for how to get started. If you have any questions about
4+
are and has information on how to get started. If you have any questions about
55
contributing or need help with anything, please ask in the WG-Rustfmt channel
66
on [Discord](https://discordapp.com/invite/rust-lang). Feel free to also ask questions
77
on issues, or file new issues specifically to get help.
@@ -129,14 +129,14 @@ can.
129129

130130
Our primary tool here is to look between spans for text we've missed. For
131131
example, in a function call `foo(a, b)`, we have spans for `a` and `b`, in this
132-
case there is only a comma and a single space between the end of `a` and the
132+
case, there is only a comma and a single space between the end of `a` and the
133133
start of `b`, so there is nothing much to do. But if we look at
134134
`foo(a /* a comment */, b)`, then between `a` and `b` we find the comment.
135135

136136
At a higher level, Rustfmt has machinery so that we account for text between
137137
'top level' items. Then we can reproduce that text pretty much verbatim. We only
138138
count spans we actually reformat, so if we can't format a span it is not missed
139-
completely, but is reproduced in the output without being formatted. This is
139+
completely but is reproduced in the output without being formatted. This is
140140
mostly handled in [src/missed_spans.rs](src/missed_spans.rs). See also `FmtVisitor::last_pos` in
141141
[src/visitor.rs](src/visitor.rs).
142142

@@ -152,7 +152,7 @@ then walk their own children.
152152
The `Rewrite` trait is defined in [src/rewrite.rs](src/rewrite.rs). It is implemented for many
153153
things that can be rewritten, mostly AST nodes. It has a single function,
154154
`rewrite`, which is called to rewrite `self` into an `Option<String>`. The
155-
arguments are `width` which is the horizontal space we write into, and `offset`
155+
arguments are `width` which is the horizontal space we write into and `offset`
156156
which is how much we are currently indented from the lhs of the page. We also
157157
take a context which contains information used for parsing, the current block
158158
indent, and a configuration (see below).
@@ -199,11 +199,11 @@ space we have. Something like `available_space = budget - overhead`. Since
199199
widths are unsized integers, this would cause underflow. Therefore we use
200200
checked subtraction: `available_space = budget.checked_sub(overhead)?`.
201201
`checked_sub` returns an `Option`, and if we would underflow `?` returns
202-
`None`, otherwise we proceed with the computed space.
202+
`None`, otherwise, we proceed with the computed space.
203203

204204
##### Rewrite of list-like expressions
205205

206-
Much syntax in Rust is lists: lists of arguments, lists of fields, lists of
206+
Much of the syntax in Rust is lists: lists of arguments, lists of fields, lists of
207207
array elements, etc. We have some generic code to handle lists, including how to
208208
space them in horizontal and vertical space, indentation, comments between
209209
items, trailing separators, etc. However, since there are so many options, the

Design.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ Some details of the philosophy behind the implementation.
6363
### Operate on the AST
6464

6565
A reformatting tool can be based on either the AST or a token stream (in Rust
66-
this is actually a stream of token trees, but its not a fundamental difference).
66+
this is actually a stream of token trees, but it's not a fundamental difference).
6767
There are pros and cons to the two approaches. I have chosen to use the AST
6868
approach. The primary reasons are that it allows us to do more sophisticated
6969
manipulations, rather than just change whitespace, and it gives us more context
7070
when making those changes.
7171

72-
The advantage of the tokens approach are that you can operate on non-parsable
72+
The advantage of the tokens approach is that you can operate on non-parsable
7373
code. I don't care too much about that, it would be nice, but I think being able
74-
to perform sophisticated transformations is more important. In the future I hope to
74+
to perform sophisticated transformations is more important. In the future, I hope to
7575
(optionally) be able to use type information for informing reformatting too. One
7676
specific case of unparsable code is macros. Using tokens is certainly easier
7777
here, but I believe it is perfectly solvable with the AST approach. At the limit,
@@ -80,7 +80,7 @@ we can operate on just tokens in the macro case.
8080
I believe that there is not in fact that much difference between the two
8181
approaches. Due to imperfect span information, under the AST approach, we
8282
sometimes are reduced to examining tokens or do some re-lexing of our own. Under
83-
the tokens approach you need to implement your own (much simpler) parser. I
83+
the tokens approach, you need to implement your own (much simpler) parser. I
8484
believe that as the tool gets more sophisticated, you end up doing more at the
8585
token-level, or having an increasingly sophisticated parser, until at the limit
8686
you have the same tool.
@@ -99,7 +99,7 @@ to good old fashioned abstraction and code sharing. This will give a bigger code
9999
base, but hopefully a better result.
100100

101101
It also means that there will be some cases we can't format and we have to give
102-
up. I think that is OK. Hopefully they are rare enough that manually fixing them
102+
up. I think that is OK. Hopefully, they are rare enough that manually fixing them
103103
is not painful. Better to have a tool that gives great code in 99% of cases and
104104
fails in 1% than a tool which gives 50% great code and 50% ugly code, but never
105105
fails.
@@ -150,9 +150,9 @@ for its configuration.
150150

151151
Our visitor keeps track of the desired current indent due to blocks (
152152
`block_indent`). Each `visit_*` method reformats code according to this indent,
153-
`config.comment_width()` and `config.max_width()`. Most reformatting done in the
154-
`visit_*` methods is a bit hacky and is meant to be temporary until it can be
155-
done properly.
153+
`config.comment_width()` and `config.max_width()`. Most reformatting that is done
154+
in the `visit_*` methods is a bit hacky and is meant to be temporary until it can
155+
be done properly.
156156

157157
There are a bunch of methods called `rewrite_*`. They do the bulk of the
158158
reformatting. These take the AST node to be reformatted (this may not literally
@@ -163,7 +163,7 @@ code in the box given by the indent and width budget. If the method fails, it
163163
returns `None` and the calling method then has to fallback in some way to give
164164
the callee more space.
165165

166-
So, in summary to format a node, we calculate the width budget and then walk down
166+
So, in summary, to format a node, we calculate the width budget and then walk down
167167
the tree from the node. At a leaf, we generate an actual string and then unwind,
168168
combining these strings as we go back up the tree.
169169

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ just need to run on the root file (usually mod.rs or lib.rs). Rustfmt can also
9292
read data from stdin. Alternatively, you can use `cargo fmt` to format all
9393
binary and library targets of your crate.
9494

95-
You can run `rustfmt --help` for information about argument.
95+
You can run `rustfmt --help` for information about available arguments.
9696

9797
When running with `--check`, Rustfmt will exit with `0` if Rustfmt would not
9898
make any formatting changes to the input, and `1` if Rustfmt would make changes.

atom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Once installed a file is formatted with `ctrl-shift-c` or `cmd-shift-c`, also av
1313
Another way is to install [Beautify](https://atom.io/packages/atom-beautify), you
1414
can do this by running `apm install atom-beautify`.
1515

16-
There are 2 setting that need to be configured in the atom beautifier configuration.
16+
There are 2 settings that need to be configured in the atom beautifier configuration.
1717

1818
- Install rustfmt as per the [readme](README.md).
1919
- Open the atom beautifier settings

0 commit comments

Comments
 (0)