mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Rustup (fixes #2002)
This commit is contained in:
parent
c99b67c619
commit
9d6c0feef2
@ -1,6 +1,9 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## 0.0.155
|
||||
* Update to *rustc 1.21.0-nightly (c11f689d2 2017-08-29)*
|
||||
* New lint: [`infinite_iter`], [`maybe_infinite_iter`], [`cast_lossless`]
|
||||
|
||||
## 0.0.154
|
||||
* Update to *rustc 1.21.0-nightly (2c0558f63 2017-08-24)*
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.154"
|
||||
version = "0.0.155"
|
||||
authors = [
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
"Andre Bogus <bogusandre@gmail.com>",
|
||||
@ -31,7 +31,7 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# begin automatic update
|
||||
clippy_lints = { version = "0.0.154", path = "clippy_lints" }
|
||||
clippy_lints = { version = "0.0.155", path = "clippy_lints" }
|
||||
# end automatic update
|
||||
cargo_metadata = "0.2"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "clippy_lints"
|
||||
# begin automatic update
|
||||
version = "0.0.154"
|
||||
version = "0.0.155"
|
||||
# end automatic update
|
||||
authors = [
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
|
@ -56,7 +56,7 @@ struct ExVisitor<'a, 'tcx: 'a> {
|
||||
|
||||
impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr) {
|
||||
if let ExprClosure(_, _, eid, _) = expr.node {
|
||||
if let ExprClosure(_, _, eid, _, _) = expr.node {
|
||||
let body = self.cx.tcx.hir.body(eid);
|
||||
let ex = &body.value;
|
||||
if matches!(ex.node, ExprBlock(_)) {
|
||||
|
@ -43,7 +43,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
|
||||
let ExprMethodCall(ref filter, _, ref filter_args) = count_args[0].node,
|
||||
filter.name == "filter",
|
||||
filter_args.len() == 2,
|
||||
let ExprClosure(_, _, body_id, _) = filter_args[1].node,
|
||||
let ExprClosure(_, _, body_id, _, _) = filter_args[1].node,
|
||||
], {
|
||||
let body = cx.tcx.hir.body(body_id);
|
||||
if_let_chain!([
|
||||
|
@ -171,7 +171,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
|
||||
_ => (),
|
||||
}
|
||||
},
|
||||
ExprClosure(..) => (),
|
||||
ExprClosure(.., _) => (),
|
||||
ExprBinary(op, _, _) => {
|
||||
walk_expr(self, e);
|
||||
match op.node {
|
||||
|
@ -49,7 +49,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
|
||||
}
|
||||
|
||||
fn check_closure(cx: &LateContext, expr: &Expr) {
|
||||
if let ExprClosure(_, ref decl, eid, _) = expr.node {
|
||||
if let ExprClosure(_, ref decl, eid, _, _) = expr.node {
|
||||
let body = cx.tcx.hir.body(eid);
|
||||
let ex = &body.value;
|
||||
if let ExprCall(ref caller, ref args) = ex.node {
|
||||
|
@ -104,7 +104,7 @@ struct DivergenceVisitor<'a, 'tcx: 'a> {
|
||||
impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
|
||||
fn maybe_walk_expr(&mut self, e: &'tcx Expr) {
|
||||
match e.node {
|
||||
ExprClosure(..) => {},
|
||||
ExprClosure(.., _) => {},
|
||||
ExprMatch(ref e, ref arms, _) => {
|
||||
self.visit_expr(e);
|
||||
for arm in arms {
|
||||
@ -239,7 +239,7 @@ fn check_expr<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) -> St
|
||||
walk_expr(vis, expr);
|
||||
}
|
||||
},
|
||||
ExprClosure(_, _, _, _) => {
|
||||
ExprClosure(_, _, _, _, _) => {
|
||||
// Either
|
||||
//
|
||||
// * `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> {
|
||||
// We're about to descend a closure. Since we don't know when (or
|
||||
// if) the closure will be evaluated, any reads in it might not
|
||||
// occur here (or ever). Like above, bail to avoid false positives.
|
||||
ExprClosure(_, _, _, _) |
|
||||
ExprClosure(_, _, _, _, _) |
|
||||
|
||||
// We want to avoid a false positive when a variable name occurs
|
||||
// only to have its address taken, so we stop here. Technically,
|
||||
|
@ -148,7 +148,7 @@ fn is_infinite(cx: &LateContext, expr: &Expr) -> Finiteness {
|
||||
}
|
||||
}
|
||||
if method.name == "flat_map" && args.len() == 2 {
|
||||
if let ExprClosure(_, _, body_id, _) = args[1].node {
|
||||
if let ExprClosure(_, _, body_id, _, _) = args[1].node {
|
||||
let body = cx.tcx.hir.body(body_id);
|
||||
return is_infinite(cx, &body.value);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
if let ExprMethodCall(ref method, _, ref args) = expr.node {
|
||||
if method.name == "map" && args.len() == 2 {
|
||||
match args[1].node {
|
||||
ExprClosure(_, ref decl, closure_eid, _) => {
|
||||
ExprClosure(_, ref decl, closure_eid, _, _) => {
|
||||
let body = cx.tcx.hir.body(closure_eid);
|
||||
let closure_expr = remove_blocks(&body.value);
|
||||
let ty = cx.tables.pat_ty(&body.arguments[0].pat);
|
||||
|
@ -46,7 +46,7 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
|
||||
}
|
||||
match expr.node {
|
||||
Expr_::ExprLit(..) |
|
||||
Expr_::ExprClosure(..) |
|
||||
Expr_::ExprClosure(.., _) |
|
||||
Expr_::ExprPath(..) => true,
|
||||
Expr_::ExprIndex(ref a, ref b) |
|
||||
Expr_::ExprBinary(_, ref a, ref b) => has_no_effect(cx, a) && has_no_effect(cx, b),
|
||||
|
@ -296,10 +296,16 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
|
||||
println!("Match(ref expr, ref arms, ref desugaring) = {},", current);
|
||||
println!(" // unimplemented: `ExprMatch` is not further destructured at the moment");
|
||||
},
|
||||
Expr_::ExprClosure(ref _capture_clause, ref _func, _, _) => {
|
||||
println!("Closure(ref capture_clause, ref func, _, _) = {},", current);
|
||||
Expr_::ExprClosure(ref _capture_clause, ref _func, _, _, _) => {
|
||||
println!("Closure(ref capture_clause, ref func, _, _, _) = {},", current);
|
||||
println!(" // unimplemented: `ExprClosure` is not further destructured at the moment");
|
||||
},
|
||||
Expr_::ExprYield(ref sub) => {
|
||||
let sub_pat = self.next("sub");
|
||||
println!("Yield(ref sub) = {},", current);
|
||||
self.current = sub_pat;
|
||||
self.visit_expr(sub);
|
||||
},
|
||||
Expr_::ExprBlock(ref block) => {
|
||||
let block_pat = self.next("block");
|
||||
println!("Block(ref {}) = {},", block_pat, current);
|
||||
|
@ -321,6 +321,11 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
||||
self.hash_name(&i.node.name);
|
||||
}
|
||||
},
|
||||
ExprYield(ref e) => {
|
||||
let c: fn(_) -> _ = ExprYield;
|
||||
c.hash(&mut self.s);
|
||||
self.hash_expr(e);
|
||||
},
|
||||
ExprAssign(ref l, ref r) => {
|
||||
let c: fn(_, _) -> _ = ExprAssign;
|
||||
c.hash(&mut self.s);
|
||||
@ -373,8 +378,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
||||
self.hash_expr(e);
|
||||
// TODO: _ty
|
||||
},
|
||||
ExprClosure(cap, _, eid, _) => {
|
||||
let c: fn(_, _, _, _) -> _ = ExprClosure;
|
||||
ExprClosure(cap, _, eid, _, _) => {
|
||||
let c: fn(_, _, _, _, _) -> _ = ExprClosure;
|
||||
c.hash(&mut self.s);
|
||||
cap.hash(&mut self.s);
|
||||
self.hash_expr(&self.cx.tcx.hir.body(eid).value);
|
||||
|
@ -245,10 +245,14 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
|
||||
print_expr(cx, cond, indent + 1);
|
||||
println!("{}source: {:?}", ind, source);
|
||||
},
|
||||
hir::ExprClosure(ref clause, _, _, _) => {
|
||||
hir::ExprClosure(ref clause, _, _, _, _) => {
|
||||
println!("{}Closure", ind);
|
||||
println!("{}clause: {:?}", ind, clause);
|
||||
},
|
||||
hir::ExprYield(ref sub) => {
|
||||
println!("{}Yield", ind);
|
||||
print_expr(cx, sub, indent + 1);
|
||||
}
|
||||
hir::ExprBlock(_) => {
|
||||
println!("{}Block", ind);
|
||||
},
|
||||
|
@ -104,6 +104,7 @@ pub fn differing_macro_contexts(lhs: Span, rhs: Span) -> bool {
|
||||
pub fn in_constant(cx: &LateContext, id: NodeId) -> bool {
|
||||
let parent_id = cx.tcx.hir.get_parent(id);
|
||||
match MirSource::from_node(cx.tcx, parent_id) {
|
||||
MirSource::GeneratorDrop(_) |
|
||||
MirSource::Fn(_) => false,
|
||||
MirSource::Const(_) |
|
||||
MirSource::Static(..) |
|
||||
|
@ -49,11 +49,12 @@ impl<'a> Sugg<'a> {
|
||||
match expr.node {
|
||||
hir::ExprAddrOf(..) |
|
||||
hir::ExprBox(..) |
|
||||
hir::ExprClosure(..) |
|
||||
hir::ExprClosure(.., _) |
|
||||
hir::ExprIf(..) |
|
||||
hir::ExprUnary(..) |
|
||||
hir::ExprMatch(..) => Sugg::MaybeParen(snippet),
|
||||
hir::ExprAgain(..) |
|
||||
hir::ExprYield(..) |
|
||||
hir::ExprArray(..) |
|
||||
hir::ExprBlock(..) |
|
||||
hir::ExprBreak(..) |
|
||||
@ -106,6 +107,7 @@ impl<'a> Sugg<'a> {
|
||||
ast::ExprKind::Call(..) |
|
||||
ast::ExprKind::Catch(..) |
|
||||
ast::ExprKind::Continue(..) |
|
||||
ast::ExprKind::Yield(..) |
|
||||
ast::ExprKind::Field(..) |
|
||||
ast::ExprKind::ForLoop(..) |
|
||||
ast::ExprKind::Index(..) |
|
||||
|
Loading…
Reference in New Issue
Block a user