mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Rustup
This commit is contained in:
parent
4020d03f09
commit
299f1270a6
11 changed files with 60 additions and 54 deletions
|
@ -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`]
|
||||
|
|
|
@ -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 @@ path = "src/driver.rs"
|
|||
|
||||
[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"
|
||||
|
||||
|
|
|
@ -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>",
|
||||
|
|
|
@ -888,9 +888,8 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
|
|||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
|
@ -620,14 +620,18 @@ where
|
|||
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,
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `j` is only used to index `STATIC`.
|
|||
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 @@ error: the loop variable `j` is only used to index `CONST`.
|
|||
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 @@ error: the loop variable `i` is used to index `vec`
|
|||
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 @@ error: the loop variable `i` is only used to index `vec2`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is only used to index `vec`.
|
|||
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 @@ error: the loop variable `i` is used to index `vec`
|
|||
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 @@ error: the loop variable `i` is used to index `vec`
|
|||
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 @@ error: you seem to want to iterate on a map's values
|
|||
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 @@ error: you seem to want to iterate on a map's values
|
|||
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 @@ error: you seem to want to iterate on a map's values
|
|||
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 @@ error: you seem to want to iterate on a map's values
|
|||
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 @@ error: you seem to want to iterate on a map's keys
|
|||
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
|
||||
|
|
|
@ -8,11 +8,11 @@ error: impl for `HashMap` should be generalized over different hashers
|
|||
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 @@ error: impl for `HashMap` should be generalized over different hashers
|
|||
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 @@ error: impl for `HashMap` should be generalized over different hashers
|
|||
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 @@ error: impl for `HashSet` should be generalized over different hashers
|
|||
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 @@ error: impl for `HashSet` should be generalized over different hashers
|
|||
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 @@ error: parameter of type `HashMap` should be generalized over different hashers
|
|||
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 @@ error: parameter of type `HashSet` should be generalized over different hashers
|
|||
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 @@ error: impl for `HashMap` should be generalized over different hashers
|
|||
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 @@ error: parameter of type `HashMap` should be generalized over different hashers
|
|||
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 @@ error: parameter of type `HashSet` should be generalized over different hashers
|
|||
help: consider adding a type parameter
|
||||
|
|
||||
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ error: you don't need to add `&` to all patterns
|
|||
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 @@ error: you don't need to add `&` to all patterns
|
|||
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 @@ error: you don't need to add `&` to all patterns
|
|||
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
|
||||
|
|
|
@ -10,5 +10,5 @@ error: the loop variable `i` is only used to index `ns`.
|
|||
help: consider using an iterator
|
||||
|
|
||||
8 | for <item> in ns.iter().take(10).skip(3) {
|
||||
| ^^^^^^
|
||||
|
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@ error: needlessly taken reference of both operands
|
|||
help: use the values directly
|
||||
|
|
||||
13 | let foo = 5 - 6;
|
||||
| ^
|
||||
|
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ help: change `x.clone()` to
|
|||
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
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue