Skip to content

Commit 8cfc91b

Browse files
committed
Cargo fmt
1 parent 664391c commit 8cfc91b

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

clippy_lints/src/attrs.rs

+55-55
Original file line numberDiff line numberDiff line change
@@ -210,27 +210,27 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
210210
if let Some(items) = &attr.meta_item_list() {
211211
if let Some(ident) = attr.ident_str() {
212212
match ident {
213-
"allow" | "warn" | "deny" | "forbid" => {
214-
check_clippy_lint_names(cx, items);
215-
},
216-
_ => {},
217-
}
213+
"allow" | "warn" | "deny" | "forbid" => {
214+
check_clippy_lint_names(cx, items);
215+
},
216+
_ => {},
217+
}
218218
if items.is_empty() || !attr.check_name("deprecated") {
219-
return;
220-
}
221-
for item in items {
222-
if_chain! {
219+
return;
220+
}
221+
for item in items {
222+
if_chain! {
223223
if let NestedMetaItem::MetaItem(mi) = &item;
224-
if let MetaItemKind::NameValue(lit) = &mi.node;
224+
if let MetaItemKind::NameValue(lit) = &mi.node;
225225
if mi.check_name("since");
226-
then {
226+
then {
227227
check_semver(cx, item.span(), lit);
228+
}
228229
}
229230
}
230231
}
231232
}
232233
}
233-
}
234234

235235
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
236236
if is_relevant_item(cx.tcx, item) {
@@ -244,54 +244,54 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
244244
if let Some(lint_list) = &attr.meta_item_list() {
245245
if let Some(ident) = attr.ident_str() {
246246
match ident {
247-
"allow" | "warn" | "deny" | "forbid" => {
248-
// whitelist `unused_imports` and `deprecated` for `use` items
249-
// and `unused_imports` for `extern crate` items with `macro_use`
250-
for lint in lint_list {
251-
match item.node {
252-
ItemKind::Use(..) => {
253-
if is_word(lint, "unused_imports") || is_word(lint, "deprecated") {
254-
return;
255-
}
256-
},
257-
ItemKind::ExternCrate(..) => {
258-
if is_word(lint, "unused_imports") && skip_unused_imports {
259-
return;
260-
}
261-
if is_word(lint, "unused_extern_crates") {
262-
return;
263-
}
264-
},
265-
_ => {},
266-
}
267-
}
268-
let line_span = last_line_of_span(cx, attr.span);
269-
270-
if let Some(mut sugg) = snippet_opt(cx, line_span) {
271-
if sugg.contains("#[") {
272-
span_lint_and_then(
273-
cx,
274-
USELESS_ATTRIBUTE,
275-
line_span,
276-
"useless lint attribute",
277-
|db| {
278-
sugg = sugg.replacen("#[", "#![", 1);
279-
db.span_suggestion(
280-
line_span,
281-
"if you just forgot a `!`, use",
282-
sugg,
283-
Applicability::MachineApplicable,
284-
);
247+
"allow" | "warn" | "deny" | "forbid" => {
248+
// whitelist `unused_imports` and `deprecated` for `use` items
249+
// and `unused_imports` for `extern crate` items with `macro_use`
250+
for lint in lint_list {
251+
match item.node {
252+
ItemKind::Use(..) => {
253+
if is_word(lint, "unused_imports") || is_word(lint, "deprecated") {
254+
return;
255+
}
285256
},
286-
);
257+
ItemKind::ExternCrate(..) => {
258+
if is_word(lint, "unused_imports") && skip_unused_imports {
259+
return;
260+
}
261+
if is_word(lint, "unused_extern_crates") {
262+
return;
263+
}
264+
},
265+
_ => {},
266+
}
287267
}
288-
}
289-
},
290-
_ => {},
268+
let line_span = last_line_of_span(cx, attr.span);
269+
270+
if let Some(mut sugg) = snippet_opt(cx, line_span) {
271+
if sugg.contains("#[") {
272+
span_lint_and_then(
273+
cx,
274+
USELESS_ATTRIBUTE,
275+
line_span,
276+
"useless lint attribute",
277+
|db| {
278+
sugg = sugg.replacen("#[", "#![", 1);
279+
db.span_suggestion(
280+
line_span,
281+
"if you just forgot a `!`, use",
282+
sugg,
283+
Applicability::MachineApplicable,
284+
);
285+
},
286+
);
287+
}
288+
}
289+
},
290+
_ => {},
291+
}
291292
}
292293
}
293294
}
294-
}
295295
},
296296
_ => {},
297297
}

0 commit comments

Comments
 (0)