Rustup to rustc 1.16.0-nightly (468227129
2017-01-03): Body fixes for rustup
This commit is contained in:
parent
f552f170db
commit
64f5dbc9f8
26 changed files with 117 additions and 103 deletions
|
@ -4,7 +4,8 @@ use rustc::ty;
|
|||
use rustc::hir::*;
|
||||
use syntax::ast::{Lit, LitKind, Name};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_then, walk_ptrs_ty};
|
||||
use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_then, walk_ptrs_ty,
|
||||
is_self, has_self};
|
||||
|
||||
/// **What it does:** Checks for getting the length of something via `.len()`
|
||||
/// just to compare to zero, and suggests using `.is_empty()` where applicable.
|
||||
|
@ -89,16 +90,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
|
|||
|
||||
fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[TraitItem]) {
|
||||
fn is_named_self(item: &TraitItem, name: &str) -> bool {
|
||||
&*item.name.as_str() == name &&
|
||||
if let TraitItemKind::Method(ref sig, _) = item.node {
|
||||
if sig.decl.has_self() {
|
||||
sig.decl.inputs.len() == 1
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
return has_self(&*sig.decl) && &*item.name.as_str() == name && sig.decl.inputs.len() == 1;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
if !trait_items.iter().any(|i| is_named_self(i, "is_empty")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue