mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Upgrade rust to rustc 1.6.0-nightly (462ec0576 2015-12-09)
This commit is contained in:
parent
2fbe762a99
commit
b865e30b49
8 changed files with 18 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.0.29"
|
version = "0.0.30"
|
||||||
authors = [
|
authors = [
|
||||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||||
"Andre Bogus <bogusandre@gmail.com>",
|
"Andre Bogus <bogusandre@gmail.com>",
|
||||||
|
|
|
@ -66,7 +66,6 @@ fn is_path_equal(left : &Path, right : &Path) -> bool {
|
||||||
// we have to be explicit about hygiene
|
// we have to be explicit about hygiene
|
||||||
left.global == right.global && over(&left.segments, &right.segments,
|
left.global == right.global && over(&left.segments, &right.segments,
|
||||||
|l, r| l.identifier.name == r.identifier.name
|
|l, r| l.identifier.name == r.identifier.name
|
||||||
&& l.identifier.ctxt == r.identifier.ctxt
|
|
||||||
&& l.parameters == r.parameters)
|
&& l.parameters == r.parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl LateLintPass for LenZero {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[P<TraitItem>]) {
|
fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[TraitItem]) {
|
||||||
fn is_named_self(item: &TraitItem, name: &str) -> bool {
|
fn is_named_self(item: &TraitItem, name: &str) -> bool {
|
||||||
item.name.as_str() == name && if let MethodTraitItem(ref sig, _) =
|
item.name.as_str() == name && if let MethodTraitItem(ref sig, _) =
|
||||||
item.node { is_self_sig(sig) } else { false }
|
item.node { is_self_sig(sig) } else { false }
|
||||||
|
@ -69,7 +69,7 @@ fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[P<TraitItem>]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[P<ImplItem>]) {
|
fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
|
||||||
fn is_named_self(item: &ImplItem, name: &str) -> bool {
|
fn is_named_self(item: &ImplItem, name: &str) -> bool {
|
||||||
item.name.as_str() == name && if let ImplItemKind::Method(ref sig, _) =
|
item.name.as_str() == name && if let ImplItemKind::Method(ref sig, _) =
|
||||||
item.node { is_self_sig(sig) } else { false }
|
item.node { is_self_sig(sig) } else { false }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![feature(plugin_registrar, box_syntax)]
|
#![feature(plugin_registrar, box_syntax)]
|
||||||
#![feature(rustc_private, core, collections)]
|
#![feature(rustc_private, collections)]
|
||||||
#![feature(num_bits_bytes, iter_arith)]
|
#![feature(num_bits_bytes, iter_arith)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ pub mod escape;
|
||||||
pub mod misc_early;
|
pub mod misc_early;
|
||||||
|
|
||||||
mod reexport {
|
mod reexport {
|
||||||
pub use syntax::ast::{Name, Ident, NodeId};
|
pub use syntax::ast::{Name, NodeId};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[plugin_registrar]
|
#[plugin_registrar]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use rustc::lint::*;
|
use rustc::lint::*;
|
||||||
use rustc_front::hir::*;
|
use rustc_front::hir::*;
|
||||||
use syntax::ast::Ident;
|
|
||||||
use utils::{CLONE_PATH, OPTION_PATH};
|
use utils::{CLONE_PATH, OPTION_PATH};
|
||||||
use utils::{is_adjusted, match_path, match_trait_method, match_type, snippet, span_help_and_lint};
|
use utils::{is_adjusted, match_path, match_trait_method, match_type, snippet, span_help_and_lint};
|
||||||
use utils::{walk_ptrs_ty, walk_ptrs_ty_depth};
|
use utils::{walk_ptrs_ty, walk_ptrs_ty_depth};
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, block: &Block) {
|
||||||
let mut bindings = Vec::new();
|
let mut bindings = Vec::new();
|
||||||
for arg in &decl.inputs {
|
for arg in &decl.inputs {
|
||||||
if let PatIdent(_, ident, _) = arg.pat.node {
|
if let PatIdent(_, ident, _) = arg.pat.node {
|
||||||
bindings.push((ident.node.name, ident.span))
|
bindings.push((ident.node.unhygienic_name, ident.span))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_block(cx, block, &mut bindings);
|
check_block(cx, block, &mut bindings);
|
||||||
|
@ -85,7 +85,7 @@ fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span,
|
||||||
//TODO: match more stuff / destructuring
|
//TODO: match more stuff / destructuring
|
||||||
match pat.node {
|
match pat.node {
|
||||||
PatIdent(_, ref ident, ref inner) => {
|
PatIdent(_, ref ident, ref inner) => {
|
||||||
let name = ident.node.name;
|
let name = ident.node.unhygienic_name;
|
||||||
if is_binding(cx, pat) {
|
if is_binding(cx, pat) {
|
||||||
let mut new_binding = true;
|
let mut new_binding = true;
|
||||||
for tup in bindings.iter_mut() {
|
for tup in bindings.iter_mut() {
|
||||||
|
@ -266,7 +266,7 @@ fn is_self_shadow(name: Name, expr: &Expr) -> bool {
|
||||||
|
|
||||||
fn path_eq_name(name: Name, path: &Path) -> bool {
|
fn path_eq_name(name: Name, path: &Path) -> bool {
|
||||||
!path.global && path.segments.len() == 1 &&
|
!path.global && path.segments.len() == 1 &&
|
||||||
path.segments[0].identifier.name == name
|
path.segments[0].identifier.unhygienic_name == name
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ContainsSelf {
|
struct ContainsSelf {
|
||||||
|
@ -275,8 +275,8 @@ struct ContainsSelf {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'v> Visitor<'v> for ContainsSelf {
|
impl<'v> Visitor<'v> for ContainsSelf {
|
||||||
fn visit_name(&mut self, _: Span, name: Name) {
|
fn visit_ident(&mut self, _: Span, ident: Ident) {
|
||||||
if self.name == name {
|
if self.name == ident.unhygienic_name {
|
||||||
self.result = true;
|
self.result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,15 @@ fn first(x: (isize, isize)) -> isize { x.0 }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = 1;
|
let mut x = 1;
|
||||||
let x = &mut x; //~ERROR: x is shadowed by itself in &mut x
|
let x = &mut x; //~ERROR x is shadowed by itself in &mut x
|
||||||
let x = { x }; //~ERROR: x is shadowed by itself in { x }
|
let x = { x }; //~ERROR x is shadowed by itself in { x }
|
||||||
let x = (&*x); //~ERROR: x is shadowed by itself in &*x
|
let x = (&*x); //~ERROR x is shadowed by itself in &*x
|
||||||
let x = { *x + 1 }; //~ERROR: x is shadowed by { *x + 1 } which reuses
|
let x = { *x + 1 }; //~ERROR x is shadowed by { *x + 1 } which reuses
|
||||||
let x = id(x); //~ERROR: x is shadowed by id(x) which reuses
|
let x = id(x); //~ERROR x is shadowed by id(x) which reuses
|
||||||
let x = (1, x); //~ERROR: x is shadowed by (1, x) which reuses
|
let x = (1, x); //~ERROR x is shadowed by (1, x) which reuses
|
||||||
let x = first(x); //~ERROR: x is shadowed by first(x) which reuses
|
let x = first(x); //~ERROR x is shadowed by first(x) which reuses
|
||||||
let y = 1;
|
let y = 1;
|
||||||
let x = y; //~ERROR: x is shadowed by y
|
let x = y; //~ERROR x is shadowed by y
|
||||||
|
|
||||||
let o = Some(1u8);
|
let o = Some(1u8);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#![feature(core)]
|
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![plugin(clippy)]
|
#![plugin(clippy)]
|
||||||
#![deny(useless_transmute)]
|
#![deny(useless_transmute)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue