Merge branch 'master' into issue2894
This commit is contained in:
commit
8eeb3feadf
22 changed files with 129 additions and 121 deletions
|
|
@ -116,7 +116,7 @@ fn warn_for_built_in_methods_with_negation() {
|
|||
}
|
||||
|
||||
#[allow(neg_cmp_op_on_partial_ord)]
|
||||
fn dont_warn_for_negated_partial_ord_comparision() {
|
||||
fn dont_warn_for_negated_partial_ord_comparison() {
|
||||
let a: f64 = unimplemented!();
|
||||
let b: f64 = unimplemented!();
|
||||
let _ = !(a < b);
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ fn main() {
|
|||
if x.is_ok() {
|
||||
x = Err(());
|
||||
x.unwrap(); // not unnecessary because of mutation of x
|
||||
// it will always panic but the lint is not smart enoguh to see this (it only checks if conditions).
|
||||
// it will always panic but the lint is not smart enough to see this (it only checks if conditions).
|
||||
} else {
|
||||
x = Ok(());
|
||||
x.unwrap_err(); // not unnecessary because of mutation of x
|
||||
// it will always panic but the lint is not smart enoguh to see this (it only checks if conditions).
|
||||
// it will always panic but the lint is not smart enough to see this (it only checks if conditions).
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ fn main() {
|
|||
let m: Rc<HashMap<u64, u64>> = Rc::new(HashMap::new());
|
||||
for (_, v) in &*m {
|
||||
let _v = v;
|
||||
// Here the `*` is not actually necesarry, but the test tests that we don't
|
||||
// Here the `*` is not actually necessary, but the test tests that we don't
|
||||
// suggest
|
||||
// `in *m.values()` as we used to
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ fn foob() -> bool { unimplemented!() }
|
|||
|
||||
#[allow(many_single_char_names)]
|
||||
fn immutable_condition() {
|
||||
// Should warn when all vars mentionned are immutable
|
||||
// Should warn when all vars mentioned are immutable
|
||||
let y = 0;
|
||||
while y < 10 {
|
||||
println!("KO - y is immutable");
|
||||
|
|
@ -69,11 +69,11 @@ fn unused_var() {
|
|||
|
||||
while i < 3 {
|
||||
j = 3;
|
||||
println!("KO - i not mentionned");
|
||||
println!("KO - i not mentioned");
|
||||
}
|
||||
|
||||
while i < 3 && j > 0 {
|
||||
println!("KO - i and j not mentionned");
|
||||
println!("KO - i and j not mentioned");
|
||||
}
|
||||
|
||||
while i < 3 {
|
||||
|
|
@ -84,7 +84,7 @@ fn unused_var() {
|
|||
|
||||
while i < 3 && j > 0 {
|
||||
i = 5;
|
||||
println!("OK - i in cond and mentionned");
|
||||
println!("OK - i in cond and mentioned");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ error: Err(_) will match all errors, maybe not a good idea
|
|||
| ^^^^^^
|
||||
|
|
||||
= note: `-D match-wild-err-arm` implied by `-D warnings`
|
||||
= note: to remove this warning, match each error seperately or use unreachable macro
|
||||
= note: to remove this warning, match each error separately or use unreachable macro
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/matches.rs:131:18
|
||||
|
|
@ -191,7 +191,7 @@ error: Err(_) will match all errors, maybe not a good idea
|
|||
138 | Err(_) => {panic!()}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: to remove this warning, match each error seperately or use unreachable macro
|
||||
= note: to remove this warning, match each error separately or use unreachable macro
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/matches.rs:137:18
|
||||
|
|
@ -217,7 +217,7 @@ error: Err(_) will match all errors, maybe not a good idea
|
|||
144 | Err(_) => {panic!();}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: to remove this warning, match each error seperately or use unreachable macro
|
||||
= note: to remove this warning, match each error separately or use unreachable macro
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/matches.rs:143:18
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ fn main() {
|
|||
|
||||
// Issue 2856: False positive on assert!()
|
||||
//
|
||||
// The macro always negates the result of the given comparision in its
|
||||
// The macro always negates the result of the given comparison in its
|
||||
// internal check which automatically triggered the lint. As it's an
|
||||
// external macro there was no chance to do anything about it which lead
|
||||
// external macro there was no chance to do anything about it which led
|
||||
// to a whitelisting of all external macros.
|
||||
assert!(a_value < another_value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
|
||||
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
|
||||
--> $DIR/neg_cmp_op_on_partial_ord.rs:17:21
|
||||
|
|
||||
17 | let _not_less = !(a_value < another_value);
|
||||
|
|
@ -6,19 +6,19 @@ error: The use of negated comparision operators on partially orded types produce
|
|||
|
|
||||
= note: `-D neg-cmp-op-on-partial-ord` implied by `-D warnings`
|
||||
|
||||
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
|
||||
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
|
||||
--> $DIR/neg_cmp_op_on_partial_ord.rs:20:30
|
||||
|
|
||||
20 | let _not_less_or_equal = !(a_value <= another_value);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
|
||||
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
|
||||
--> $DIR/neg_cmp_op_on_partial_ord.rs:23:24
|
||||
|
|
||||
23 | let _not_greater = !(a_value > another_value);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
|
||||
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
|
||||
--> $DIR/neg_cmp_op_on_partial_ord.rs:26:33
|
||||
|
|
||||
26 | let _not_greater_or_equal = !(a_value >= another_value);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ fn main() {
|
|||
println!("Hello");
|
||||
let world = "world";
|
||||
println!("Hello {}", world);
|
||||
println!("Hello {world}", world=world);
|
||||
println!("3 in hex is {:X}", 3);
|
||||
println!("2 + 1 = {:.4}", 3);
|
||||
println!("2 + 1 = {:5.4}", 3);
|
||||
|
|
|
|||
|
|
@ -1,87 +1,87 @@
|
|||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:23:71
|
||||
--> $DIR/print_literal.rs:24:71
|
||||
|
|
||||
23 | println!("{} of {:b} people know binary, the other half doesn't", 1, 2);
|
||||
24 | println!("{} of {:b} people know binary, the other half doesn't", 1, 2);
|
||||
| ^
|
||||
|
|
||||
= note: `-D print-literal` implied by `-D warnings`
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:24:24
|
||||
--> $DIR/print_literal.rs:25:24
|
||||
|
|
||||
24 | print!("Hello {}", "world");
|
||||
25 | print!("Hello {}", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:25:36
|
||||
--> $DIR/print_literal.rs:26:36
|
||||
|
|
||||
25 | println!("Hello {} {}", world, "world");
|
||||
26 | println!("Hello {} {}", world, "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:26:26
|
||||
--> $DIR/print_literal.rs:27:26
|
||||
|
|
||||
26 | println!("Hello {}", "world");
|
||||
27 | println!("Hello {}", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:27:30
|
||||
--> $DIR/print_literal.rs:28:30
|
||||
|
|
||||
27 | println!("10 / 4 is {}", 2.5);
|
||||
28 | println!("10 / 4 is {}", 2.5);
|
||||
| ^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:28:28
|
||||
--> $DIR/print_literal.rs:29:28
|
||||
|
|
||||
28 | println!("2 + 1 = {}", 3);
|
||||
29 | println!("2 + 1 = {}", 3);
|
||||
| ^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:33:25
|
||||
|
|
||||
33 | println!("{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:33:34
|
||||
|
|
||||
33 | println!("{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:34:25
|
||||
|
|
||||
34 | println!("{1} {0}", "hello", "world");
|
||||
34 | println!("{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:34:34
|
||||
|
|
||||
34 | println!("{1} {0}", "hello", "world");
|
||||
34 | println!("{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:37:33
|
||||
--> $DIR/print_literal.rs:35:25
|
||||
|
|
||||
37 | println!("{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
35 | println!("{1} {0}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:37:46
|
||||
--> $DIR/print_literal.rs:35:34
|
||||
|
|
||||
37 | println!("{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
35 | println!("{1} {0}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:38:33
|
||||
|
|
||||
38 | println!("{bar} {foo}", foo="hello", bar="world");
|
||||
38 | println!("{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:38:46
|
||||
|
|
||||
38 | println!("{bar} {foo}", foo="hello", bar="world");
|
||||
38 | println!("{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:39:33
|
||||
|
|
||||
39 | println!("{bar} {foo}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/print_literal.rs:39:46
|
||||
|
|
||||
39 | println!("{bar} {foo}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ fn main() {
|
|||
writeln!(&mut v, "Hello");
|
||||
let world = "world";
|
||||
writeln!(&mut v, "Hello {}", world);
|
||||
writeln!(&mut v, "Hello {world}", world=world);
|
||||
writeln!(&mut v, "3 in hex is {:X}", 3);
|
||||
writeln!(&mut v, "2 + 1 = {:.4}", 3);
|
||||
writeln!(&mut v, "2 + 1 = {:5.4}", 3);
|
||||
|
|
|
|||
|
|
@ -1,87 +1,87 @@
|
|||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:26:79
|
||||
--> $DIR/write_literal.rs:27:79
|
||||
|
|
||||
26 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2);
|
||||
27 | writeln!(&mut v, "{} of {:b} people know binary, the other half doesn't", 1, 2);
|
||||
| ^
|
||||
|
|
||||
= note: `-D write-literal` implied by `-D warnings`
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:27:32
|
||||
--> $DIR/write_literal.rs:28:32
|
||||
|
|
||||
27 | write!(&mut v, "Hello {}", "world");
|
||||
28 | write!(&mut v, "Hello {}", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:28:44
|
||||
--> $DIR/write_literal.rs:29:44
|
||||
|
|
||||
28 | writeln!(&mut v, "Hello {} {}", world, "world");
|
||||
29 | writeln!(&mut v, "Hello {} {}", world, "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:29:34
|
||||
--> $DIR/write_literal.rs:30:34
|
||||
|
|
||||
29 | writeln!(&mut v, "Hello {}", "world");
|
||||
30 | writeln!(&mut v, "Hello {}", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:30:38
|
||||
--> $DIR/write_literal.rs:31:38
|
||||
|
|
||||
30 | writeln!(&mut v, "10 / 4 is {}", 2.5);
|
||||
31 | writeln!(&mut v, "10 / 4 is {}", 2.5);
|
||||
| ^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:31:36
|
||||
--> $DIR/write_literal.rs:32:36
|
||||
|
|
||||
31 | writeln!(&mut v, "2 + 1 = {}", 3);
|
||||
32 | writeln!(&mut v, "2 + 1 = {}", 3);
|
||||
| ^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:36:33
|
||||
|
|
||||
36 | writeln!(&mut v, "{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:36:42
|
||||
|
|
||||
36 | writeln!(&mut v, "{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:37:33
|
||||
|
|
||||
37 | writeln!(&mut v, "{1} {0}", "hello", "world");
|
||||
37 | writeln!(&mut v, "{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:37:42
|
||||
|
|
||||
37 | writeln!(&mut v, "{1} {0}", "hello", "world");
|
||||
37 | writeln!(&mut v, "{0} {1}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:40:41
|
||||
--> $DIR/write_literal.rs:38:33
|
||||
|
|
||||
40 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
38 | writeln!(&mut v, "{1} {0}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:40:54
|
||||
--> $DIR/write_literal.rs:38:42
|
||||
|
|
||||
40 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
38 | writeln!(&mut v, "{1} {0}", "hello", "world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:41:41
|
||||
|
|
||||
41 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world");
|
||||
41 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:41:54
|
||||
|
|
||||
41 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world");
|
||||
41 | writeln!(&mut v, "{foo} {bar}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:42:41
|
||||
|
|
||||
42 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: literal with an empty format string
|
||||
--> $DIR/write_literal.rs:42:54
|
||||
|
|
||||
42 | writeln!(&mut v, "{bar} {foo}", foo="hello", bar="world");
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue