Skip to content

Commit 9d6c0fe

Browse files
committed
Rustup (fixes #2002)
1 parent c99b67c commit 9d6c0fe

16 files changed

+40
-19
lines changed

CHANGELOG.md

+3
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.155
5+
* Update to *rustc 1.21.0-nightly (c11f689d2 2017-08-29)*
6+
* New lint: [`infinite_iter`], [`maybe_infinite_iter`], [`cast_lossless`]
47

58
## 0.0.154
69
* Update to *rustc 1.21.0-nightly (2c0558f63 2017-08-24)*

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.154"
3+
version = "0.0.155"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -31,7 +31,7 @@ path = "src/main.rs"
3131

3232
[dependencies]
3333
# begin automatic update
34-
clippy_lints = { version = "0.0.154", path = "clippy_lints" }
34+
clippy_lints = { version = "0.0.155", path = "clippy_lints" }
3535
# end automatic update
3636
cargo_metadata = "0.2"
3737

clippy_lints/Cargo.toml

+1-1
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.154"
4+
version = "0.0.155"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/block_in_if_condition.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct ExVisitor<'a, 'tcx: 'a> {
5656

5757
impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
5858
fn visit_expr(&mut self, expr: &'tcx Expr) {
59-
if let ExprClosure(_, _, eid, _) = expr.node {
59+
if let ExprClosure(_, _, eid, _, _) = expr.node {
6060
let body = self.cx.tcx.hir.body(eid);
6161
let ex = &body.value;
6262
if matches!(ex.node, ExprBlock(_)) {

clippy_lints/src/bytecount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
4343
let ExprMethodCall(ref filter, _, ref filter_args) = count_args[0].node,
4444
filter.name == "filter",
4545
filter_args.len() == 2,
46-
let ExprClosure(_, _, body_id, _) = filter_args[1].node,
46+
let ExprClosure(_, _, body_id, _, _) = filter_args[1].node,
4747
], {
4848
let body = cx.tcx.hir.body(body_id);
4949
if_let_chain!([

clippy_lints/src/cyclomatic_complexity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
171171
_ => (),
172172
}
173173
},
174-
ExprClosure(..) => (),
174+
ExprClosure(.., _) => (),
175175
ExprBinary(op, _, _) => {
176176
walk_expr(self, e);
177177
match op.node {

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
4949
}
5050

5151
fn check_closure(cx: &LateContext, expr: &Expr) {
52-
if let ExprClosure(_, ref decl, eid, _) = expr.node {
52+
if let ExprClosure(_, ref decl, eid, _, _) = expr.node {
5353
let body = cx.tcx.hir.body(eid);
5454
let ex = &body.value;
5555
if let ExprCall(ref caller, ref args) = ex.node {

clippy_lints/src/eval_order_dependence.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct DivergenceVisitor<'a, 'tcx: 'a> {
104104
impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
105105
fn maybe_walk_expr(&mut self, e: &'tcx Expr) {
106106
match e.node {
107-
ExprClosure(..) => {},
107+
ExprClosure(.., _) => {},
108108
ExprMatch(ref e, ref arms, _) => {
109109
self.visit_expr(e);
110110
for arm in arms {
@@ -239,7 +239,7 @@ fn check_expr<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) -> St
239239
walk_expr(vis, expr);
240240
}
241241
},
242-
ExprClosure(_, _, _, _) => {
242+
ExprClosure(_, _, _, _, _) => {
243243
// Either
244244
//
245245
// * `var` is defined in the closure body, in which case we've
@@ -323,7 +323,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
323323
// We're about to descend a closure. Since we don't know when (or
324324
// if) the closure will be evaluated, any reads in it might not
325325
// occur here (or ever). Like above, bail to avoid false positives.
326-
ExprClosure(_, _, _, _) |
326+
ExprClosure(_, _, _, _, _) |
327327

328328
// We want to avoid a false positive when a variable name occurs
329329
// only to have its address taken, so we stop here. Technically,

clippy_lints/src/infinite_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn is_infinite(cx: &LateContext, expr: &Expr) -> Finiteness {
148148
}
149149
}
150150
if method.name == "flat_map" && args.len() == 2 {
151-
if let ExprClosure(_, _, body_id, _) = args[1].node {
151+
if let ExprClosure(_, _, body_id, _, _) = args[1].node {
152152
let body = cx.tcx.hir.body(body_id);
153153
return is_infinite(cx, &body.value);
154154
}

clippy_lints/src/map_clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
3131
if let ExprMethodCall(ref method, _, ref args) = expr.node {
3232
if method.name == "map" && args.len() == 2 {
3333
match args[1].node {
34-
ExprClosure(_, ref decl, closure_eid, _) => {
34+
ExprClosure(_, ref decl, closure_eid, _, _) => {
3535
let body = cx.tcx.hir.body(closure_eid);
3636
let closure_expr = remove_blocks(&body.value);
3737
let ty = cx.tables.pat_ty(&body.arguments[0].pat);

clippy_lints/src/no_effect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
4646
}
4747
match expr.node {
4848
Expr_::ExprLit(..) |
49-
Expr_::ExprClosure(..) |
49+
Expr_::ExprClosure(.., _) |
5050
Expr_::ExprPath(..) => true,
5151
Expr_::ExprIndex(ref a, ref b) |
5252
Expr_::ExprBinary(_, ref a, ref b) => has_no_effect(cx, a) && has_no_effect(cx, b),

clippy_lints/src/utils/author.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,16 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
296296
println!("Match(ref expr, ref arms, ref desugaring) = {},", current);
297297
println!(" // unimplemented: `ExprMatch` is not further destructured at the moment");
298298
},
299-
Expr_::ExprClosure(ref _capture_clause, ref _func, _, _) => {
300-
println!("Closure(ref capture_clause, ref func, _, _) = {},", current);
299+
Expr_::ExprClosure(ref _capture_clause, ref _func, _, _, _) => {
300+
println!("Closure(ref capture_clause, ref func, _, _, _) = {},", current);
301301
println!(" // unimplemented: `ExprClosure` is not further destructured at the moment");
302302
},
303+
Expr_::ExprYield(ref sub) => {
304+
let sub_pat = self.next("sub");
305+
println!("Yield(ref sub) = {},", current);
306+
self.current = sub_pat;
307+
self.visit_expr(sub);
308+
},
303309
Expr_::ExprBlock(ref block) => {
304310
let block_pat = self.next("block");
305311
println!("Block(ref {}) = {},", block_pat, current);

clippy_lints/src/utils/hir_utils.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
321321
self.hash_name(&i.node.name);
322322
}
323323
},
324+
ExprYield(ref e) => {
325+
let c: fn(_) -> _ = ExprYield;
326+
c.hash(&mut self.s);
327+
self.hash_expr(e);
328+
},
324329
ExprAssign(ref l, ref r) => {
325330
let c: fn(_, _) -> _ = ExprAssign;
326331
c.hash(&mut self.s);
@@ -373,8 +378,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
373378
self.hash_expr(e);
374379
// TODO: _ty
375380
},
376-
ExprClosure(cap, _, eid, _) => {
377-
let c: fn(_, _, _, _) -> _ = ExprClosure;
381+
ExprClosure(cap, _, eid, _, _) => {
382+
let c: fn(_, _, _, _, _) -> _ = ExprClosure;
378383
c.hash(&mut self.s);
379384
cap.hash(&mut self.s);
380385
self.hash_expr(&self.cx.tcx.hir.body(eid).value);

clippy_lints/src/utils/inspector.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,14 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
245245
print_expr(cx, cond, indent + 1);
246246
println!("{}source: {:?}", ind, source);
247247
},
248-
hir::ExprClosure(ref clause, _, _, _) => {
248+
hir::ExprClosure(ref clause, _, _, _, _) => {
249249
println!("{}Closure", ind);
250250
println!("{}clause: {:?}", ind, clause);
251251
},
252+
hir::ExprYield(ref sub) => {
253+
println!("{}Yield", ind);
254+
print_expr(cx, sub, indent + 1);
255+
}
252256
hir::ExprBlock(_) => {
253257
println!("{}Block", ind);
254258
},

clippy_lints/src/utils/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub fn differing_macro_contexts(lhs: Span, rhs: Span) -> bool {
104104
pub fn in_constant(cx: &LateContext, id: NodeId) -> bool {
105105
let parent_id = cx.tcx.hir.get_parent(id);
106106
match MirSource::from_node(cx.tcx, parent_id) {
107+
MirSource::GeneratorDrop(_) |
107108
MirSource::Fn(_) => false,
108109
MirSource::Const(_) |
109110
MirSource::Static(..) |

clippy_lints/src/utils/sugg.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ impl<'a> Sugg<'a> {
4949
match expr.node {
5050
hir::ExprAddrOf(..) |
5151
hir::ExprBox(..) |
52-
hir::ExprClosure(..) |
52+
hir::ExprClosure(.., _) |
5353
hir::ExprIf(..) |
5454
hir::ExprUnary(..) |
5555
hir::ExprMatch(..) => Sugg::MaybeParen(snippet),
5656
hir::ExprAgain(..) |
57+
hir::ExprYield(..) |
5758
hir::ExprArray(..) |
5859
hir::ExprBlock(..) |
5960
hir::ExprBreak(..) |
@@ -106,6 +107,7 @@ impl<'a> Sugg<'a> {
106107
ast::ExprKind::Call(..) |
107108
ast::ExprKind::Catch(..) |
108109
ast::ExprKind::Continue(..) |
110+
ast::ExprKind::Yield(..) |
109111
ast::ExprKind::Field(..) |
110112
ast::ExprKind::ForLoop(..) |
111113
ast::ExprKind::Index(..) |

0 commit comments

Comments
 (0)