Skip to content

Commit 3eccccb

Browse files
viflip1995
authored andcommitted
Fix indents
1 parent 2781cac commit 3eccccb

26 files changed

+253
-235
lines changed

clippy_lints/src/bit_mask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
144144
"try",
145145
format!("{}.trailing_zeros() >= {}", sugg, n.count_ones()),
146146
Applicability::Unspecified,
147-
);
147+
);
148148
});
149149
}
150150
}

clippy_lints/src/booleans.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,14 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
418418
NONMINIMAL_BOOL,
419419
e.span,
420420
"this boolean expression can be simplified",
421-
|db| { db.span_suggestions_with_applicability(
421+
|db| {
422+
db.span_suggestions_with_applicability(
422423
e.span,
423424
"try",
424425
suggestions,
425426
Applicability::Unspecified,
426-
); },
427+
);
428+
},
427429
);
428430
};
429431
if improvements.is_empty() {

clippy_lints/src/collapsible_if.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,16 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: &
134134
span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| {
135135
let lhs = Sugg::ast(cx, check, "..");
136136
let rhs = Sugg::ast(cx, check_inner, "..");
137-
db.span_suggestion_with_applicability(expr.span,
138-
"try",
139-
format!("if {} {}",
140-
lhs.and(&rhs),
141-
snippet_block(cx, content.span, "..")),
142-
Applicability::Unspecified,
143-
);
137+
db.span_suggestion_with_applicability(
138+
expr.span,
139+
"try",
140+
format!(
141+
"if {} {}",
142+
lhs.and(&rhs),
143+
snippet_block(cx, content.span, ".."),
144+
),
145+
Applicability::Unspecified,
146+
);
144147
});
145148
}
146149
}

clippy_lints/src/const_static_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl StaticConst {
6666
"consider removing `'static`",
6767
sugg,
6868
Applicability::Unspecified,
69-
);
69+
);
7070
},
7171
);
7272
}

clippy_lints/src/entry.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,23 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
141141
snippet(self.cx, params[2].span, ".."));
142142

143143
db.span_suggestion_with_applicability(
144-
self.span,
145-
"consider using",
146-
help,
147-
Applicability::Unspecified,
148-
);
144+
self.span,
145+
"consider using",
146+
help,
147+
Applicability::Unspecified,
148+
);
149149
}
150150
else {
151151
let help = format!("{}.entry({})",
152152
snippet(self.cx, self.map.span, "map"),
153153
snippet(self.cx, params[1].span, ".."));
154154

155155
db.span_suggestion_with_applicability(
156-
self.span,
157-
"consider using",
158-
help,
159-
Applicability::Unspecified,
160-
);
156+
self.span,
157+
"consider using",
158+
help,
159+
Applicability::Unspecified,
160+
);
161161
}
162162
});
163163
}

clippy_lints/src/eq_op.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
115115
span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
116116
let lsnip = snippet(cx, l.span, "...").to_string();
117117
db.span_suggestion_with_applicability(
118-
left.span,
119-
"use the left value directly",
120-
lsnip,
121-
Applicability::Unspecified,
122-
);
118+
left.span,
119+
"use the left value directly",
120+
lsnip,
121+
Applicability::Unspecified,
122+
);
123123
})
124124
} else if !lcpy && rcpy && implements_trait(cx, cx.tables.expr_ty(left), trait_id, &[rty.into()]) {
125125
span_lint_and_then(
@@ -133,7 +133,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
133133
right.span,
134134
"use the right value directly",
135135
rsnip,
136-
Applicability::Unspecified,);
136+
Applicability::Unspecified,
137+
);
137138
},
138139
)
139140
}
@@ -146,11 +147,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
146147
span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
147148
let lsnip = snippet(cx, l.span, "...").to_string();
148149
db.span_suggestion_with_applicability(
149-
left.span,
150-
"use the left value directly",
151-
lsnip,
152-
Applicability::Unspecified,
153-
);
150+
left.span,
151+
"use the left value directly",
152+
lsnip,
153+
Applicability::Unspecified,
154+
);
154155
})
155156
}
156157
},
@@ -162,11 +163,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
162163
span_lint_and_then(cx, OP_REF, e.span, "taken reference of right operand", |db| {
163164
let rsnip = snippet(cx, r.span, "...").to_string();
164165
db.span_suggestion_with_applicability(
165-
right.span,
166-
"use the right value directly",
167-
rsnip,
168-
Applicability::Unspecified,
169-
);
166+
right.span,
167+
"use the right value directly",
168+
rsnip,
169+
Applicability::Unspecified,
170+
);
170171
})
171172
}
172173
},

