Skip to content

Commit 580c96b

Browse files
authored
Merge pull request #2104 from martinlindhe/master
fix some typos
2 parents 0af8825 + f930a16 commit 580c96b

29 files changed

+49
-49
lines changed

Configurations.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ trait Lorem {
506506
dolor: Dolor,
507507
sit: Sit,
508508
amet: Amet,
509-
consectetur: onsectetur,
509+
consectetur: Consectetur,
510510
adipiscing: Adipiscing,
511511
elit: Elit,
512512
);
@@ -516,7 +516,7 @@ trait Lorem {
516516
dolor: Dolor,
517517
sit: Sit,
518518
amet: Amet,
519-
consectetur: onsectetur,
519+
consectetur: Consectetur,
520520
adipiscing: Adipiscing,
521521
elit: Elit,
522522
) {
@@ -569,7 +569,7 @@ trait Lorem {
569569
dolor: Dolor,
570570
sit: Sit,
571571
amet: Amet,
572-
consectetur: onsectetur,
572+
consectetur: Consectetur,
573573
adipiscing: Adipiscing,
574574
elit: Elit,
575575
) {
@@ -598,15 +598,15 @@ trait Lorem {
598598
dolor: Dolor,
599599
sit: Sit,
600600
amet: Amet,
601-
consectetur: onsectetur,
601+
consectetur: Consectetur,
602602
adipiscing: Adipiscing,
603603
elit: Elit);
604604

605605
fn lorem(ipsum: Ipsum,
606606
dolor: Dolor,
607607
sit: Sit,
608608
amet: Amet,
609-
consectetur: onsectetur,
609+
consectetur: Consectetur,
610610
adipiscing: Adipiscing,
611611
elit: Elit) {
612612
// body

Design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ for its configuration.
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,
153153
`config.comment_width()` and `config.max_width()`. Most reformatting done in the
154-
`visit_*` methods is a bit hackey and is meant to be temporary until it can be
154+
`visit_*` methods is a bit hacky and is meant to be temporary until it can be
155155
done properly.
156156

157157
There are a bunch of methods called `rewrite_*`. There do the bulk of the

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ are included as out of line modules from `src/lib.rs`.
128128
If `rustfmt` successfully reformatted the code it will exit with `0` exit
129129
status. Exit status `1` signals some unexpected error, like an unknown option or
130130
a failure to read a file. Exit status `2` is returned if there are syntax errors
131-
in the input files. `rustfmt` can't format syntatically invalid code. Finally,
131+
in the input files. `rustfmt` can't format syntactically invalid code. Finally,
132132
exit status `3` is returned if there are some issues which can't be resolved
133133
automatically. For example, if you have a very long comment line `rustfmt`
134134
doesn't split it. Instead it prints a warning and exits with `3`.
@@ -209,7 +209,7 @@ options covering different styles. File an issue, or even better, submit a PR.
209209
* When you run rustfmt, place a file named `rustfmt.toml` or `.rustfmt.toml` in
210210
target file directory or its parents to override the default settings of
211211
rustfmt. You can generate a file containing the default configuration with
212-
`rustfm --dump-default-config rustfmt.toml` and customize as needed.
212+
`rustfmt --dump-default-config rustfmt.toml` and customize as needed.
213213
* After successful compilation, a `rustfmt` executable can be found in the
214214
target directory.
215215
* If you're having issues compiling Rustfmt (or compile errors when trying to

src/chains.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
152152
}).collect::<Option<Vec<_>>>()?;
153153

154154
// Total of all items excluding the last.
155-
let extend_last_subexr = last_line_extendable(&parent_rewrite) && rewrites.is_empty();
156-
let almost_total = if extend_last_subexr {
155+
let extend_last_subexpr = last_line_extendable(&parent_rewrite) && rewrites.is_empty();
156+
let almost_total = if extend_last_subexpr {
157157
last_line_width(&parent_rewrite)
158158
} else {
159159
rewrites.iter().fold(0, |a, b| a + b.len()) + parent_rewrite.len()
@@ -195,7 +195,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
195195
// In particular, overflowing is effective when the last child is a method with a multi-lined
196196
// block-like argument (e.g. closure):
197197
// ```
198-
// parent.child1.chlid2.last_child(|a, b, c| {
198+
// parent.child1.child2.last_child(|a, b, c| {
199199
// let x = foo(a, b, c);
200200
// let y = bar(a, b, c);
201201
//
@@ -208,14 +208,14 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
208208
// `rewrite_last` rewrites the last child on its own line. We use a closure here instead of
209209
// directly calling `rewrite_chain_subexpr()` to avoid exponential blowup.
210210
let rewrite_last = || rewrite_chain_subexpr(last_subexpr, total_span, context, last_shape);
211-
let (last_subexpr_str, fits_single_line) = if all_in_one_line || extend_last_subexr {
211+
let (last_subexpr_str, fits_single_line) = if all_in_one_line || extend_last_subexpr {
212212
// First we try to 'overflow' the last child and see if it looks better than using
213213
// vertical layout.
214214
parent_shape.offset_left(almost_total).map(|shape| {
215215
if let Some(rw) = rewrite_chain_subexpr(last_subexpr, total_span, context, shape) {
216216
// We allow overflowing here only if both of the following conditions match:
217217
// 1. The entire chain fits in a single line expect the last child.
218-
// 2. `last_chlid_str.lines().count() >= 5`.
218+
// 2. `last_child_str.lines().count() >= 5`.
219219
let line_count = rw.lines().count();
220220
let fits_single_line = almost_total + first_line_width(&rw) <= one_line_budget;
221221
if fits_single_line && line_count >= 5 {

src/comment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn combine_strs_with_missing_comments(
170170
// We have a missing comment between the first expression and the second expression.
171171

172172
// Peek the the original source code and find out whether there is a newline between the first
173-
// expression and the second expression or the missing comment. We will preserve the orginal
173+
// expression and the second expression or the missing comment. We will preserve the original
174174
// layout whenever possible.
175175
let original_snippet = context.snippet(span);
176176
let prefer_same_line = if let Some(pos) = original_snippet.chars().position(|c| c == '/') {

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ macro_rules! create_config {
235235

236236
// Just like the Config struct but with each property wrapped
237237
// as Option<T>. This is used to parse a rustfmt.toml that doesn't
238-
// specity all properties of `Config`.
238+
// specify all properties of `Config`.
239239
// We first parse into `PartialConfig`, then create a default `Config`
240240
// and overwrite the properties with corresponding values from `PartialConfig`.
241241
#[derive(Deserialize, Serialize, Clone)]

src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn format_expr(
170170
ast::ExprKind::TupField(..) |
171171
ast::ExprKind::MethodCall(..) => rewrite_chain(expr, context, shape),
172172
ast::ExprKind::Mac(ref mac) => {
173-
// Failure to rewrite a marco should not imply failure to
173+
// Failure to rewrite a macro should not imply failure to
174174
// rewrite the expression.
175175
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
176176
.or_else(|| Some(context.snippet(expr.span)))

src/issues.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Objects for seeking through a char stream for occurences of TODO and FIXME.
11+
// Objects for seeking through a char stream for occurrences of TODO and FIXME.
1212
// Depending on the loaded configuration, may also check that these have an
1313
// associated issue number.
1414

src/lists.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ where
572572
let comment_end = match self.inner.peek() {
573573
Some(..) => {
574574
let mut block_open_index = post_snippet.find("/*");
575-
// check if it realy is a block comment (and not //*)
575+
// check if it really is a block comment (and not //*)
576576
if let Some(i) = block_open_index {
577577
if i > 0 && &post_snippet[i - 1..i] == "/" {
578578
block_open_index = None;

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// foo!( x, y, z ). The token x may represent an identifier in the code, but we
1616
// interpreted as an expression.
1717
// Macro uses which are not-list like, such as bar!(key => val), will not be
18-
// reformated.
18+
// reformatted.
1919
// List-like invocations with parentheses will be formatted as function calls,
2020
// and those with brackets will be formatted as array literals.
2121

src/patterns.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl Rewrite for Pat {
118118
};
119119
Some(result)
120120
}
121-
PatKind::Struct(ref path, ref fields, elipses) => {
122-
rewrite_struct_pat(path, fields, elipses, self.span, context, shape)
121+
PatKind::Struct(ref path, ref fields, ellipsis) => {
122+
rewrite_struct_pat(path, fields, ellipsis, self.span, context, shape)
123123
}
124124
// FIXME(#819) format pattern macros.
125125
PatKind::Mac(..) => Some(context.snippet(self.span)),
@@ -130,7 +130,7 @@ impl Rewrite for Pat {
130130
fn rewrite_struct_pat(
131131
path: &ast::Path,
132132
fields: &[codemap::Spanned<ast::FieldPat>],
133-
elipses: bool,
133+
ellipsis: bool,
134134
span: Span,
135135
context: &RewriteContext,
136136
shape: Shape,
@@ -139,15 +139,15 @@ fn rewrite_struct_pat(
139139
let path_shape = shape.sub_width(2)?;
140140
let path_str = rewrite_path(context, PathContext::Expr, None, path, path_shape)?;
141141

142-
if fields.is_empty() && !elipses {
142+
if fields.is_empty() && !ellipsis {
143143
return Some(format!("{} {{}}", path_str));
144144
}
145145

146-
let (elipses_str, terminator) = if elipses { (", ..", "..") } else { ("", "}") };
146+
let (ellipsis_str, terminator) = if ellipsis { (", ..", "..") } else { ("", "}") };
147147

148148
// 3 = ` { `, 2 = ` }`.
149149
let (h_shape, v_shape) =
150-
struct_lit_shape(shape, context, path_str.len() + 3, elipses_str.len() + 2)?;
150+
struct_lit_shape(shape, context, path_str.len() + 3, ellipsis_str.len() + 2)?;
151151

152152
let items = itemize_list(
153153
context.codemap,
@@ -169,7 +169,7 @@ fn rewrite_struct_pat(
169169
let mut fields_str = write_list(&item_vec, &fmt)?;
170170
let one_line_width = h_shape.map_or(0, |shape| shape.width);
171171

172-
if elipses {
172+
if ellipsis {
173173
if fields_str.contains('\n') || fields_str.len() > one_line_width {
174174
// Add a missing trailing comma.
175175
if fmt.trailing_separator == SeparatorTactic::Never {
@@ -180,7 +180,7 @@ fn rewrite_struct_pat(
180180
fields_str.push_str("..");
181181
} else {
182182
if !fields_str.is_empty() {
183-
// there are preceeding struct fields being matched on
183+
// there are preceding struct fields being matched on
184184
if fmt.tactic == DefinitiveListTactic::Vertical {
185185
// if the tactic is Vertical, write_list already added a trailing ,
186186
fields_str.push_str(" ");

src/vertical.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub fn rewrite_with_alignment<T: AlignedItem>(
183183
}
184184
}
185185

186-
fn struct_field_preix_max_min_width<T: AlignedItem>(
186+
fn struct_field_prefix_max_min_width<T: AlignedItem>(
187187
context: &RewriteContext,
188188
fields: &[T],
189189
shape: Shape,
@@ -219,7 +219,7 @@ fn rewrite_aligned_items_inner<T: AlignedItem>(
219219
// 1 = ","
220220
let item_shape = Shape::indented(item_indent, context.config).sub_width(1)?;
221221
let (mut field_prefix_max_width, field_prefix_min_width) =
222-
struct_field_preix_max_min_width(context, fields, item_shape);
222+
struct_field_prefix_max_min_width(context, fields, item_shape);
223223
let max_diff = field_prefix_max_width
224224
.checked_sub(field_prefix_min_width)
225225
.unwrap_or(0);

src/visitor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<'a> FmtVisitor<'a> {
295295
// complex in the module case. It is complex because the module could be
296296
// in a separate file and there might be attributes in both files, but
297297
// the AST lumps them all together.
298-
let filterd_attrs;
298+
let filtered_attrs;
299299
let mut attrs = &item.attrs;
300300
match item.node {
301301
ast::ItemKind::Mod(ref m) => {
@@ -314,7 +314,7 @@ impl<'a> FmtVisitor<'a> {
314314
} else {
315315
// Module is not inline and should not be skipped. We want
316316
// to process only the attributes in the current file.
317-
filterd_attrs = item.attrs
317+
filtered_attrs = item.attrs
318318
.iter()
319319
.filter_map(|a| {
320320
let attr_file = self.codemap.lookup_char_pos(a.span.lo()).file;
@@ -327,8 +327,8 @@ impl<'a> FmtVisitor<'a> {
327327
.collect::<Vec<_>>();
328328
// Assert because if we should skip it should be caught by
329329
// the above case.
330-
assert!(!self.visit_attrs(&filterd_attrs, ast::AttrStyle::Outer));
331-
attrs = &filterd_attrs;
330+
assert!(!self.visit_attrs(&filtered_attrs, ast::AttrStyle::Outer));
331+
attrs = &filtered_attrs;
332332
}
333333
}
334334
_ => if self.visit_attrs(&item.attrs, ast::AttrStyle::Outer) {

tests/source/configs-struct_field_align_threshold-20.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub struct State<F: FnMut() -> ()> { now: F }
159159

160160
pub struct State<F: FnMut()> { now: F }
161161

162-
struct Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
162+
struct Palette { /// A map of indices in the palette to a count of pixels in approximately that color
163163
foo: i32}
164164

165165
// Splitting a single line comment into a block previously had a misalignment

tests/source/fn-simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn op(x: Typ, key : &[u8], upd : Box<Fn(Option<&memcache::Item>) -> (memcache::S
77
"cool"}
88

99

10-
fn weird_comment(/* /*/ double level */ comment */ x: Hello /*/*/* tripple, even */*/*/,
10+
fn weird_comment(/* /*/ double level */ comment */ x: Hello /*/*/* triple, even */*/*/,
1111
// Does this work?
1212
y: World
1313
) {

tests/source/fn_args_density-vertical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-fn_args_density: Vertical
22

3-
// Empty list shoul stay on one line.
3+
// Empty list should stay on one line.
44
fn do_bar(
55

66
) -> u8 {

tests/source/issue-1049.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl Handle {
1010
}
1111
}
1212

13-
// Long function without return type that should not be reformated.
13+
// Long function without return type that should not be reformatted.
1414
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
1515

1616
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}

tests/source/issue-1468.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fn issue1468() {
22
euc_jp_decoder_functions!({
33
let trail_minus_offset = byte.wrapping_sub(0xA1);
44
// Fast-track Hiragana (60% according to Lunde)
5-
// and Katakana (10% acconding to Lunde).
5+
// and Katakana (10% according to Lunde).
66
if jis0208_lead_minus_offset == 0x03 &&
77
trail_minus_offset < 0x53 {
88
// Hiragana

tests/source/match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn issue355() {
193193
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => println!("a", b),
194194
// Rewrite splits macro
195195
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => vec!(1, 2),
196-
// Macro support fails to recognise this macro as splitable
196+
// Macro support fails to recognise this macro as splittable
197197
// We push the whole expr to a new line, TODO split this macro as well
198198
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => vec!(3; 4),
199199
// q, r and s: Rewrite splits match arm

tests/source/structs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub struct State<F: FnMut() -> ()> { now: F }
132132

133133
pub struct State<F: FnMut()> { now: F }
134134

135-
struct Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
135+
struct Palette { /// A map of indices in the palette to a count of pixels in approximately that color
136136
foo: i32}
137137

138138
// Splitting a single line comment into a block previously had a misalignment

tests/source/unions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub union State<F: FnMut() -> ()> { now: F }
9393

9494
pub union State<F: FnMut()> { now: F }
9595

96-
union Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
96+
union Palette { /// A map of indices in the palette to a count of pixels in approximately that color
9797
foo: i32}
9898

9999
// Splitting a single line comment into a block previously had a misalignment

tests/target/configs-struct_field_align_threshold-20.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub struct State<F: FnMut()> {
161161
}
162162

163163
struct Palette {
164-
/// A map of indizes in the palette to a count of pixels in approximately
164+
/// A map of indices in the palette to a count of pixels in approximately
165165
/// that color
166166
foo: i32,
167167
}

tests/target/fn-simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn simple(
2121

2222
fn weird_comment(
2323
// /*/ double level */ comment
24-
x: Hello, // /*/* tripple, even */*/
24+
x: Hello, // /*/* triple, even */*/
2525
// Does this work?
2626
y: World,
2727
) {

tests/target/fn_args_density-vertical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-fn_args_density: Vertical
22

3-
// Empty list shoul stay on one line.
3+
// Empty list should stay on one line.
44
fn do_bar() -> u8 {
55
bar()
66
}

tests/target/issue-1049.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Handle {
1616
}
1717
}
1818

19-
// Long function without return type that should not be reformated.
19+
// Long function without return type that should not be reformatted.
2020
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
2121

2222
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {

tests/target/issue-1468.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fn issue1468() {
22
euc_jp_decoder_functions!({
33
let trail_minus_offset = byte.wrapping_sub(0xA1);
44
// Fast-track Hiragana (60% according to Lunde)
5-
// and Katakana (10% acconding to Lunde).
5+
// and Katakana (10% according to Lunde).
66
if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 {
77
// Hiragana
88
handle.write_upper_bmp(0x3041 + trail_minus_offset as u16)

tests/target/match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn issue355() {
189189
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => {
190190
vec![1, 2]
191191
}
192-
// Macro support fails to recognise this macro as splitable
192+
// Macro support fails to recognise this macro as splittable
193193
// We push the whole expr to a new line, TODO split this macro as well
194194
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => {
195195
vec![3; 4]

tests/target/structs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub struct State<F: FnMut()> {
134134
}
135135

136136
struct Palette {
137-
/// A map of indizes in the palette to a count of pixels in approximately
137+
/// A map of indices in the palette to a count of pixels in approximately
138138
/// that color
139139
foo: i32,
140140
}

0 commit comments

Comments
 (0)