Commit Graph

871 Commits

Author SHA1 Message Date
Enrico Schmitz
d4050c275e Remove old tests for ConstInt::Infer as it has been removed 2017-03-01 15:38:31 +01:00
Enrico Schmitz
887a3c184e Make tests compile for rustc 1.17.0-nightly (be760566c 2017-02-28) 2017-03-01 14:33:17 +01:00
Tristian Celestin
75e28610a7 Merged drop_forget_ref.rs with drop_forget_copy.rs.
Moved constant message strings out of declare_lint! macros.
2017-02-26 21:57:47 -05:00
Tristian Celestin
aa037d1ef0 Merge branch 'master' into 1537-drop_copy 2017-02-25 23:11:21 -05:00
Tristian Celestin
b8defc6cc4 Warn on calls to std::mem::drop or std::mem::forget with a Copy type 2017-02-25 23:05:37 -05:00
sinkuu
5906639af5 Enable len_zero for slices 2017-02-25 12:26:33 +09:00
Oliver Schneider
19929790aa Merge pull request #1561 from Manishearth/zero_ptr
New zero_ptr lint.
2017-02-22 13:34:28 +01:00
sinkuu
1e26c44010 Suggest assert_ne for assert!(x != y) 2017-02-22 16:47:18 +09:00
Oliver Schneider
a7c049df28 Merge pull request #1564 from Manishearth/cleanup
Cleanup test suite
2017-02-21 15:30:39 +01:00
Oliver Schneider
d032b8967c Merge pull request #1491 from Manishearth/into_iter_on_ref
fix explicit_into_iter_loop on references
2017-02-21 14:55:52 +01:00
Oliver Schneider
27aa309b3d Merge pull request #1556 from sinkuu/take_by_value
Lint needless take-by-value
2017-02-21 13:07:25 +01:00
Oliver Schneider
25e230419c Merge system independent ui-tests back into tests/ui 2017-02-21 12:19:55 +01:00
Oliver Schneider
f10128369b fix ui-posix test paths 2017-02-21 12:16:57 +01:00
Oliver Schneider
f2ff5e2133 Update ui test output 2017-02-21 12:13:44 +01:00
Oliver Schneider
0996f8bb00 Fix more wrong windows ui test paths 2017-02-21 12:12:45 +01:00
Oliver Schneider
ff655a7dbc Ui windows test paths are wrong 2017-02-21 12:12:08 +01:00
Oliver Schneider
21a0b16aee
adjust messages in tests 2017-02-21 12:04:29 +01:00
Oliver Schneider
0bea3e76d4
fix explicit_into_iter_loop on references
fixes #1398
2017-02-21 12:01:41 +01:00
Oliver Schneider
89d98a8732 Simplify calling update-all-references.sh 2017-02-21 11:18:05 +01:00
Oliver Schneider
3af04c7816 Cleanup test suite 2017-02-21 11:11:33 +01:00
sinkuu
cb86c57c5f Integrate suggestion spans 2017-02-21 19:03:50 +09:00
sinkuu
3516d45d7c Use multispan_sugg 2017-02-21 18:44:31 +09:00
Oliver Schneider
55ea08102a Merge pull request #1543 from Manishearth/fix-windows-tests
fix windows tests
2017-02-21 10:34:49 +01:00
Oliver Schneider
f07f793fa8 Merge pull request #1544 from bood/master
Add lint for unnecessary casts (cast to same type)
2017-02-21 09:16:07 +01:00
Andre Bogus
2f7babba82 New zero_ptr lint.
This fixes #1047. I did not bother to add a full suggestion,
because replacing with `std::ptr::null()` may still lead to
inference failures.
2017-02-21 04:36:59 +01:00
sinkuu
627d24c80f Fix suggestion for let <pat> 2017-02-21 00:27:12 +09:00
sinkuu
f1b0b774e7 Support non-moving usages at match
This `match` is not moving the `String`:

```rust
fn foo(x: Option<String>) -> i32 {
    match x {
        Some(_) => 1,
        None => 2,
    }
}
```

With this change, it will be linted and suggested to add `*` to deref it.

