Skip to content

Commit 501ff22

Browse files
authored
Merge pull request #1351 from Manishearth/rustup-2016-11-18
Rustup to *rustc 1.15.0-nightly (ac635aa 2016-11-18)* and bump to 0.0.100
2 parents 276e85b + 40fcae1 commit 501ff22

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 0.0.100 — 2016-11-20
5+
* Update to *rustc 1.15.0-nightly (ac635aa95 2016-11-18)*
6+
47
## 0.0.99 — 2016-11-18
58
* Update to rustc 1.15.0-nightly (0ed951993 2016-11-14)
69

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.99"
3+
version = "0.0.100"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -25,7 +25,7 @@ test = false
2525

2626
[dependencies]
2727
# begin automatic update
28-
clippy_lints = { version = "0.0.99", path = "clippy_lints" }
28+
clippy_lints = { version = "0.0.100", path = "clippy_lints" }
2929
# end automatic update
3030

3131
[dev-dependencies]

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.99"
4+
version = "0.0.100"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/len_zero.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[TraitItem]) {
9292
fn is_named_self(item: &TraitItem, name: &str) -> bool {
9393
item.name.as_str() == name &&
9494
if let MethodTraitItem(ref sig, _) = item.node {
95-
is_self_sig(sig)
95+
if sig.decl.has_self() {
96+
sig.decl.inputs.len() == 1
97+
} else {
98+
false
99+
}
96100
} else {
97101
false
98102
}
@@ -111,18 +115,22 @@ fn check_trait_items(cx: &LateContext, item: &Item, trait_items: &[TraitItem]) {
111115
}
112116
}
113117

114-
fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
115-
fn is_named_self(item: &ImplItem, name: &str) -> bool {
118+
fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItemRef]) {
119+
fn is_named_self(cx: &LateContext, item: &ImplItemRef, name: &str) -> bool {
116120
item.name.as_str() == name &&
117-
if let ImplItemKind::Method(ref sig, _) = item.node {
118-
is_self_sig(sig)
121+
if let AssociatedItemKind::Method { has_self } = item.kind {
122+
has_self && {
123+
let did = cx.tcx.map.local_def_id(item.id.node_id);
124+
let impl_ty = cx.tcx.item_type(did);
125+
impl_ty.fn_args().skip_binder().len() == 1
126+
}
119127
} else {
120128
false
121129
}
122130
}
123131

124-
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(i, "is_empty")) {
125-
if cx.access_levels.is_exported(is_empty.id) {
132+
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
133+
if cx.access_levels.is_exported(is_empty.id.node_id) {
126134
return;
127135
} else {
128136
"a private"
@@ -131,8 +139,8 @@ fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
131139
"no corresponding"
132140
};
133141

134-
if let Some(i) = impl_items.iter().find(|i| is_named_self(i, "len")) {
135-
if cx.access_levels.is_exported(i.id) {
142+
if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
143+
if cx.access_levels.is_exported(i.id.node_id) {
136144
let def_id = cx.tcx.map.local_def_id(item.id);
137145
let ty = cx.tcx.item_type(def_id);
138146

@@ -146,14 +154,6 @@ fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
146154
}
147155
}
148156

149-
fn is_self_sig(sig: &MethodSig) -> bool {
150-
if sig.decl.has_self() {
151-
sig.decl.inputs.len() == 1
152-
} else {
153-
false
154-
}
155-
}
156-
157157
fn check_cmp(cx: &LateContext, span: Span, left: &Expr, right: &Expr, op: &str) {
158158
// check if we are in an is_empty() method
159159
if let Some(name) = get_item_name(cx, left) {

0 commit comments

Comments
 (0)