Skip to content

Commit defa497

Browse files
authored
Merge pull request #1221 from Manishearth/rustup
Rustup *1.13.0-nightly (f1f40f8 2016-09-09)* and bump to 0.0.90
2 parents 7e12546 + 7279dc3 commit defa497

File tree

12 files changed

+24
-25
lines changed

12 files changed

+24
-25
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.90 — 2016-09-09
5+
* Rustup to *rustc 1.13.0-dev (f1f40f850 2016-09-09)*
6+
47
## 0.0.89 — 2016-09-06
58
* Rustup to *rustc 1.13.0-nightly (cbe4de78e 2016-09-05)*
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.89"
3+
version = "0.0.90"
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.89", path = "clippy_lints" }
28+
clippy_lints = { version = "0.0.90", 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.89"
4+
version = "0.0.90"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/derive.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
141141
}
142142

143143
match ty.sty {
144-
TypeVariants::TyUnion(..) => return,
144+
TypeVariants::TyAdt(def, _) if def.is_union() => return,
145145

146146
// Some types are not Clone by default but could be cloned “by hand” if necessary
147-
TypeVariants::TyEnum(def, substs) |
148-
TypeVariants::TyStruct(def, substs) => {
147+
TypeVariants::TyAdt(def, substs) => {
149148
for variant in &def.variants {
150149
for field in &variant.fields {
151150
match field.ty(cx.tcx, substs).sty {

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
214214
.map_or(false, |ids| ids.iter().any(|i| is_is_empty(cx, i)))
215215
}
216216
ty::TyProjection(_) => ty.ty_to_def_id().map_or(false, |id| has_is_empty_impl(cx, &id)),
217-
ty::TyEnum(id, _) |
218-
ty::TyStruct(id, _) |
219-
ty::TyUnion(id, _) => has_is_empty_impl(cx, &id.did),
217+
ty::TyAdt(id, _) => has_is_empty_impl(cx, &id.did),
220218
ty::TyArray(..) | ty::TyStr => true,
221219
_ => false,
222220
}

clippy_lints/src/methods.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ fn derefs_to_slice(cx: &LateContext, expr: &hir::Expr, ty: ty::Ty) -> Option<sug
796796
fn may_slice(cx: &LateContext, ty: ty::Ty) -> bool {
797797
match ty.sty {
798798
ty::TySlice(_) => true,
799-
ty::TyStruct(..) => match_type(cx, ty, &paths::VEC),
799+
ty::TyAdt(..) => match_type(cx, ty, &paths::VEC),
800800
ty::TyArray(_, size) => size < 32,
801801
ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) |
802802
ty::TyBox(inner) => may_slice(cx, inner),
@@ -1081,12 +1081,12 @@ fn lint_single_char_pattern(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr)
10811081

10821082
/// Given a `Result<T, E>` type, return its error type (`E`).
10831083
fn get_error_type<'a>(cx: &LateContext, ty: ty::Ty<'a>) -> Option<ty::Ty<'a>> {
1084-
if !match_type(cx, ty, &paths::RESULT) {
1085-
return None;
1086-
}
1087-
1088-
if let ty::TyEnum(_, substs) = ty.sty {
1089-
substs.types().nth(1)
1084+
if let ty::TyAdt(_, substs) = ty.sty {
1085+
if match_type(cx, ty, &paths::RESULT) {
1086+
substs.types().nth(1)
1087+
} else {
1088+
None
1089+
}
10901090
} else {
10911091
None
10921092
}

clippy_lints/src/mutex_atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct MutexAtomic;
5757
impl LateLintPass for MutexAtomic {
5858
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
5959
let ty = cx.tcx.expr_ty(expr);
60-
if let ty::TyStruct(_, subst) = ty.sty {
60+
if let ty::TyAdt(_, subst) = ty.sty {
6161
if match_type(cx, ty, &paths::MUTEX) {
6262
let mutex_param = &subst.type_at(0).sty;
6363
if let Some(atomic_name) = get_atomic_name(mutex_param) {

clippy_lints/src/needless_update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
2-
use rustc::ty::TyStruct;
2+
use rustc::ty::TyAdt;
33
use rustc::hir::{Expr, ExprStruct};
44
use utils::span_lint;
55

@@ -34,7 +34,7 @@ impl LateLintPass for Pass {
3434
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
3535
if let ExprStruct(_, ref fields, Some(ref base)) = expr.node {
3636
let ty = cx.tcx.expr_ty(expr);
37-
if let TyStruct(def, _) = ty.sty {
37+
if let TyAdt(def, _) = ty.sty {
3838
if fields.len() == def.struct_variant().fields.len() {
3939
span_lint(cx,
4040
NEEDLESS_UPDATE,

clippy_lints/src/new_without_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl LateLintPass for NewWithoutDefault {
146146

147147
fn can_derive_default<'t, 'c>(ty: ty::Ty<'t>, cx: &LateContext<'c, 't>, default_trait_id: DefId) -> bool {
148148
match ty.sty {
149-
ty::TyStruct(adt_def, substs) => {
149+
ty::TyAdt(adt_def, substs) if adt_def.is_struct() => {
150150
for field in adt_def.all_fields() {
151151
let f_ty = field.ty(cx.tcx, substs);
152152
if !implements_trait(cx, f_ty, default_trait_id, Vec::new()) {

clippy_lints/src/utils/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,10 @@ pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool {
152152
apb.names == path
153153
}
154154

155-
/// Check if type is struct or enum type with given def path.
155+
/// Check if type is struct, enum or union type with given def path.
156156
pub fn match_type(cx: &LateContext, ty: ty::Ty, path: &[&str]) -> bool {
157157
match ty.sty {
158-
ty::TyEnum(adt, _) |
159-
ty::TyStruct(adt, _) => match_def_path(cx, adt.did, path),
158+
ty::TyAdt(adt, _) => match_def_path(cx, adt.did, path),
160159
_ => false,
161160
}
162161
}

0 commit comments

Comments
 (0)