```rust
fn foo(x: &Option<String>) -> i32 {
    match *x {
        Some(_) => 1,
        None => 2,
    }
}
```
2017-02-20 16:45:37 +09:00
sinkuu
0a6bc6031a Rename lint to needless_take_by_value
And fixes false-positives for generics and `match`
2017-02-20 16:02:48 +09:00
Phil Ellison
d6a4d2cb18 Fix typo 2017-02-19 15:39:40 +00:00
Phil Ellison
0396756098 Add test that adding allow attribute on impl block containing len silences len_without_is_empty. Add extra impl block to PubOne to check that this doesn't get flagged@ 2017-02-19 15:36:17 +00:00
Phil Ellison
2dd45b7317 Use span of impl/trait in len_without_is_empty error message, rather than the span of the len method 2017-02-19 15:14:30 +00:00
sinkuu
d81d961ba7 Lint needless take-by-value 2017-02-19 07:59:44 +09:00
Bood Qian
97d46232b4 Merge branch 'master' of github.com:Manishearth/rust-clippy 2017-02-18 11:12:13 +08:00
sinkuu
8cb2ec804d Support generic type 2017-02-18 10:14:25 +09:00
sinkuu
6bb426b0e3 Add should_assert_eq lint (fixes #641) 2017-02-18 10:13:56 +09:00
Andre Bogus
505eb53d29 New never loop lint
This lint detects loops that unconditionally break or return.

Closes #257
2017-02-17 04:53:14 +01:00
Ben Boeckel
84509ca48a typos: coma -> comma 2017-02-16 11:23:28 -05:00
Bood Qian
2f00ea3a07 Suppress lint for unsuffixed number casts 2017-02-16 22:55:41 +08:00
Bood Qian
afce85e96d Add lint for unnecessary casts (cast to same type) 2017-02-15 22:20:20 +08:00
Oliver Schneider
f158bec188 satisfy rustfmt 2017-02-15 08:36:44 +01:00
Andre Bogus
d904a01140 fix windows tests
Windows has a different error message than POSIX, so the ui tests fail for the clippy-config-fail tests.
This commit splits those tests up in target-os specific subdirectories and extends compile-test.rs to
run either of them based on the target os. Here's hope we'll get a green appveyor build.
2017-02-14 17:30:55 +01:00
Oliver Schneider
8b3ad61dd3 update ui tests 2017-02-13 11:57:14 +01:00
Oliver Schneider
2265babe6a
Merge remote-tracking branch 'origin/master' into clonedCollect 2017-02-13 11:40:02 +01:00
Oliver Schneider
637a4590f6
Merge remote-tracking branch 'origin/master' 2017-02-13 11:15:12 +01:00
Martin Carton
9a7597d5af Merge pull request #1528 from Manishearth/mut-from-ref
New `mut_from_ref` lint
2017-02-12 16:01:15 +01:00
Andre Bogus
21d226e7d2 fixed multi-span test 2017-02-12 15:10:25 +01:00
Andre Bogus
36b8554cf1 add notes for immutable inputs 2017-02-12 13:53:30 +01:00
f001
b3570db094 update via comments 2017-02-12 20:40:38 +08:00
f001
98aa0db0ac Add a lint for slice.iter().cloned().collect()
If one uses `slice.iter().cloned().collect()` to create a new `Vec`,
it should be `slice.to_owned()`.

Fix #1292
2017-02-12 17:03:09 +08:00
Bood Qian
64d2f8af8e Lint on panic! only 2017-02-11 21:42:42 +08:00
Bood Qian
a2d752807a Lint on Err(_) arm of a match 2017-02-11 14:57:50 +08:00
Owen Sanchez
2a8ce7c458 Update large_enum_variant test 2017-02-10 21:04:19 -07:00
Owen Sanchez
1938904fcd Change large_enum_variant to lint against size differences rather than size 2017-02-10 18:12:32 -07:00
Andre Bogus
673ee4800d fix test 2017-02-11 01:41:49 +01:00
Andre Bogus
bff4c30ac7 added test, fixed message & description, rustfmt 2017-02-11 00:32:12 +01:00
Andre Bogus
5650a599a8 New mut_from_ref lint
This fixes #1507.
2017-02-10 19:39:03 +01:00
Oliver Schneider
1f2c97a291 remove all //~ from tests 2017-02-08 14:58:07 +01:00
Oliver Schneider
fd1351f6e3 rustup and compile-fail -> ui test move 2017-02-07 21:05:30 +01:00
Martin Carton
4ee839857b Merge pull request #1506 from bood/master
Lint for possible missing comma in an array #1177
2017-02-07 18:56:38 +01:00
Owen Sanchez
7570af0557 Make tests pass 2017-02-04 22:59:39 -07:00
Owen Sanchez
49238ad1d2 Implement empty_enum lint and add a test 2017-02-04 21:52:44 -07:00
Oliver Schneider
d198b99472 fix false negatives introduced in the rustup 2017-02-04 16:59:06 +01:00
Bood Qian
cb83a299fa Add test cases for possible missing comma lint 2017-02-04 20:02:53 +08:00
Bood Qian
33577ec3f7 Lint for possible missing comma in an array #1177 2017-02-03 19:10:30 +08:00
Martin Carton
b1be0d6457 Merge pull request #1492 from Manishearth/largeEnumVariant
large_enum_variants lint suggests to box variants above a configurable limit
2017-01-31 19:12:43 +01:00
Oliver Schneider
12eeffdf93 place the error checks on the correct lines 2017-01-31 16:00:28 +01:00
Oliver Schneider
19f119caec fix println message in tests 2017-01-31 11:19:49 +01:00
Oliver Schneider
9bda699c80 improve messages and add suggestions 2017-01-31 08:36:39 +01:00
Oliver Schneider
d9ec55e695 address nits 2017-01-31 08:08:54 +01:00
Oliver Schneider
82dd50d0e2 large_enum_variants lint suggests to box variants above a configurable limit 2017-01-30 13:17:56 +01:00
Oliver Schneider
aebdf74e16 correctly check exclusive range patterns for overlap 2017-01-30 12:30:16 +01:00
Pascal Hertleif
2357dfe8ee Remove useless part of test 2017-01-28 14:17:47 +01:00
Pascal Hertleif
6760b35e57 Increase suggestion tests' context 2017-01-28 14:12:35 +01:00
Pascal Hertleif
8cbf548f7e Add suggestions to EXPLICIT_[INTO_]ITER_LOOP
Also reduces the highlighted span to the expr containing the
`.[into_]iter()` call (so the suggestion is probably applicable by
rustfix.)

Fixes #1484
2017-01-28 14:02:49 +01:00
Oliver Schneider
4a70a46d2d
run rustfmt 2017-01-26 11:31:26 +01:00
Oliver Schneider
26e8558d8a
remove rustc-serialize dependency and factor util::cargo out into a crate 2017-01-26 11:31:26 +01:00
mcarton
b784f0d736
Use span_suggestion in the precedence lint 2017-01-22 15:00:10 +01:00
Oliver Schneider
7b836dd27c
become rustfmt resistant 2017-01-17 19:27:52 +01:00
Oliver Schneider
25100a8299
fix build 2017-01-17 19:23:32 +01:00
Andre Bogus
27d47f970a rustfmt tests to fix build 2017-01-17 16:12:09 +01:00
Oliver Schneider
219da6d736 Merge pull request #1444 from Manishearth/or_else_method
Extend or_fun_call to also cover methods
2017-01-15 14:38:51 +01:00
sinkuu
cdfe002ee1 Use closure body span (fixes #1405) 2017-01-15 13:16:02 +09:00
Andre Bogus
b764b2a7aa extend or_fun_call lint to cover methods 2017-01-15 00:31:20 +01:00
Andre Bogus
2fdb6e4d1a deprecate extend_from_slice lint 2017-01-14 14:39:41 +01:00
Oliver Schneider
d944d7df9a
rustup to 2017-01-12 2017-01-13 17:04:56 +01:00
Oliver Schneider
3cc5596466 Merge pull request #1433 from sinkuu/ref
Don't lint needless_borrow when matching `&&mut` by `&ref`
2017-01-10 17:29:19 +01:00
sinkuu
c9091b71a1 Don't lint when matching &&mut by &ref (Fix #1432) 2017-01-11 00:42:58 +09:00
Oliver Schneider
e066997046
FOR_KV_MAP can now lint on mutable maps due to values_mut() 2017-01-10 08:33:20 +01:00
sinkuu
a2bcce9dbf Move is_try to util
Removed unnecessary condition

Also changed lint span of `try` from surrounded expression to entire `try`
invocation. It turned out that compiletest misses errors for macro invocations.
2017-01-07 23:52:48 +09:00
sinkuu
ce6e037ac5 Implement unused_io_amount lint 2017-01-07 22:23:33 +09:00
Theemathas Chirananthavat
3050d90930 Add forget_ref tests.
Also rename drop_ref.rs to drop_forget_ref.rs in tests/compile-fail.
2017-01-05 17:41:01 -08:00
Theemathas Chirananthavat
920a2b7468 The drop_ref test does not require implementing the Drop trait. 2017-01-05 17:41:01 -08:00
Oliver Schneider
f145fc44f8 Merge pull request #1414 from samueltardieu/no-short-circuit-if
Add a new "short_circuit_statement" lint (fixes #1194)
2017-01-05 10:41:14 +01:00
Manish Goregaokar
9a301fd508 Bump to 0.0.106; Fix false positive in wrong_self_convention (fix #1420) 2017-01-04 18:05:04 -08:00
Samuel Tardieu
82b2f5663f Add a new "short_circuit_statement" lint (fixes #1194) 2016-12-31 01:17:39 +01:00
Manish Goregaokar
b8b54eb0d8 Fix suggestion span on new_without_default (fixes #1407) 2016-12-29 11:19:32 -08:00
Theemathas Chirananthavat
c0c20145d1 Fix compile-fail tests by allowing double_parens. 2016-12-28 12:04:46 -08:00
Theemathas Chirananthavat
e7352877c5 Add test for double_parens lint. 2016-12-28 11:21:53 -08:00
Martin Carton
96d2483b09 Merge pull request #1400 from oli-obk/needed_needless_lifetime
support impl trait for needless lifetimes
2016-12-25 18:24:39 +01:00
Martin Carton
7c480d0db7 Merge pull request #1394 from Manishearth/absurd_extreme_comparisons_false_positive
fix absurd extreme comparisons false positive
2016-12-25 17:47:42 +01:00