clippy_lints/src/eta_reduction.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) {
9898
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure found", |db| {
9999
if let Some(snippet) = snippet_opt(cx, caller.span) {
100100
db.span_suggestion_with_applicability(
101-
expr.span,
102-
"remove closure as shown",
103-
snippet,
104-
Applicability::Unspecified,
105-
);
101+
expr.span,
102+
"remove closure as shown",
103+
snippet,
104+
Applicability::Unspecified,
105+
);
106106
}
107107
});
108108
}

clippy_lints/src/format.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
6262
let sugg = format!("{}.to_string()", snippet(cx, format_arg, "<arg>").into_owned());
6363
span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| {
6464
db.span_suggestion_with_applicability(
65-
expr.span,
66-
"consider using .to_string()",
67-
sugg,
68-
Applicability::Unspecified,
69-
);
65+
expr.span,
66+
"consider using .to_string()",
67+
sugg,
68+
Applicability::Unspecified,
69+
);
7070
});
7171
}
7272
}
@@ -77,11 +77,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
7777
let sugg = format!("{}.to_string()", snippet(cx, expr.span, "<expr>").into_owned());
7878
span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| {
7979
db.span_suggestion_with_applicability(
80-
span,
81-
"consider using .to_string()",
82-
sugg,
83-
Applicability::Unspecified,
84-
);
80+
span,
81+
"consider using .to_string()",
82+
sugg,
83+
Applicability::Unspecified,
84+
);
8585
});
8686
}
8787
},

clippy_lints/src/identity_conversion.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
6565
let sugg = snippet(cx, args[0].span, "<expr>").into_owned();
6666
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
6767
db.span_suggestion_with_applicability(
68-
e.span,
69-
"consider removing `.into()`",
70-
sugg,
71-
Applicability::Unspecified,
72-
);
68+
e.span,
69+
"consider removing `.into()`",
70+
sugg,
71+
Applicability::Unspecified,
72+
);
7373
});
7474
}
7575
}
@@ -80,11 +80,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
8080
let sugg = snippet(cx, args[0].span, "<expr>").into_owned();
8181
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
8282
db.span_suggestion_with_applicability(
83-
e.span,
84-
"consider removing `.into_iter()`",
85-
sugg,
86-
Applicability::Unspecified,
87-
);
83+
e.span,
84+
"consider removing `.into_iter()`",
85+
sugg,
86+
Applicability::Unspecified,
87+
);
8888
});
8989
}
9090
}
@@ -100,11 +100,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
100100
let sugg_msg = format!("consider removing `{}()`", snippet(cx, path.span, "From::from"));
101101
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
102102
db.span_suggestion_with_applicability(
103-
e.span,
104-
&sugg_msg,
105-
sugg,
106-
Applicability::Unspecified,
107-
);
103+
e.span,
104+
&sugg_msg,
105+
sugg,
106+
Applicability::Unspecified,
107+
);
108108
});
109109
}
110110
}

clippy_lints/src/int_plus_one.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ impl IntPlusOne {
154154
fn emit_warning(&self, cx: &EarlyContext<'_>, block: &Expr, recommendation: String) {
155155
span_lint_and_then(cx, INT_PLUS_ONE, block.span, "Unnecessary `>= y + 1` or `x - 1 >=`", |db| {
156156
db.span_suggestion_with_applicability(
157-
block.span,
158-
"change `>= y + 1` to `> y` as shown",
159-
recommendation,
160-
Applicability::Unspecified,
161-
);
157+
block.span,
158+
"change `>= y + 1` to `> y` as shown",
159+
recommendation,
160+
Applicability::Unspecified,
161+
);
162162
});
163163
}
164164
}

clippy_lints/src/let_if_seq.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
122122
"`if _ { .. } else { .. }` is an expression",
123123
|db| {
124124
db.span_suggestion_with_applicability(
125-
span,
126-
"it is more idiomatic to write",
127-
sug,
128-
Applicability::Unspecified,
129-
);
125+
span,
126+
"it is more idiomatic to write",
127+
sug,
128+
Applicability::Unspecified,
129+
);
130130
if !mutability.is_empty() {
131131
db.note("you might not need `mut` at all");
132132
}

clippy_lints/src/map_unit_fn.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,22 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr
229229
snippet(cx, var_arg.span, "_"),
230230
snippet(cx, reduced_expr_span, "_"));
231231
db.span_suggestion_with_applicability(
232-
stmt.span,
233-
"try this",
234-
suggestion,
235-
Applicability::Unspecified,
236-
);
232+
stmt.span,
233+
"try this",
234+
suggestion,
235+
Applicability::Unspecified,
236+
);
237237
} else {
238238
let suggestion = format!("if let {0}({1}) = {2} {{ ... }}",
239239
variant,
240240
snippet(cx, binding.pat.span, "_"),
241241
snippet(cx, var_arg.span, "_"));
242-
db.span_suggestion_with_applicability(stmt.span,
243-
"try this",
244-
suggestion,
245-
Applicability::Unspecified);
242+
db.span_suggestion_with_applicability(
243+
stmt.span,
244+
"try this",
245+
suggestion,
246+
Applicability::Unspecified,
247+
);
246248
}
247249
});
248250
}

clippy_lints/src/matches.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ fn check_match_bool(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Ex
341341

342342
if let Some(sugg) = sugg {
343343
db.span_suggestion_with_applicability(
344-
expr.span,
345-
"consider using an if/else expression",
346-
sugg,
347-
Applicability::Unspecified,
348-
);
344+
expr.span,
345+
"consider using an if/else expression",
346+
sugg,
347+
Applicability::Unspecified,
348+
);
349349
}
350350
}
351351
}

clippy_lints/src/methods.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,17 +1129,17 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp
11291129
let derefs: String = iter::repeat('*').take(n).collect();
11301130
let explicit = format!("{}{}::clone({})", refs, ty, snip);
11311131
db.span_suggestion_with_applicability(
1132-
expr.span,
1133-
"try dereferencing it",
1134-
format!("{}({}{}).clone()", refs, derefs, snip.deref()),
1135-
Applicability::Unspecified,
1136-
);
1132+
expr.span,
1133+
"try dereferencing it",
1134+
format!("{}({}{}).clone()", refs, derefs, snip.deref()),
1135+
Applicability::Unspecified,
1136+
);
11371137
db.span_suggestion_with_applicability(
1138-
expr.span,
1139-
"or try being explicit about what type to clone",
1140-
explicit,
1141-
Applicability::Unspecified,
1142-
);
1138+
expr.span,
1139+
"or try being explicit about what type to clone",
1140+
explicit,
1141+
Applicability::Unspecified,
1142+
);
11431143
},
11441144
);
11451145
return; // don't report clone_on_copy
@@ -1185,7 +1185,7 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp
11851185
text,
11861186
snip,
11871187
Applicability::Unspecified,
1188-
);
1188+
);
11891189
}
11901190
});
11911191
}
@@ -1656,11 +1656,11 @@ fn lint_map_or_none<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr,
16561656
let hint = format!("{0}.and_then({1})", map_or_self_snippet, map_or_func_snippet);
16571657
span_lint_and_then(cx, OPTION_MAP_OR_NONE, expr.span, msg, |db| {
16581658
db.span_suggestion_with_applicability(
1659-
expr.span,
1660-
"try using and_then instead",
1661-
hint,
1662-
Applicability::Unspecified,
1663-
);
1659+
expr.span,
1660+
"try using and_then instead",
1661+
hint,
1662+
Applicability::Unspecified,
1663+
);
16641664
});
16651665
}
16661666
}

0 commit comments

Comments
 (0)