Rustup
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df19e84..4603c27 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.
+## 0.0.170
+* Rustup to *rustc 1.23.0-nightly (d6b06c63a 2017-11-09)*
+
## 0.0.169
* Rustup to *rustc 1.23.0-nightly (3b82e4c74 2017-11-05)*
* New lints: [`just_underscores_and_digits`], [`result_map_unwrap_or_else`], [`transmute_bytes_to_str`]
diff --git a/Cargo.toml b/Cargo.toml
index 2fbf6d1..157a0d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "clippy"
-version = "0.0.169"
+version = "0.0.170"
authors = [
"Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>",
@@ -37,7 +37,7 @@
[dependencies]
# begin automatic update
-clippy_lints = { version = "0.0.169", path = "clippy_lints" }
+clippy_lints = { version = "0.0.170", path = "clippy_lints" }
# end automatic update
cargo_metadata = "0.2"
diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml
index 41803b6..e2b8d65 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.169"
+version = "0.0.170"
# end automatic update
authors = [
"Manish Goregaokar <manishsmail@gmail.com>",
diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs
index 251c4ac..ee61920 100644
--- a/clippy_lints/src/methods.rs
+++ b/clippy_lints/src/methods.rs
@@ -888,9 +888,8 @@
}
// don't lint for constant values
- // FIXME: can we `expect` here instead of match?
let owner_def = cx.tcx.hir.get_parent_did(arg.id);
- let promotable = cx.tcx.rvalue_promotable_map(owner_def)[&arg.hir_id.local_id];
+ let promotable = cx.tcx.rvalue_promotable_map(owner_def).contains(&arg.hir_id.local_id);
if promotable {
return;
}
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index c557e85..a0323df 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -620,14 +620,18 @@
I: IntoIterator<Item = (Span, String)>,
{
let sugg = rustc_errors::CodeSuggestion {
- substitution_parts: sugg.into_iter()
- .map(|(span, sub)| {
- rustc_errors::Substitution {
- span: span,
- substitutions: vec![sub],
- }
- })
- .collect(),
+ substitutions: vec![
+ rustc_errors::Substitution {
+ parts: sugg.into_iter()
+ .map(|(span, snippet)| {
+ rustc_errors::SubstitutionPart {
+ snippet,
+ span,
+ }
+ })
+ .collect(),
+ }
+ ],
msg: help_msg,
show_code_when_inline: true,
};
diff --git a/tests/ui/for_loop.stderr b/tests/ui/for_loop.stderr
index 620c32b..f968e08 100644
--- a/tests/ui/for_loop.stderr
+++ b/tests/ui/for_loop.stderr
@@ -82,7 +82,7 @@
help: consider using an iterator
|
86 | for <item> in &vec {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:95:5
@@ -95,7 +95,7 @@
help: consider using an iterator
|
95 | for <item> in &vec {
- | ^^^^^^
+ |
error: the loop variable `j` is only used to index `STATIC`.
--> $DIR/for_loop.rs:100:5
@@ -108,7 +108,7 @@
help: consider using an iterator
|
100 | for <item> in STATIC.iter().take(4) {
- | ^^^^^^
+ |
error: the loop variable `j` is only used to index `CONST`.
--> $DIR/for_loop.rs:104:5
@@ -121,7 +121,7 @@
help: consider using an iterator
|
104 | for <item> in CONST.iter().take(4) {
- | ^^^^^^
+ |
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:108:5
@@ -134,7 +134,7 @@
help: consider using an iterator
|
108 | for (i, <item>) in vec.iter().enumerate() {
- | ^^^^^^^^^^^
+ |
error: the loop variable `i` is only used to index `vec2`.
--> $DIR/for_loop.rs:116:5
@@ -147,7 +147,7 @@
help: consider using an iterator
|
116 | for <item> in vec2.iter().take(vec.len()) {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:120:5
@@ -160,7 +160,7 @@
help: consider using an iterator
|
120 | for <item> in vec.iter().skip(5) {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:124:5
@@ -173,7 +173,7 @@
help: consider using an iterator
|
124 | for <item> in vec.iter().take(MAX_LEN) {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:128:5
@@ -186,7 +186,7 @@
help: consider using an iterator
|
128 | for <item> in vec.iter().take(MAX_LEN + 1) {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:132:5
@@ -199,7 +199,7 @@
help: consider using an iterator
|
132 | for <item> in vec.iter().take(10).skip(5) {
- | ^^^^^^
+ |
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:136:5
@@ -212,7 +212,7 @@
help: consider using an iterator
|
136 | for <item> in vec.iter().take(10 + 1).skip(5) {
- | ^^^^^^
+ |
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:140:5
@@ -225,7 +225,7 @@
help: consider using an iterator
|
140 | for (i, <item>) in vec.iter().enumerate().skip(5) {
- | ^^^^^^^^^^^
+ |
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:144:5
@@ -238,7 +238,7 @@
help: consider using an iterator
|
144 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
- | ^^^^^^^^^^^
+ |
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:148:5
@@ -448,7 +448,7 @@
help: use the corresponding method
|
385 | for v in m.values() {
- | ^
+ |
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:390:5
@@ -464,7 +464,7 @@
help: use the corresponding method
|
390 | for v in (*m).values() {
- | ^
+ |
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:398:5
@@ -477,7 +477,7 @@
help: use the corresponding method
|
398 | for v in m.values_mut() {
- | ^
+ |
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:403:5
@@ -490,7 +490,7 @@
help: use the corresponding method
|
403 | for v in (*m).values_mut() {
- | ^
+ |
error: you seem to want to iterate on a map's keys
--> $DIR/for_loop.rs:409:5
@@ -503,7 +503,7 @@
help: use the corresponding method
|
409 | for k in rm.keys() {
- | ^
+ |
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:462:5
diff --git a/tests/ui/implicit_hasher.stderr b/tests/ui/implicit_hasher.stderr
index 27d6e2c..52b686b 100644
--- a/tests/ui/implicit_hasher.stderr
+++ b/tests/ui/implicit_hasher.stderr
@@ -8,11 +8,11 @@
help: consider adding a type parameter
|
11 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
17 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:20:36
@@ -23,11 +23,11 @@
help: consider adding a type parameter
|
20 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
22 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:25:19
@@ -38,11 +38,11 @@
help: consider adding a type parameter
|
25 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
27 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:43:32
@@ -53,11 +53,11 @@
help: consider adding a type parameter
|
43 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
45 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:48:19
@@ -68,11 +68,11 @@
help: consider adding a type parameter
|
48 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
50 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:65:23
@@ -83,7 +83,7 @@
help: consider adding a type parameter
|
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:65:53
@@ -94,7 +94,7 @@
help: consider adding a type parameter
|
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:70:43
@@ -108,11 +108,11 @@
help: consider adding a type parameter
|
70 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: ...and use generic constructor
|
72 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^
+ |
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:78:33
@@ -126,7 +126,7 @@
help: consider adding a type parameter
|
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:78:63
@@ -140,5 +140,5 @@
help: consider adding a type parameter
|
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr
index 1c2452c..7ff38a3 100644
--- a/tests/ui/matches.stderr
+++ b/tests/ui/matches.stderr
@@ -133,7 +133,7 @@
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
138 | match *v { .. }
- | ^^^^^^^^^^^^^^^
+ |
error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:148:5
@@ -147,7 +147,7 @@
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
148 | match *tup { .. }
- | ^^^^^^^^^^^^^^^^^
+ |
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:154:5
@@ -169,7 +169,7 @@
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
165 | if let .. = *a { .. }
- | ^^^^^^^^^^^^^^^^^^^^^
+ |
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:170:5
diff --git a/tests/ui/needless_range_loop.stderr b/tests/ui/needless_range_loop.stderr
index e2c3e18..e54c0e7 100644
--- a/tests/ui/needless_range_loop.stderr
+++ b/tests/ui/needless_range_loop.stderr
@@ -10,5 +10,5 @@
help: consider using an iterator
|
8 | for <item> in ns.iter().take(10).skip(3) {
- | ^^^^^^
+ |
diff --git a/tests/ui/op_ref.stderr b/tests/ui/op_ref.stderr
index dbe5393..3259694 100644
--- a/tests/ui/op_ref.stderr
+++ b/tests/ui/op_ref.stderr
@@ -8,5 +8,5 @@
help: use the values directly
|
13 | let foo = 5 - 6;
- | ^
+ |
diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr
index 13be68d..9c6804c 100644
--- a/tests/ui/ptr_arg.stderr
+++ b/tests/ui/ptr_arg.stderr
@@ -35,7 +35,7 @@
help: change `x.clone()` to
|
46 | x.to_owned()
- | ^^^^^^^^^^^^
+ |
error: writing `&String` instead of `&str` involves a new object where a slice will do.
--> $DIR/ptr_arg.rs:49:18
@@ -58,7 +58,7 @@
help: change `x.clone()` to
|
56 | x.to_string()
- | ^^^^^^^^^^^^^
+ |
error: writing `&String` instead of `&str` involves a new object where a slice will do.
--> $DIR/ptr_arg.rs:59:44