diff --git a/CHANGELOG.md b/CHANGELOG.md index a4412292158..25949514b87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. -* New [`zero_ptr`] lint -* New [`never_loop`] lint -* New [`mut_from_ref`] lint +## 0.0.115 — 2017-02-27 +* Rustup to *rustc 1.17.0-nightly (60a0edc6c 2017-02-26)* +* New lints: [`zero_ptr`], [`never_loop`], [`mut_from_ref`] ## 0.0.114 — 2017-02-08 -* Rustup to rustc 1.17.0-nightly (c49d10207 2017-02-07) +* Rustup to *rustc 1.17.0-nightly (c49d10207 2017-02-07)* * Tests are now ui tests (testing the exact output of rustc) ## 0.0.113 — 2017-02-04 diff --git a/Cargo.toml b/Cargo.toml index a45a7edf0fe..5fe74d4f663 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.114" +version = "0.0.115" authors = [ "Manish Goregaokar ", "Andre Bogus ", @@ -30,7 +30,7 @@ test = false [dependencies] # begin automatic update -clippy_lints = { version = "0.0.114", path = "clippy_lints" } +clippy_lints = { version = "0.0.115", path = "clippy_lints" } # end automatic update cargo_metadata = "0.1.1" diff --git a/PUBLISH.md b/PUBLISH.md index 228e4b97f49..1ff3f2b4b73 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -1,8 +1,8 @@ Steps to publish a new clippy version - Bump `package.version` in `./Cargo.toml` (no need to manually bump `dependencies.clippy_lints.version`). -- Run `./pre_publish.sh` - Write a changelog entry. +- Run `./pre_publish.sh` - Review and commit all changed files - `git push` - Wait for Travis's approval. diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 1b3471ee093..7b545993b65 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.114" +version = "0.0.115" # end automatic update authors = [ "Manish Goregaokar ", diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 734f832d51e..dd9ec1f6e23 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1028,7 +1028,7 @@ fn extract_first_expr(block: &Block) -> Option<&Expr> { /// Return true if expr contains a single break expr (maybe within a block). fn is_break_expr(expr: &Expr) -> bool { match expr.node { - ExprBreak(None, _) => true, + ExprBreak(dest, _) if dest.ident.is_none() => true, ExprBlock(ref b) => { match extract_first_expr(b) { Some(subexpr) => is_break_expr(subexpr), diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index c74554d5083..e004b80323e 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -69,9 +69,11 @@ fn check_fn( impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr) { match expr.node { - hir::ExprBreak(Some(label), _) | - hir::ExprAgain(Some(label)) => { - self.labels.remove(&label.name.as_str()); + hir::ExprBreak(destination, _) | + hir::ExprAgain(destination) => { + if let Some(label) = destination.ident { + self.labels.remove(&label.node.name.as_str()); + } }, hir::ExprLoop(_, Some(label), _) | hir::ExprWhile(_, _, Some(label)) => { diff --git a/clippy_lints/src/utils/hir.rs b/clippy_lints/src/utils/hir.rs index 2c5c19b2185..00890c37a0a 100644 --- a/clippy_lints/src/utils/hir.rs +++ b/clippy_lints/src/utils/hir.rs @@ -68,7 +68,9 @@ pub fn eq_expr(&self, left: &Expr, right: &Expr) -> bool { match (&left.node, &right.node) { (&ExprAddrOf(l_mut, ref le), &ExprAddrOf(r_mut, ref re)) => l_mut == r_mut && self.eq_expr(le, re), - (&ExprAgain(li), &ExprAgain(ri)) => both(&li, &ri, |l, r| l.name.as_str() == r.name.as_str()), + (&ExprAgain(li), &ExprAgain(ri)) => { + both(&li.ident, &ri.ident, |l, r| l.node.name.as_str() == r.node.name.as_str()) + }, (&ExprAssign(ref ll, ref lr), &ExprAssign(ref rl, ref rr)) => self.eq_expr(ll, rl) && self.eq_expr(lr, rr), (&ExprAssignOp(ref lo, ref ll, ref lr), &ExprAssignOp(ref ro, ref rl, ref rr)) => { lo.node == ro.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr) @@ -81,7 +83,8 @@ pub fn eq_expr(&self, left: &Expr, right: &Expr) -> bool { }) }, (&ExprBreak(li, ref le), &ExprBreak(ri, ref re)) => { - both(&li, &ri, |l, r| l.name.as_str() == r.name.as_str()) && both(le, re, |l, r| self.eq_expr(l, r)) + both(&li.ident, &ri.ident, |l, r| l.node.name.as_str() == r.node.name.as_str()) && + both(le, re, |l, r| self.eq_expr(l, r)) }, (&ExprBox(ref l), &ExprBox(ref r)) => self.eq_expr(l, r), (&ExprCall(ref l_fun, ref l_args), &ExprCall(ref r_fun, ref r_args)) => { @@ -310,8 +313,8 @@ pub fn hash_expr(&mut self, e: &Expr) { ExprAgain(i) => { let c: fn(_) -> _ = ExprAgain; c.hash(&mut self.s); - if let Some(i) = i { - self.hash_name(&i.name); + if let Some(i) = i.ident { + self.hash_name(&i.node.name); } }, ExprAssign(ref l, ref r) => { @@ -342,8 +345,8 @@ pub fn hash_expr(&mut self, e: &Expr) { ExprBreak(i, ref j) => { let c: fn(_, _) -> _ = ExprBreak; c.hash(&mut self.s); - if let Some(i) = i { - self.hash_name(&i.name); + if let Some(i) = i.ident { + self.hash_name(&i.node.name); } if let Some(ref j) = *j { self.hash_expr(&*j); diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 25b3ad3bfb9..2dae1cf1723 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -900,7 +900,7 @@ pub fn opt_def_id(def: Def) -> Option { Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | - Def::Macro(id) => Some(id), + Def::Macro(id, _) => Some(id), Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None, }