Skip to content

Commit a31e5f5

Browse files
committed
Run rustfmt
1 parent 6fb1075 commit a31e5f5

File tree

5 files changed

+22
-44
lines changed

5 files changed

+22
-44
lines changed

clippy_lints/src/doc.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
563563
| ItemKind::ExternCrate(..)
564564
| ItemKind::ForeignMod(..) => return false,
565565
// We found a main function ...
566-
ItemKind::Fn(box FnKind(_, sig, _, Some(block)))
567-
if item.ident.name == sym::main =>
568-
{
566+
ItemKind::Fn(box FnKind(_, sig, _, Some(block))) if item.ident.name == sym::main => {
569567
let is_async = matches!(sig.header.asyncness, Async::Yes { .. });
570568
let returns_nothing = match &sig.decl.output {
571569
FnRetTy::Default(..) => true,

clippy_lints/src/excessive_bools.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use crate::utils::{attr_by_name, in_macro, match_path_ast, span_lint_and_help};
2-
use rustc_ast::ast::{
3-
AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind,
4-
};
2+
use rustc_ast::ast::{AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind};
53
use rustc_lint::{EarlyContext, EarlyLintPass};
64
use rustc_session::{declare_tool_lint, impl_lint_pass};
75
use rustc_span::Span;
@@ -160,15 +158,17 @@ impl EarlyLintPass for ExcessiveBools {
160158
"consider using a state machine or refactoring bools into two-variant enums",
161159
);
162160
}
163-
}
164-
ItemKind::Impl(box ImplKind { of_trait: None, items, .. })
161+
},
162+
ItemKind::Impl(box ImplKind {
163+
of_trait: None, items, ..
164+
})
165165
| ItemKind::Trait(box TraitKind(.., items)) => {
166166
for item in items {
167167
if let AssocItemKind::Fn(box FnKind(_, fn_sig, _, _)) = &item.kind {
168168
self.check_fn_sig(cx, fn_sig, item.span);
169169
}
170170
}
171-
}
171+
},
172172
ItemKind::Fn(box FnKind(_, fn_sig, _, _)) => self.check_fn_sig(cx, fn_sig, item.span),
173173
_ => (),
174174
}

clippy_lints/src/non_expressive_names.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::utils::{span_lint, span_lint_and_then};
22
use rustc_ast::ast::{
3-
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, FnKind, Item, ItemKind, Local, Pat,
4-
PatKind,
3+
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, FnKind, Item, ItemKind, Local, Pat, PatKind,
54
};
65
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
76
use rustc_lint::{EarlyContext, EarlyLintPass};

clippy_lints/src/utils/ast_utils.rs

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -229,25 +229,16 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
229229
match (l, r) {
230230
(ExternCrate(l), ExternCrate(r)) => l == r,
231231
(Use(l), Use(r)) => eq_use_tree(l, r),
232-
(Static(lt, lm, le), Static(rt, rm, re)) => {
233-
lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re)
234-
}
235-
(Const(ld, lt, le), Const(rd, rt, re)) => {
236-
eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re)
237-
}
232+
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
233+
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
238234
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
239-
eq_defaultness(*ld, *rd)
240-
&& eq_fn_sig(lf, rf)
241-
&& eq_generics(lg, rg)
242-
&& both(lb, rb, |l, r| eq_block(l, r))
243-
}
244-
(Mod(l), Mod(r)) => {
245-
l.inline == r.inline && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_item_kind))
246-
}
235+
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
236+
},
237+
(Mod(l), Mod(r)) => l.inline == r.inline && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_item_kind)),
247238
(ForeignMod(l), ForeignMod(r)) => {
248239
both(&l.abi, &r.abi, |l, r| eq_str_lit(l, r))
249240
&& over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind))
250-
}
241+
},
251242
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
252243
eq_defaultness(*ld, *rd)
253244
&& eq_generics(lg, rg)
@@ -259,7 +250,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
259250
},
260251
(Struct(lv, lg), Struct(rv, rg)) | (Union(lv, lg), Union(rv, rg)) => {
261252
eq_variant_data(lv, rv) && eq_generics(lg, rg)
262-
}
253+
},
263254
(Trait(box TraitKind(la, lu, lg, lb, li)), Trait(box TraitKind(ra, ru, rg, rb, ri))) => {
264255
la == ra
265256
&& matches!(lu, Unsafe::No) == matches!(ru, Unsafe::No)
@@ -308,15 +299,10 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
308299
pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
309300
use ForeignItemKind::*;
310301
match (l, r) {
311-
(Static(lt, lm, le), Static(rt, rm, re)) => {
312-
lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re)
313-
}
302+
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
314303
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
315-
eq_defaultness(*ld, *rd)
316-
&& eq_fn_sig(lf, rf)
317-
&& eq_generics(lg, rg)
318-
&& both(lb, rb, |l, r| eq_block(l, r))
319-
}
304+
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
305+
},
320306
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
321307
eq_defaultness(*ld, *rd)
322308
&& eq_generics(lg, rg)
@@ -331,15 +317,10 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
331317
pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
332318
use AssocItemKind::*;
333319
match (l, r) {
334-
(Const(ld, lt, le), Const(rd, rt, re)) => {
335-
eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re)
336-
}
320+
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
337321
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
338-
eq_defaultness(*ld, *rd)
339-
&& eq_fn_sig(lf, rf)
340-
&& eq_generics(lg, rg)
341-
&& both(lb, rb, |l, r| eq_block(l, r))
342-
}
322+
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
323+
},
343324
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
344325
eq_defaultness(*ld, *rd)
345326
&& eq_generics(lg, rg)

clippy_lints/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl_lint_pass!(Write => [
231231

232232
impl EarlyLintPass for Write {
233233
fn check_item(&mut self, _: &EarlyContext<'_>, item: &Item) {
234-
if let ItemKind::Impl (box ImplKind {
234+
if let ItemKind::Impl(box ImplKind {
235235
of_trait: Some(trait_ref),
236236
..
237237
}) = &item.kind

0 commit comments

Comments
 (0)