Skip to content

Commit f1c5b45

Browse files
committed
Rustup to *1.13.0-nightly (eac4146 2016-08-30)*
1 parent 39d4a1b commit f1c5b45

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

clippy_lints/src/attrs.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use reexport::*;
44
use rustc::lint::*;
55
use rustc::hir::*;
66
use semver::Version;
7-
use syntax::ast::{Attribute, Lit, LitKind, MetaItemKind};
7+
use syntax::ast::{Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
88
use syntax::codemap::Span;
99
use utils::{in_macro, match_path, span_lint, span_lint_and_then, snippet_opt};
1010
use utils::paths;
@@ -89,11 +89,13 @@ impl LateLintPass for AttrPass {
8989
return;
9090
}
9191
for item in items {
92-
if let MetaItemKind::NameValue(ref name, ref lit) = item.node {
93-
if name == &"since" {
94-
check_semver(cx, item.span, lit);
95-
}
96-
}
92+
if_let_chain! {[
93+
let NestedMetaItemKind::MetaItem(ref mi) = item.node,
94+
let MetaItemKind::NameValue(ref name, ref lit) = mi.node,
95+
name == &"since",
96+
], {
97+
check_semver(cx, item.span, lit);
98+
}}
9799
}
98100
}
99101
}
@@ -111,11 +113,9 @@ impl LateLintPass for AttrPass {
111113
"allow" | "warn" | "deny" | "forbid" => {
112114
// whitelist `unused_imports`
113115
for lint in lint_list {
114-
if let MetaItemKind::Word(ref word) = lint.node {
115-
if word == "unused_imports" {
116-
if let ItemUse(_) = item.node {
117-
return;
118-
}
116+
if is_word(lint, "unused_imports") {
117+
if let ItemUse(_) = item.node {
118+
return;
119119
}
120120
}
121121
}
@@ -214,10 +214,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
214214
if values.len() != 1 || inline != &"inline" {
215215
continue;
216216
}
217-
if let MetaItemKind::Word(ref always) = values[0].node {
218-
if always != &"always" {
219-
continue;
220-
}
217+
if is_word(&values[0], "always") {
221218
span_lint(cx,
222219
INLINE_ALWAYS,
223220
attr.span,
@@ -239,3 +236,13 @@ fn check_semver(cx: &LateContext, span: Span, lit: &Lit) {
239236
span,
240237
"the since field must contain a semver-compliant version");
241238
}
239+
240+
fn is_word(nmi: &NestedMetaItem, expected: &str) -> bool {
241+
if let NestedMetaItemKind::MetaItem(ref mi) = nmi.node {
242+
if let MetaItemKind::Word(ref word) = mi.node {
243+
return word == expected;
244+
}
245+
}
246+
247+
false
248+
}

clippy_lints/src/missing_doc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc::hir;
2121
use rustc::lint::*;
2222
use rustc::ty;
2323
use syntax::ast;
24-
use syntax::attr::{self, AttrMetaMethods};
24+
use syntax::attr;
2525
use syntax::codemap::Span;
2626
use utils::in_macro;
2727

@@ -99,7 +99,7 @@ impl LateLintPass for MissingDoc {
9999
let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| {
100100
attr.check_name("doc") && match attr.meta_item_list() {
101101
None => false,
102-
Some(l) => attr::contains_name(&l[..], "hidden"),
102+
Some(l) => attr::list_contains_name(&l[..], "hidden"),
103103
}
104104
});
105105
self.doc_hidden_stack.push(doc_hidden);
@@ -123,6 +123,7 @@ impl LateLintPass for MissingDoc {
123123
hir::ItemStruct(..) => "a struct",
124124
hir::ItemTrait(..) => "a trait",
125125
hir::ItemTy(..) => "a type alias",
126+
hir::ItemUnion(..) => "a union",
126127
hir::ItemDefaultImpl(..) |
127128
hir::ItemExternCrate(..) |
128129
hir::ItemForeignMod(..) |

clippy_lints/src/unsafe_removed_from_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ impl LateLintPass for UnsafeNameRemoval {
5151
ViewPath_::ViewPathList(_, ref path_list_items) => {
5252
for path_list_item in path_list_items.iter() {
5353
let plid = path_list_item.node;
54-
if let (Some(name), Some(rename)) = (plid.name(), plid.rename()) {
55-
unsafe_to_safe_check(name, rename, cx, &item.span);
54+
if let Some(rename) = plid.rename {
55+
unsafe_to_safe_check(plid.name, rename, cx, &item.span);
5656
};
5757
}
5858
}

clippy_lints/src/utils/conf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use std::{fmt, fs, io};
66
use std::io::Read;
7-
use syntax::{ast, codemap, ptr};
7+
use syntax::{ast, codemap};
88
use syntax::parse::token;
99
use toml;
1010

1111
/// Get the configuration file from arguments.
12-
pub fn file(args: &[ptr::P<ast::MetaItem>]) -> Result<Option<token::InternedString>, (&'static str, codemap::Span)> {
13-
for arg in args {
12+
pub fn file(args: &[codemap::Spanned<ast::NestedMetaItemKind>]) -> Result<Option<token::InternedString>, (&'static str, codemap::Span)> {
13+
for arg in args.iter().filter_map(|a| a.meta_item()) {
1414
match arg.node {
1515
ast::MetaItemKind::Word(ref name) |
1616
ast::MetaItemKind::List(ref name, _) => {

0 commit comments

Comments
 (0)