mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Merge branch 'master' into 1537-drop_copy
This commit is contained in:
commit
d53b878af6
8 changed files with 24 additions and 19 deletions
|
@ -1,12 +1,12 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
* New [`zero_ptr`] lint
|
## 0.0.115 — 2017-02-27
|
||||||
* New [`never_loop`] lint
|
* Rustup to *rustc 1.17.0-nightly (60a0edc6c 2017-02-26)*
|
||||||
* New [`mut_from_ref`] lint
|
* New lints: [`zero_ptr`], [`never_loop`], [`mut_from_ref`]
|
||||||
|
|
||||||
## 0.0.114 — 2017-02-08
|
## 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)
|
* Tests are now ui tests (testing the exact output of rustc)
|
||||||
|
|
||||||
## 0.0.113 — 2017-02-04
|
## 0.0.113 — 2017-02-04
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.0.114"
|
version = "0.0.115"
|
||||||
authors = [
|
authors = [
|
||||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||||
"Andre Bogus <bogusandre@gmail.com>",
|
"Andre Bogus <bogusandre@gmail.com>",
|
||||||
|
@ -30,7 +30,7 @@ test = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# begin automatic update
|
# begin automatic update
|
||||||
clippy_lints = { version = "0.0.114", path = "clippy_lints" }
|
clippy_lints = { version = "0.0.115", path = "clippy_lints" }
|
||||||
# end automatic update
|
# end automatic update
|
||||||
cargo_metadata = "0.1.1"
|
cargo_metadata = "0.1.1"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Steps to publish a new clippy version
|
Steps to publish a new clippy version
|
||||||
|
|
||||||
- Bump `package.version` in `./Cargo.toml` (no need to manually bump `dependencies.clippy_lints.version`).
|
- Bump `package.version` in `./Cargo.toml` (no need to manually bump `dependencies.clippy_lints.version`).
|
||||||
- Run `./pre_publish.sh`
|
|
||||||
- Write a changelog entry.
|
- Write a changelog entry.
|
||||||
|
- Run `./pre_publish.sh`
|
||||||
- Review and commit all changed files
|
- Review and commit all changed files
|
||||||
- `git push`
|
- `git push`
|
||||||
- Wait for Travis's approval.
|
- Wait for Travis's approval.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy_lints"
|
name = "clippy_lints"
|
||||||
# begin automatic update
|
# begin automatic update
|
||||||
version = "0.0.114"
|
version = "0.0.115"
|
||||||
# end automatic update
|
# end automatic update
|
||||||
authors = [
|
authors = [
|
||||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
"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).
|
/// Return true if expr contains a single break expr (maybe within a block).
|
||||||
fn is_break_expr(expr: &Expr) -> bool {
|
fn is_break_expr(expr: &Expr) -> bool {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ExprBreak(None, _) => true,
|
ExprBreak(dest, _) if dest.ident.is_none() => true,
|
||||||
ExprBlock(ref b) => {
|
ExprBlock(ref b) => {
|
||||||
match extract_first_expr(b) {
|
match extract_first_expr(b) {
|
||||||
Some(subexpr) => is_break_expr(subexpr),
|
Some(subexpr) => is_break_expr(subexpr),
|
||||||
|
|
|
@ -69,9 +69,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
|
||||||
impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
|
impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
|
||||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
|
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
hir::ExprBreak(Some(label), _) |
|
hir::ExprBreak(destination, _) |
|
||||||
hir::ExprAgain(Some(label)) => {
|
hir::ExprAgain(destination) => {
|
||||||
self.labels.remove(&label.name.as_str());
|
if let Some(label) = destination.ident {
|
||||||
|
self.labels.remove(&label.node.name.as_str());
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hir::ExprLoop(_, Some(label), _) |
|
hir::ExprLoop(_, Some(label), _) |
|
||||||
hir::ExprWhile(_, _, Some(label)) => {
|
hir::ExprWhile(_, _, Some(label)) => {
|
||||||
|
|
|
@ -68,7 +68,9 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
||||||
|
|
||||||
match (&left.node, &right.node) {
|
match (&left.node, &right.node) {
|
||||||
(&ExprAddrOf(l_mut, ref le), &ExprAddrOf(r_mut, ref re)) => l_mut == r_mut && self.eq_expr(le, re),
|
(&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),
|
(&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)) => {
|
(&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)
|
lo.node == ro.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr)
|
||||||
|
@ -81,7 +83,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
(&ExprBreak(li, ref le), &ExprBreak(ri, ref re)) => {
|
(&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),
|
(&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)) => {
|
(&ExprCall(ref l_fun, ref l_args), &ExprCall(ref r_fun, ref r_args)) => {
|
||||||
|
@ -310,8 +313,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
||||||
ExprAgain(i) => {
|
ExprAgain(i) => {
|
||||||
let c: fn(_) -> _ = ExprAgain;
|
let c: fn(_) -> _ = ExprAgain;
|
||||||
c.hash(&mut self.s);
|
c.hash(&mut self.s);
|
||||||
if let Some(i) = i {
|
if let Some(i) = i.ident {
|
||||||
self.hash_name(&i.name);
|
self.hash_name(&i.node.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExprAssign(ref l, ref r) => {
|
ExprAssign(ref l, ref r) => {
|
||||||
|
@ -342,8 +345,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
||||||
ExprBreak(i, ref j) => {
|
ExprBreak(i, ref j) => {
|
||||||
let c: fn(_, _) -> _ = ExprBreak;
|
let c: fn(_, _) -> _ = ExprBreak;
|
||||||
c.hash(&mut self.s);
|
c.hash(&mut self.s);
|
||||||
if let Some(i) = i {
|
if let Some(i) = i.ident {
|
||||||
self.hash_name(&i.name);
|
self.hash_name(&i.node.name);
|
||||||
}
|
}
|
||||||
if let Some(ref j) = *j {
|
if let Some(ref j) = *j {
|
||||||
self.hash_expr(&*j);
|
self.hash_expr(&*j);
|
||||||
|
|
|
@ -900,7 +900,7 @@ pub fn opt_def_id(def: Def) -> Option<DefId> {
|
||||||
Def::AssociatedConst(id) |
|
Def::AssociatedConst(id) |
|
||||||
Def::Local(id) |
|
Def::Local(id) |
|
||||||
Def::Upvar(id, ..) |
|
Def::Upvar(id, ..) |
|
||||||
Def::Macro(id) => Some(id),
|
Def::Macro(id, _) => Some(id),
|
||||||
|
|
||||||
Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None,
|
Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue