Skip to content

Commit 276e85b

Browse files
authored
Merge pull request #1344 from Manishearth/rustup
[WIP] Rustup to rustc 1.15.0-nightly (0ed9519 2016-11-14)
2 parents bad26a5 + 1176242 commit 276e85b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+271
-255
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.99 — 2016-11-18
5+
* Update to rustc 1.15.0-nightly (0ed951993 2016-11-14)
6+
47
## 0.0.98 — 2016-11-08
58
* Fixes a an issue due to a change in how cargo handles `--sysroot`, which broke `cargo clippy`
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.98"
3+
version = "0.0.99"
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.98", path = "clippy_lints" }
28+
clippy_lints = { version = "0.0.99", 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.98"
4+
version = "0.0.99"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/arithmetic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl LateLintPass for Arithmetic {
5959
hir::BiShr | hir::BiEq | hir::BiLt | hir::BiLe | hir::BiNe | hir::BiGe | hir::BiGt => return,
6060
_ => (),
6161
}
62-
let (l_ty, r_ty) = (cx.tcx.expr_ty(l), cx.tcx.expr_ty(r));
62+
let (l_ty, r_ty) = (cx.tcx.tables().expr_ty(l), cx.tcx.tables().expr_ty(r));
6363
if l_ty.is_integral() && r_ty.is_integral() {
6464
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
6565
self.span = Some(expr.span);
@@ -69,7 +69,7 @@ impl LateLintPass for Arithmetic {
6969
}
7070
}
7171
hir::ExprUnary(hir::UnOp::UnNeg, ref arg) => {
72-
let ty = cx.tcx.expr_ty(arg);
72+
let ty = cx.tcx.tables().expr_ty(arg);
7373
if ty.is_integral() {
7474
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
7575
self.span = Some(expr.span);

clippy_lints/src/array_indexing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl LateLintPass for ArrayIndexing {
5959
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
6060
if let hir::ExprIndex(ref array, ref index) = e.node {
6161
// Array with known size can be checked statically
62-
let ty = cx.tcx.expr_ty(array);
62+
let ty = cx.tcx.tables().expr_ty(array);
6363
if let ty::TyArray(_, size) = ty.sty {
6464
let size = ConstInt::Infer(size as u64);
6565

clippy_lints/src/assign_ops.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ impl LateLintPass for AssignOps {
8181
if let hir::ExprBinary(binop, ref l, ref r) = rhs.node {
8282
if op.node == binop.node {
8383
let lint = |assignee: &hir::Expr, rhs: &hir::Expr| {
84-
let ty = cx.tcx.expr_ty(assignee);
84+
let ty = cx.tcx.tables().expr_ty(assignee);
8585
if ty.walk_shallow().next().is_some() {
8686
return; // implements_trait does not work with generics
8787
}
88-
let rty = cx.tcx.expr_ty(rhs);
88+
let rty = cx.tcx.tables().expr_ty(rhs);
8989
if rty.walk_shallow().next().is_some() {
9090
return; // implements_trait does not work with generics
9191
}
@@ -116,11 +116,11 @@ impl LateLintPass for AssignOps {
116116
hir::ExprAssign(ref assignee, ref e) => {
117117
if let hir::ExprBinary(op, ref l, ref r) = e.node {
118118
let lint = |assignee: &hir::Expr, rhs: &hir::Expr| {
119-
let ty = cx.tcx.expr_ty(assignee);
119+
let ty = cx.tcx.tables().expr_ty(assignee);
120120
if ty.walk_shallow().next().is_some() {
121121
return; // implements_trait does not work with generics
122122
}
123-
let rty = cx.tcx.expr_ty(rhs);
123+
let rty = cx.tcx.tables().expr_ty(rhs);
124124
if rty.walk_shallow().next().is_some() {
125125
return; // implements_trait does not work with generics
126126
}

clippy_lints/src/attrs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,24 @@ impl LateLintPass for AttrPass {
152152
}
153153

154154
fn is_relevant_item(cx: &LateContext, item: &Item) -> bool {
155-
if let ItemFn(_, _, _, _, _, ref block) = item.node {
156-
is_relevant_block(cx, block)
155+
if let ItemFn(_, _, _, _, _, ref expr) = item.node {
156+
is_relevant_expr(cx, expr)
157157
} else {
158158
false
159159
}
160160
}
161161

162162
fn is_relevant_impl(cx: &LateContext, item: &ImplItem) -> bool {
163163
match item.node {
164-
ImplItemKind::Method(_, ref block) => is_relevant_block(cx, block),
164+
ImplItemKind::Method(_, ref expr) => is_relevant_expr(cx, expr),
165165
_ => false,
166166
}
167167
}
168168

169169
fn is_relevant_trait(cx: &LateContext, item: &TraitItem) -> bool {
170170
match item.node {
171171
MethodTraitItem(_, None) => true,
172-
MethodTraitItem(_, Some(ref block)) => is_relevant_block(cx, block),
172+
MethodTraitItem(_, Some(ref expr)) => is_relevant_expr(cx, expr),
173173
_ => false,
174174
}
175175
}

clippy_lints/src/block_in_if_condition.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,8 @@ struct ExVisitor<'v> {
5555

5656
impl<'v> Visitor<'v> for ExVisitor<'v> {
5757
fn visit_expr(&mut self, expr: &'v Expr) {
58-
if let ExprClosure(_, _, ref block, _) = expr.node {
59-
let complex = {
60-
if block.stmts.is_empty() {
61-
if let Some(ref ex) = block.expr {
62-
matches!(ex.node, ExprBlock(_))
63-
} else {
64-
false
65-
}
66-
} else {
67-
true
68-
}
69-
};
70-
if complex {
58+
if let ExprClosure(_, _, ref expr, _) = expr.node {
59+
if matches!(expr.node, ExprBlock(_)) {
7160
self.found_block = Some(expr);
7261
return;
7362
}
@@ -119,7 +108,7 @@ impl LateLintPass for BlockInIfCondition {
119108
let mut visitor = ExVisitor { found_block: None };
120109
walk_expr(&mut visitor, check);
121110
if let Some(block) = visitor.found_block {
122-
span_help_and_lint(cx, BLOCK_IN_IF_CONDITION_STMT, block.span, COMPLEX_BLOCK_MESSAGE, "");
111+
span_lint(cx, BLOCK_IN_IF_CONDITION_STMT, block.span, COMPLEX_BLOCK_MESSAGE);
123112
}
124113
}
125114
}

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for NonminimalBoolVisitor<'a, 'tcx> {
392392
match e.node {
393393
ExprBinary(binop, _, _) if binop.node == BiOr || binop.node == BiAnd => self.bool_expr(e),
394394
ExprUnary(UnNot, ref inner) => {
395-
if self.0.tcx.node_types()[&inner.id].is_bool() {
395+
if self.0.tcx.tables.borrow().node_types[&inner.id].is_bool() {
396396
self.bool_expr(e);
397397
} else {
398398
walk_expr(self, e);

clippy_lints/src/copies.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ impl LateLintPass for CopyAndPaste {
120120
}
121121

122122
let (conds, blocks) = if_sequence(expr);
123-
lint_same_then_else(cx, blocks.as_slice());
124-
lint_same_cond(cx, conds.as_slice());
123+
lint_same_then_else(cx, &blocks);
124+
lint_same_cond(cx, &conds);
125125
lint_match_arms(cx, expr);
126126
}
127127
}
@@ -219,8 +219,8 @@ fn lint_match_arms(cx: &LateContext, expr: &Expr) {
219219
/// Eg. would return `([a, b], [c, d, e])` for the expression
220220
/// `if a { c } else if b { d } else { e }`.
221221
fn if_sequence(mut expr: &Expr) -> (SmallVector<&Expr>, SmallVector<&Block>) {
222-
let mut conds = SmallVector::zero();
223-
let mut blocks = SmallVector::zero();
222+
let mut conds = SmallVector::new();
223+
let mut blocks = SmallVector::new();
224224

225225
while let ExprIf(ref cond, ref then_block, ref else_expr) = expr.node {
226226
conds.push(&**cond);
@@ -256,7 +256,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
256256
}
257257
PatKind::Binding(_, ref ident, ref as_pat) => {
258258
if let Entry::Vacant(v) = map.entry(ident.node.as_str()) {
259-
v.insert(cx.tcx.pat_ty(pat));
259+
v.insert(cx.tcx.tables().pat_ty(pat));
260260
}
261261
if let Some(ref as_pat) = *as_pat {
262262
bindings_impl(cx, as_pat, map);

0 commit comments

Comments
 (0)