Skip to content

Commit 299f127

Browse files
committed
Rustup
1 parent 4020d03 commit 299f127

11 files changed

+60
-54
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 0.0.170
5+
* Rustup to *rustc 1.23.0-nightly (d6b06c63a 2017-11-09)*
6+
47
## 0.0.169
58
* Rustup to *rustc 1.23.0-nightly (3b82e4c74 2017-11-05)*
69
* New lints: [`just_underscores_and_digits`], [`result_map_unwrap_or_else`], [`transmute_bytes_to_str`]

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.169"
3+
version = "0.0.170"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -37,7 +37,7 @@ path = "src/driver.rs"
3737

3838
[dependencies]
3939
# begin automatic update
40-
clippy_lints = { version = "0.0.169", path = "clippy_lints" }
40+
clippy_lints = { version = "0.0.170", path = "clippy_lints" }
4141
# end automatic update
4242
cargo_metadata = "0.2"
4343

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.169"
4+
version = "0.0.170"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/methods.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,8 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
888888
}
889889

890890
// don't lint for constant values
891-
// FIXME: can we `expect` here instead of match?
892891
let owner_def = cx.tcx.hir.get_parent_did(arg.id);
893-
let promotable = cx.tcx.rvalue_promotable_map(owner_def)[&arg.hir_id.local_id];
892+
let promotable = cx.tcx.rvalue_promotable_map(owner_def).contains(&arg.hir_id.local_id);
894893
if promotable {
895894
return;
896895
}

