mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Upgrade to rustc 1.3.0-nightly (4d52d7c85 2015-07-30)
This commit is contained in:
parent
0e8e8cfc9b
commit
de5ccdfab6
6 changed files with 13 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
authors = [
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
"Andre Bogus <bogusandre@gmail.com>"
|
||||
|
@ -23,4 +23,4 @@ lazy_static = "*"
|
|||
|
||||
[features]
|
||||
|
||||
structured_logging = []
|
||||
structured_logging = []
|
||||
|
|
|
@ -103,7 +103,7 @@ fn check_attrs(cx: &Context, info: Option<&ExpnInfo>, ident: &Ident,
|
|||
span_lint(cx, INLINE_ALWAYS, attr.span, &format!(
|
||||
"You have declared #[inline(always)] on {}. This \
|
||||
is usually a bad idea. Are you sure?",
|
||||
ident.as_str()));
|
||||
ident.name.as_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl LintPass for LenZero {
|
|||
|
||||
fn check_trait_items(cx: &Context, item: &Item, trait_items: &[P<TraitItem>]) {
|
||||
fn is_named_self(item: &TraitItem, name: &str) -> bool {
|
||||
item.ident.as_str() == name && if let MethodTraitItem(ref sig, _) =
|
||||
item.ident.name == name && if let MethodTraitItem(ref sig, _) =
|
||||
item.node { is_self_sig(sig) } else { false }
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ fn check_trait_items(cx: &Context, item: &Item, trait_items: &[P<TraitItem>]) {
|
|||
span_lint(cx, LEN_WITHOUT_IS_EMPTY, i.span,
|
||||
&format!("Trait '{}' has a '.len(_: &Self)' method, but no \
|
||||
'.is_empty(_: &Self)' method. Consider adding one.",
|
||||
item.ident.as_str()));
|
||||
item.ident.name));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ fn check_trait_items(cx: &Context, item: &Item, trait_items: &[P<TraitItem>]) {
|
|||
|
||||
fn check_impl_items(cx: &Context, item: &Item, impl_items: &[P<ImplItem>]) {
|
||||
fn is_named_self(item: &ImplItem, name: &str) -> bool {
|
||||
item.ident.as_str() == name && if let MethodImplItem(ref sig, _) =
|
||||
item.ident.name == name && if let MethodImplItem(ref sig, _) =
|
||||
item.node { is_self_sig(sig) } else { false }
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ fn check_impl_items(cx: &Context, item: &Item, impl_items: &[P<ImplItem>]) {
|
|||
Span{ lo: s.lo, hi: s.lo, expn_id: s.expn_id },
|
||||
&format!("Item '{}' has a '.len(_: &Self)' method, but no \
|
||||
'.is_empty(_: &Self)' method. Consider adding one.",
|
||||
item.ident.as_str()));
|
||||
item.ident.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ fn check_cmp(cx: &Context, span: Span, left: &Expr, right: &Expr, empty: &str) {
|
|||
fn check_len_zero(cx: &Context, span: Span, method: &SpannedIdent,
|
||||
args: &[P<Expr>], lit: &Lit, empty: &str) {
|
||||
if let &Spanned{node: LitInt(0, _), ..} = lit {
|
||||
if method.node.as_str() == "len" && args.len() == 1 &&
|
||||
if method.node.name == "len" && args.len() == 1 &&
|
||||
has_is_empty(cx, &*args[0]) {
|
||||
span_lint(cx, LEN_ZERO, span, &format!(
|
||||
"Consider replacing the len comparison with '{}_.is_empty()'",
|
||||
|
|
|
@ -70,7 +70,7 @@ impl LintPass for StrToStringPass {
|
|||
fn check_expr(&mut self, cx: &Context, expr: &ast::Expr) {
|
||||
match expr.node {
|
||||
ast::ExprMethodCall(ref method, _, ref args)
|
||||
if method.node.as_str() == "to_string"
|
||||
if method.node.name == "to_string"
|
||||
&& is_str(cx, &*args[0]) => {
|
||||
span_lint(cx, STR_TO_STRING, expr.span, "str.to_owned() is faster");
|
||||
},
|
||||
|
@ -135,7 +135,7 @@ impl LintPass for CmpNan {
|
|||
}
|
||||
|
||||
fn check_nan(cx: &Context, path: &Path, span: Span) {
|
||||
path.segments.last().map(|seg| if seg.identifier.as_str() == "NAN" {
|
||||
path.segments.last().map(|seg| if seg.identifier.name == "NAN" {
|
||||
span_lint(cx, CMP_NAN, span, "Doomed comparison with NAN, use std::{f32,f64}::is_nan instead");
|
||||
});
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ impl LintPass for CmpOwned {
|
|||
fn check_to_owned(cx: &Context, expr: &Expr, other_span: Span) {
|
||||
match &expr.node {
|
||||
&ExprMethodCall(Spanned{node: ref ident, ..}, _, ref args) => {
|
||||
let name = ident.as_str();
|
||||
let name = ident.name;
|
||||
if name == "to_string" ||
|
||||
name == "to_owned" && is_str_arg(cx, args) {
|
||||
span_lint(cx, CMP_OWNED, expr.span, &format!(
|
||||
|
|
|
@ -25,7 +25,7 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
|
|||
// I could muck around with the maps and find the full path
|
||||
// however the more efficient way is to simply reverse the iterators and zip them
|
||||
// which will compare them in reverse until one of them runs out of segments
|
||||
if seg.iter().rev().zip(segments.iter().rev()).all(|(a,b)| a.identifier.as_str() == *b) {
|
||||
if seg.iter().rev().zip(segments.iter().rev()).all(|(a,b)| a.identifier.name == b) {
|
||||
match seg[..].last() {
|
||||
Some(&PathSegment {parameters: AngleBracketedParameters(ref a), ..}) => {
|
||||
Some(&a.types[..])
|
||||
|
|
|
@ -41,7 +41,7 @@ pub fn match_def_path(cx: &Context, def_id: DefId, path: &[&str]) -> bool {
|
|||
/// `match_path(path, &["std", "rt", "begin_unwind"])`
|
||||
pub fn match_path(path: &Path, segments: &[&str]) -> bool {
|
||||
path.segments.iter().rev().zip(segments.iter().rev()).all(
|
||||
|(a,b)| a.identifier.as_str() == *b)
|
||||
|(a,b)| a.identifier.name == b)
|
||||
}
|
||||
|
||||
/// convert a span to a code snippet if available, otherwise use default, e.g.
|
||||
|
|
Loading…
Reference in a new issue