mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 09:27:25 +00:00
Merge pull request #2640 from mikerite/fix_compilation_20180406
Fix compilation for nightly 2018-04-06
This commit is contained in:
commit
a863ba16e1
10 changed files with 18 additions and 18 deletions
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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..]) {
|
||||
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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};
|
||||
|
@ -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,
|
||||
|
|
|
@ -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) |
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue