Merge branch 'master' into 1537-drop_copy
This commit is contained in:
commit
d53b878af6
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.114"
|
||||
version = "0.0.115"
|
||||
authors = [
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
"Andre Bogus <bogusandre@gmail.com>",
|
||||
@ -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"
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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 <manishsmail@gmail.com>",
|
||||
|
@ -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),
|
||||
|
@ -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)) => {
|
||||
|
@ -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);
|
||||
|
@ -900,7 +900,7 @@ pub fn opt_def_id(def: Def) -> Option<DefId> {
|
||||
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,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user