Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation for nightly 2018-04-06 #2640

Merged
merged 1 commit into from Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
if_chain! {
if let NestedMetaItemKind::MetaItem(ref mi) = item.node;
if let MetaItemKind::NameValue(ref lit) = mi.node;
if mi.name() == "since";
if mi.ident.name == "since";
then {
check_semver(cx, item.span, lit);
}
Expand Down Expand Up @@ -328,7 +328,7 @@ fn check_semver(cx: &LateContext, span: Span, lit: &Lit) {

fn is_word(nmi: &NestedMetaItem, expected: &str) -> bool {
if let NestedMetaItemKind::MetaItem(ref mi) = nmi.node {
mi.is_word() && mi.name() == expected
mi.is_word() && mi.ident.name == expected
} else {
false
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/const_static_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl StaticConst {
span_lint_and_then(
cx,
CONST_STATIC_LIFETIME,
lifetime.span,
lifetime.ident.span,
"Constants have by default a `'static` lifetime",
|db| {
db.span_suggestion(ty.span, "consider removing `'static`", sugg);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl LintPass for EnumVariantNames {
}

fn var2str(var: &Variant) -> InternedString {
var.node.name.name.as_str()
var.node.ident.name.as_str()
}

/// Returns the number of chars that match from the start
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/misc_early.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl EarlyLintPass for MiscEarly {
span_lint(
cx,
BUILTIN_TYPE_SHADOW,
ty.span,
ty.ident.span,
&format!("This generic shadows the built-in type `{}`", name),
);
}
Expand All @@ -209,7 +209,7 @@ impl EarlyLintPass for MiscEarly {
let type_name = npat.segments
.last()
.expect("A path must have at least one segment")
.identifier
.ident
.name;

for field in pfields {
Expand Down Expand Up @@ -267,8 +267,8 @@ impl EarlyLintPass for MiscEarly {
let mut registered_names: HashMap<String, Span> = HashMap::new();

for arg in &decl.inputs {
if let PatKind::Ident(_, sp_ident, None) = arg.pat.node {
let arg_name = sp_ident.node.to_string();
if let PatKind::Ident(_, ident, None) = arg.pat.node {
let arg_name = ident.name.to_string();

if arg_name.starts_with('_') {
if let Some(correspondence) = registered_names.get(&arg_name[1..]) {
Expand Down Expand Up @@ -328,13 +328,13 @@ impl EarlyLintPass for MiscEarly {
if let StmtKind::Local(ref local) = w[0].node;
if let Option::Some(ref t) = local.init;
if let ExprKind::Closure(_, _, _, _, _) = t.node;
if let PatKind::Ident(_, sp_ident, _) = local.pat.node;
if let PatKind::Ident(_, ident, _) = local.pat.node;
if let StmtKind::Semi(ref second) = w[1].node;
if let ExprKind::Assign(_, ref call) = second.node;
if let ExprKind::Call(ref closure, _) = call.node;
if let ExprKind::Path(_, ref path) = closure.node;
then {
if sp_ident.node == (&path.segments[0]).identifier {
if ident == (&path.segments[0]).ident {
span_lint(
cx,
REDUNDANT_CLOSURE_CALL,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct SimilarNamesNameVisitor<'a: 'b, 'tcx: 'a, 'b>(&'b mut SimilarNamesLocalVi
impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
fn visit_pat(&mut self, pat: &'tcx Pat) {
match pat.node {
PatKind::Ident(_, id, _) => self.check_name(id.span, id.node.name),
PatKind::Ident(_, ident, _) => self.check_name(ident.span, ident.name),
PatKind::Struct(_, ref fields, _) => for field in fields {
if !field.node.is_shorthand {
self.visit_pat(&field.node.pat);
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/returns.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use syntax::ast;
use syntax::codemap::{Span, Spanned};
use syntax::codemap::Span;
use syntax::visit::FnKind;

use utils::{in_external_macro, in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint};
Expand Down Expand Up @@ -112,9 +112,9 @@ impl ReturnPass {
if local.ty.is_none();
if !local.attrs.iter().any(attr_is_cfg);
if let Some(ref initexpr) = local.init;
if let ast::PatKind::Ident(_, Spanned { node: id, .. }, _) = local.pat.node;
if let ast::PatKind::Ident(_, ident, _) = local.pat.node;
if let ast::ExprKind::Path(_, ref path) = retexpr.node;
if match_path_ast(path, &[&id.name.as_str()]);
if match_path_ast(path, &[&ident.name.as_str()]);
if !in_external_macro(cx, initexpr.span);
then {
span_note_and_lint(cx,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unsafe_removed_from_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn check_use_tree(use_tree: &UseTree, cx: &EarlyContext, span: &Span) {
.segments
.last()
.expect("use paths cannot be empty")
.identifier;
.ident;
unsafe_to_safe_check(old_name, new_name, cx, span);
}
UseTreeKind::Simple(None) |
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ fn has_attr(attrs: &[Attribute]) -> bool {
attrs.iter().any(|attr| {
attr.check_name("clippy") && attr.meta_item_list().map_or(false, |list| {
list.len() == 1 && match list[0].node {
ast::NestedMetaItemKind::MetaItem(ref it) => it.name == "author",
ast::NestedMetaItemKind::MetaItem(ref it) => it.ident.name == "author",
ast::NestedMetaItemKind::Literal(_) => false,
}
})
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn file_from_args(
args: &[codemap::Spanned<ast::NestedMetaItemKind>],
) -> Result<Option<path::PathBuf>, (&'static str, codemap::Span)> {
for arg in args.iter().filter_map(|a| a.meta_item()) {
if arg.name() == "conf_file" {
if arg.ident.name == "conf_file" {
return match arg.node {
ast::MetaItemKind::Word | ast::MetaItemKind::List(_) => {
Err(("`conf_file` must be a named value", arg.span))
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub fn match_path_ast(path: &ast::Path, segments: &[&str]) -> bool {
.iter()
.rev()
.zip(segments.iter().rev())
.all(|(a, b)| a.identifier.name == *b)
.all(|(a, b)| a.ident.name == *b)
}

/// Get the definition associated to a path.
Expand Down