Skip to content

Commit 3341940

Browse files
committed
Merge pull request #958 from Manishearth/rustup
Rustup to *1.10.0-nightly (7bddce6 2016-05-27)* && bump to 0.0.70
2 parents 71b41b6 + c1d7bab commit 3341940

File tree

12 files changed

+61
-21
lines changed

12 files changed

+61
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4-
## 0.0.70 — TBD
4+
## 0.0.70 — 2016-05-28
5+
* Rustup to *rustc 1.10.0-nightly (7bddce693 2016-05-27)*
56
* [`invalid_regex`] and [`trivial_regex`] can now warn on `RegexSet::new`,
67
`RegexBuilder::new` and byte regexes
78

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.69"
3+
version = "0.0.70"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.0.69"
3+
version = "0.0.70"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",

clippy_lints/src/copies.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
187187
match pat.node {
188188
PatKind::Box(ref pat) |
189189
PatKind::Ref(ref pat, _) => bindings_impl(cx, pat, map),
190-
PatKind::TupleStruct(_, Some(ref pats)) => {
190+
PatKind::TupleStruct(_, ref pats, _) => {
191191
for pat in pats {
192192
bindings_impl(cx, pat, map);
193193
}
@@ -205,7 +205,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
205205
bindings_impl(cx, &pat.node.pat, map);
206206
}
207207
}
208-
PatKind::Tup(ref fields) => {
208+
PatKind::Tuple(ref fields, _) => {
209209
for pat in fields {
210210
bindings_impl(cx, pat, map);
211211
}
@@ -221,7 +221,6 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
221221
bindings_impl(cx, pat, map);
222222
}
223223
}
224-
PatKind::TupleStruct(..) |
225224
PatKind::Lit(..) |
226225
PatKind::QPath(..) |
227226
PatKind::Range(..) |

clippy_lints/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn check_arg_is_display(cx: &LateContext, expr: &Expr) -> bool {
101101
let ExprMatch(_, ref arms, _) = expr.node,
102102
arms.len() == 1,
103103
arms[0].pats.len() == 1,
104-
let PatKind::Tup(ref pat) = arms[0].pats[0].node,
104+
let PatKind::Tuple(ref pat, None) = arms[0].pats[0].node,
105105
pat.len() == 1,
106106
let ExprVec(ref exprs) = arms[0].body.node,
107107
exprs.len() == 1,

clippy_lints/src/loops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl LateLintPass for LoopsPass {
280280
}
281281
if let ExprMatch(ref match_expr, ref arms, MatchSource::WhileLetDesugar) = expr.node {
282282
let pat = &arms[0].pats[0].node;
283-
if let (&PatKind::TupleStruct(ref path, Some(ref pat_args)),
283+
if let (&PatKind::TupleStruct(ref path, ref pat_args, _),
284284
&ExprMethodCall(method_name, _, ref method_args)) = (pat, &match_expr.node) {
285285
let iter_expr = &method_args[0];
286286
if let Some(lhs_constructor) = path.segments.last() {
@@ -575,7 +575,7 @@ fn check_for_loop_explicit_counter(cx: &LateContext, arg: &Expr, body: &Expr, ex
575575

576576
/// Check for the `FOR_KV_MAP` lint.
577577
fn check_for_loop_over_map_kv(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, expr: &Expr) {
578-
if let PatKind::Tup(ref pat) = pat.node {
578+
if let PatKind::Tuple(ref pat, _) = pat.node {
579579
if pat.len() == 2 {
580580
let (pat_span, kind) = match (&pat[0].node, &pat[1].node) {
581581
(key, _) if pat_is_wild(key, body) => (&pat[1].span, "values"),

clippy_lints/src/matches.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,13 @@ fn check_single_match_opt_like(cx: &LateContext, ex: &Expr, arms: &[Arm], expr:
193193
(&paths::RESULT, "Ok")];
194194

195195
let path = match arms[1].pats[0].node {
196-
PatKind::TupleStruct(ref path, Some(ref inner)) => {
196+
PatKind::TupleStruct(ref path, ref inner, _) => {
197197
// contains any non wildcard patterns? e.g. Err(err)
198198
if inner.iter().any(|pat| pat.node != PatKind::Wild) {
199199
return;
200200
}
201201
path.to_string()
202202
}
203-
PatKind::TupleStruct(ref path, None) => path.to_string(),
204203
PatKind::Ident(BindByValue(MutImmutable), ident, None) => ident.node.to_string(),
205204
_ => return,
206205
};

clippy_lints/src/shadow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span, bind
161161
}
162162
}
163163
}
164-
PatKind::Tup(ref inner) => {
164+
PatKind::Tuple(ref inner, _) => {
165165
if let Some(ref init_tup) = *init {
166166
if let ExprTup(ref tup) = init_tup.node {
167167
for (i, p) in inner.iter().enumerate() {

clippy_lints/src/unused_label.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'v> Visitor<'v> for UnusedLabelVisitor {
6868
self.labels.remove(&label.node.as_str());
6969
}
7070
hir::ExprLoop(_, Some(label)) | hir::ExprWhile(_, _, Some(label)) => {
71-
self.labels.insert(label.as_str(), expr.span);
71+
self.labels.insert(label.node.as_str(), expr.span);
7272
}
7373
_ => (),
7474
}

clippy_lints/src/utils/hir.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
9595
}
9696
(&ExprLit(ref l), &ExprLit(ref r)) => l.node == r.node,
9797
(&ExprLoop(ref lb, ref ll), &ExprLoop(ref rb, ref rl)) => {
98-
self.eq_block(lb, rb) && both(ll, rl, |l, r| l.as_str() == r.as_str())
98+
self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str())
9999
}
100100
(&ExprMatch(ref le, ref la, ref ls), &ExprMatch(ref re, ref ra, ref rs)) => {
101101
ls == rs && self.eq_expr(le, re) &&
@@ -124,7 +124,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
124124
(&ExprUnary(l_op, ref le), &ExprUnary(r_op, ref re)) => l_op == r_op && self.eq_expr(le, re),
125125
(&ExprVec(ref l), &ExprVec(ref r)) => self.eq_exprs(l, r),
126126
(&ExprWhile(ref lc, ref lb, ref ll), &ExprWhile(ref rc, ref rb, ref rl)) => {
127-
self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.as_str() == r.as_str())
127+
self.eq_expr(lc, rc) && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.node.as_str() == r.node.as_str())
128128
}
129129
_ => false,
130130
}
@@ -142,8 +142,8 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
142142
pub fn eq_pat(&self, left: &Pat, right: &Pat) -> bool {
143143
match (&left.node, &right.node) {
144144
(&PatKind::Box(ref l), &PatKind::Box(ref r)) => self.eq_pat(l, r),
145-
(&PatKind::TupleStruct(ref lp, ref la), &PatKind::TupleStruct(ref rp, ref ra)) => {
146-
self.eq_path(lp, rp) && both(la, ra, |l, r| over(l, r, |l, r| self.eq_pat(l, r)))
145+
(&PatKind::TupleStruct(ref lp, ref la, ls), &PatKind::TupleStruct(ref rp, ref ra, rs)) => {
146+
self.eq_path(lp, rp) && over(la, ra, |l, r| self.eq_pat(l, r)) && ls == rs
147147
}
148148
(&PatKind::Ident(ref lb, ref li, ref lp), &PatKind::Ident(ref rb, ref ri, ref rp)) => {
149149
lb == rb && li.node.as_str() == ri.node.as_str() && both(lp, rp, |l, r| self.eq_pat(l, r))
@@ -152,7 +152,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
152152
(&PatKind::QPath(ref ls, ref lp), &PatKind::QPath(ref rs, ref rp)) => {
153153
self.eq_qself(ls, rs) && self.eq_path(lp, rp)
154154
}
155-
(&PatKind::Tup(ref l), &PatKind::Tup(ref r)) => over(l, r, |l, r| self.eq_pat(l, r)),
155+
(&PatKind::Tuple(ref l, ls), &PatKind::Tuple(ref r, rs)) => ls == rs && over(l, r, |l, r| self.eq_pat(l, r)),
156156
(&PatKind::Range(ref ls, ref le), &PatKind::Range(ref rs, ref re)) => {
157157
self.eq_expr(ls, rs) && self.eq_expr(le, re)
158158
}
@@ -374,7 +374,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
374374
c.hash(&mut self.s);
375375
self.hash_block(b);
376376
if let Some(i) = *i {
377-
self.hash_name(&i);
377+
self.hash_name(&i.node);
378378
}
379379
}
380380
ExprMatch(ref e, ref arms, ref s) => {
@@ -468,7 +468,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
468468
self.hash_expr(cond);
469469
self.hash_block(b);
470470
if let Some(l) = l {
471-
self.hash_name(&l);
471+
self.hash_name(&l.node);
472472
}
473473
}
474474
}

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ pub fn recover_for_loop(expr: &Expr) -> Option<(&Pat, &Expr, &Expr)> {
828828
let Some(ref loopexpr) = block.expr,
829829
let ExprMatch(_, ref innerarms, MatchSource::ForLoopDesugar) = loopexpr.node,
830830
innerarms.len() == 2 && innerarms[0].pats.len() == 1,
831-
let PatKind::TupleStruct(_, Some(ref somepats)) = innerarms[0].pats[0].node,
831+
let PatKind::TupleStruct(_, ref somepats, _) = innerarms[0].pats[0].node,
832832
somepats.len() == 1
833833
], {
834834
return Some((&somepats[0],

tests/compile-fail/copies.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(plugin, inclusive_range_syntax)]
2+
#![feature(dotdot_in_tuple_patterns)]
23
#![plugin(clippy)]
34

45
#![allow(dead_code, no_effect, unnecessary_operation)]
@@ -129,6 +130,34 @@ fn if_same_then_else() -> Result<&'static str, ()> {
129130
if let Some(a) = Some(42) {}
130131
}
131132

133+
if true {
134+
if let (1, .., 3) = (1, 2, 3) {}
135+
}
136+
else { //~ERROR this `if` has identical blocks
137+
if let (1, .., 3) = (1, 2, 3) {}
138+
}
139+
140+
if true {
141+
if let (1, .., 3) = (1, 2, 3) {}
142+
}
143+
else {
144+
if let (.., 3) = (1, 2, 3) {}
145+
}
146+
147+
if true {
148+
if let (1, .., 3) = (1, 2, 3) {}
149+
}
150+
else {
151+
if let (.., 4) = (1, 2, 3) {}
152+
}
153+
154+
if true {
155+
if let (1, .., 3) = (1, 2, 3) {}
156+
}
157+
else {
158+
if let (.., 1, 3) = (1, 2, 3) {}
159+
}
160+
132161
if true {
133162
if let Some(a) = Some(42) {}
134163
}
@@ -165,6 +194,18 @@ fn if_same_then_else() -> Result<&'static str, ()> {
165194
_ => (),
166195
}
167196

197+
match (Some(42), Some(42)) {
198+
(Some(a), ..) => bar(a),
199+
(.., Some(a)) => bar(a), //~ERROR this `match` has identical arm bodies
200+
_ => (),
201+
}
202+
203+
match (1, 2, 3) {
204+
(1, .., 3) => 42,
205+
(.., 3) => 42, //~ERROR this `match` has identical arm bodies
206+
_ => 0,
207+
};
208+
168209
match (Some(42), Some("")) {
169210
(Some(a), None) => bar(a),
170211
(None, Some(a)) => bar(a), // bindings have different types

0 commit comments

Comments
 (0)