clippy_lints/src/utils/mod.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -620,14 +620,18 @@ where
620620
I: IntoIterator<Item = (Span, String)>,
621621
{
622622
let sugg = rustc_errors::CodeSuggestion {
623-
substitution_parts: sugg.into_iter()
624-
.map(|(span, sub)| {
625-
rustc_errors::Substitution {
626-
span: span,
627-
substitutions: vec![sub],
628-
}
629-
})
630-
.collect(),
623+
substitutions: vec![
624+
rustc_errors::Substitution {
625+
parts: sugg.into_iter()
626+
.map(|(span, snippet)| {
627+
rustc_errors::SubstitutionPart {
628+
snippet,
629+
span,
630+
}
631+
})
632+
.collect(),
633+
}
634+
],
631635
msg: help_msg,
632636
show_code_when_inline: true,
633637
};

tests/ui/for_loop.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ error: the loop variable `i` is only used to index `vec`.
8282
help: consider using an iterator
8383
|
8484
86 | for <item> in &vec {
85-
| ^^^^^^
85+
|
8686

8787
error: the loop variable `i` is only used to index `vec`.
8888
--> $DIR/for_loop.rs:95:5
@@ -95,7 +95,7 @@ error: the loop variable `i` is only used to index `vec`.
9595
help: consider using an iterator
9696
|
9797
95 | for <item> in &vec {
98-
| ^^^^^^
98+
|
9999

100100
error: the loop variable `j` is only used to index `STATIC`.
101101
--> $DIR/for_loop.rs:100:5
@@ -108,7 +108,7 @@ error: the loop variable `j` is only used to index `STATIC`.
108108
help: consider using an iterator
109109
|
110110
100 | for <item> in STATIC.iter().take(4) {
111-
| ^^^^^^
111+
|
112112

113113
error: the loop variable `j` is only used to index `CONST`.
114114
--> $DIR/for_loop.rs:104:5
@@ -121,7 +121,7 @@ error: the loop variable `j` is only used to index `CONST`.
121121
help: consider using an iterator
122122
|
123123
104 | for <item> in CONST.iter().take(4) {
124-
| ^^^^^^
124+
|
125125

126126
error: the loop variable `i` is used to index `vec`
127127
--> $DIR/for_loop.rs:108:5
@@ -134,7 +134,7 @@ error: the loop variable `i` is used to index `vec`
134134
help: consider using an iterator
135135
|
136136
108 | for (i, <item>) in vec.iter().enumerate() {
137-
| ^^^^^^^^^^^
137+
|
138138

139139
error: the loop variable `i` is only used to index `vec2`.
140140
--> $DIR/for_loop.rs:116:5
@@ -147,7 +147,7 @@ error: the loop variable `i` is only used to index `vec2`.
147147
help: consider using an iterator
148148
|
149149
116 | for <item> in vec2.iter().take(vec.len()) {
150-
| ^^^^^^
150+
|
151151

152152
error: the loop variable `i` is only used to index `vec`.
153153
--> $DIR/for_loop.rs:120:5
@@ -160,7 +160,7 @@ error: the loop variable `i` is only used to index `vec`.
160160
help: consider using an iterator
161161
|
162162
120 | for <item> in vec.iter().skip(5) {
163-
| ^^^^^^
163+
|
164164

165165
error: the loop variable `i` is only used to index `vec`.
166166
--> $DIR/for_loop.rs:124:5
@@ -173,7 +173,7 @@ error: the loop variable `i` is only used to index `vec`.
173173
help: consider using an iterator
174174
|
175175
124 | for <item> in vec.iter().take(MAX_LEN) {
176-
| ^^^^^^
176+
|
177177

178178
error: the loop variable `i` is only used to index `vec`.
179179
--> $DIR/for_loop.rs:128:5
@@ -186,7 +186,7 @@ error: the loop variable `i` is only used to index `vec`.
186186
help: consider using an iterator
187187
|
188188
128 | for <item> in vec.iter().take(MAX_LEN + 1) {
189-
| ^^^^^^
189+
|
190190

191191
error: the loop variable `i` is only used to index `vec`.
192192
--> $DIR/for_loop.rs:132:5
@@ -199,7 +199,7 @@ error: the loop variable `i` is only used to index `vec`.
199199
help: consider using an iterator
200200
|
201201
132 | for <item> in vec.iter().take(10).skip(5) {
202-
| ^^^^^^
202+
|
203203

204204
error: the loop variable `i` is only used to index `vec`.
205205
--> $DIR/for_loop.rs:136:5
@@ -212,7 +212,7 @@ error: the loop variable `i` is only used to index `vec`.
212212
help: consider using an iterator
213213
|
214214
136 | for <item> in vec.iter().take(10 + 1).skip(5) {
215-
| ^^^^^^
215+
|
216216

217217
error: the loop variable `i` is used to index `vec`
218218
--> $DIR/for_loop.rs:140:5
@@ -225,7 +225,7 @@ error: the loop variable `i` is used to index `vec`
225225
help: consider using an iterator
226226
|
227227
140 | for (i, <item>) in vec.iter().enumerate().skip(5) {
228-
| ^^^^^^^^^^^
228+
|
229229

230230
error: the loop variable `i` is used to index `vec`
231231
--> $DIR/for_loop.rs:144:5
@@ -238,7 +238,7 @@ error: the loop variable `i` is used to index `vec`
238238
help: consider using an iterator
239239
|
240240
144 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
241-
| ^^^^^^^^^^^
241+
|
242242

243243
error: this range is empty so this for loop will never run
244244
--> $DIR/for_loop.rs:148:5
@@ -448,7 +448,7 @@ error: you seem to want to iterate on a map's values
448448
help: use the corresponding method
449449
|
450450
385 | for v in m.values() {
451-
| ^
451+
|
452452

453453
error: you seem to want to iterate on a map's values
454454
--> $DIR/for_loop.rs:390:5
@@ -464,7 +464,7 @@ error: you seem to want to iterate on a map's values
464464
help: use the corresponding method
465465
|
466466
390 | for v in (*m).values() {
467-
| ^
467+
|
468468

469469
error: you seem to want to iterate on a map's values
470470
--> $DIR/for_loop.rs:398:5
@@ -477,7 +477,7 @@ error: you seem to want to iterate on a map's values
477477
help: use the corresponding method
478478
|
479479
398 | for v in m.values_mut() {
480-
| ^
480+
|
481481

482482
error: you seem to want to iterate on a map's values
483483
--> $DIR/for_loop.rs:403:5
@@ -490,7 +490,7 @@ error: you seem to want to iterate on a map's values
490490
help: use the corresponding method
491491
|
492492
403 | for v in (*m).values_mut() {
493-
| ^
493+
|
494494

495495
error: you seem to want to iterate on a map's keys
496496
--> $DIR/for_loop.rs:409:5
@@ -503,7 +503,7 @@ error: you seem to want to iterate on a map's keys
503503
help: use the corresponding method
504504
|
505505
409 | for k in rm.keys() {
506-
| ^
506+
|
507507

508508
error: it looks like you're manually copying between slices
509509
--> $DIR/for_loop.rs:462:5

tests/ui/implicit_hasher.stderr

+16-16
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ error: impl for `HashMap` should be generalized over different hashers
88
help: consider adding a type parameter
99
|
1010
11 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
|
1212
help: ...and use generic constructor
1313
|
1414
17 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
15-
| ^^^^^^^^^^^^^^^^^^
15+
|
1616

1717
error: impl for `HashMap` should be generalized over different hashers
1818
--> $DIR/implicit_hasher.rs:20:36
@@ -23,11 +23,11 @@ error: impl for `HashMap` should be generalized over different hashers
2323
help: consider adding a type parameter
2424
|
2525
20 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
26-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
|
2727
help: ...and use generic constructor
2828
|
2929
22 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
30-
| ^^^^^^^^^^^^^^^^^^
30+
|
3131

3232
error: impl for `HashMap` should be generalized over different hashers
3333
--> $DIR/implicit_hasher.rs:25:19
@@ -38,11 +38,11 @@ error: impl for `HashMap` should be generalized over different hashers
3838
help: consider adding a type parameter
3939
|
4040
25 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
41-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41+
|
4242
help: ...and use generic constructor
4343
|
4444
27 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
45-
| ^^^^^^^^^^^^^^^^^^
45+
|
4646

4747
error: impl for `HashSet` should be generalized over different hashers
4848
--> $DIR/implicit_hasher.rs:43:32
@@ -53,11 +53,11 @@ error: impl for `HashSet` should be generalized over different hashers
5353
help: consider adding a type parameter
5454
|
5555
43 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
56-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56+
|
5757
help: ...and use generic constructor
5858
|
5959
45 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
60-
| ^^^^^^^^^^^^^^^^^^
60+
|
6161

6262
error: impl for `HashSet` should be generalized over different hashers
6363
--> $DIR/implicit_hasher.rs:48:19
@@ -68,11 +68,11 @@ error: impl for `HashSet` should be generalized over different hashers
6868
help: consider adding a type parameter
6969
|
7070
48 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
71-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71+
|
7272
help: ...and use generic constructor
7373
|
7474
50 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
75-
| ^^^^^^^^^^^^^^^^^^
75+
|
7676

7777
error: parameter of type `HashMap` should be generalized over different hashers
7878
--> $DIR/implicit_hasher.rs:65:23
@@ -83,7 +83,7 @@ error: parameter of type `HashMap` should be generalized over different hashers
8383
help: consider adding a type parameter
8484
|
8585
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
86-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
|
8787

8888
error: parameter of type `HashSet` should be generalized over different hashers
8989
--> $DIR/implicit_hasher.rs:65:53
@@ -94,7 +94,7 @@ error: parameter of type `HashSet` should be generalized over different hashers
9494
help: consider adding a type parameter
9595
|
9696
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
97-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97+
|
9898

9999
error: impl for `HashMap` should be generalized over different hashers
100100
--> $DIR/implicit_hasher.rs:70:43
@@ -108,11 +108,11 @@ error: impl for `HashMap` should be generalized over different hashers
108108
help: consider adding a type parameter
109109
|
110110
70 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
111-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111+
|
112112
help: ...and use generic constructor
113113
|
114114
72 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
115-
| ^^^^^^^^^^^^^^^^^^
115+
|
116116

117117
error: parameter of type `HashMap` should be generalized over different hashers
118118
--> $DIR/implicit_hasher.rs:78:33
@@ -126,7 +126,7 @@ error: parameter of type `HashMap` should be generalized over different hashers
126126
help: consider adding a type parameter
127127
|
128128
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
129-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129+
|
130130

131131
error: parameter of type `HashSet` should be generalized over different hashers
132132
--> $DIR/implicit_hasher.rs:78:63
@@ -140,5 +140,5 @@ error: parameter of type `HashSet` should be generalized over different hashers
140140
help: consider adding a type parameter
141141
|
142142
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
143-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143+
|
144144

tests/ui/matches.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ error: you don't need to add `&` to all patterns
133133
help: instead of prefixing all patterns with `&`, you can dereference the expression
134134
|
135135
138 | match *v { .. }
136-
| ^^^^^^^^^^^^^^^
136+
|
137137

138138
error: you don't need to add `&` to all patterns
139139
--> $DIR/matches.rs:148:5
@@ -147,7 +147,7 @@ error: you don't need to add `&` to all patterns
147147
help: instead of prefixing all patterns with `&`, you can dereference the expression
148148
|
149149
148 | match *tup { .. }
150-
| ^^^^^^^^^^^^^^^^^
150+
|
151151

152152
error: you don't need to add `&` to both the expression and the patterns
153153
--> $DIR/matches.rs:154:5
@@ -169,7 +169,7 @@ error: you don't need to add `&` to all patterns
169169
help: instead of prefixing all patterns with `&`, you can dereference the expression
170170
|
171171
165 | if let .. = *a { .. }
172-
| ^^^^^^^^^^^^^^^^^^^^^
172+
|
173173

174174
error: you don't need to add `&` to both the expression and the patterns
175175
--> $DIR/matches.rs:170:5

tests/ui/needless_range_loop.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ error: the loop variable `i` is only used to index `ns`.
1010
help: consider using an iterator
1111
|
1212
8 | for <item> in ns.iter().take(10).skip(3) {
13-
| ^^^^^^
13+
|
1414

tests/ui/op_ref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ error: needlessly taken reference of both operands
88
help: use the values directly
99
|
1010
13 | let foo = 5 - 6;
11-
| ^
11+
|
1212

0 commit comments

Comments
 (0)