Commit Graph

1059 Commits

Author SHA1 Message Date
Sunjay Varma
da14435ed2 Updated clippy to account for changes from rust-lang/rust#44766 2017-10-15 15:39:47 -04:00
Yury Krivopalov
7b16f4d7ff Clarify message for erasing_op lint 2017-10-15 10:32:47 +03:00
Yury Krivopalov
a5d2bfebc4 Simplify checking for all ones in int 2017-10-15 10:21:56 +03:00
Devon Hollowood
2842038627 Improve lint description 2017-10-14 21:46:19 -03:00
Devon Hollowood
eda013d3af Change lint filename
suggest_print.rs -> explicit_write.rs
2017-10-14 21:42:14 -03:00
Devon Hollowood
aeeb38dab1 Change lint name
From `suggest_print` to `explicit_write`
2017-10-14 21:26:50 -03:00
Yury Krivopalov
033c99b1ba Add erasing_op lint
For expressions that can be replaced by a zero.
2017-10-14 12:34:37 +03:00
Yury Krivopalov
f68e408cb6 identity_op lint fix for '&' with unsigned types 2017-10-14 12:21:23 +03:00
sinkuu
c3332ca92e Fix panic with fake Range type 2017-10-13 21:51:57 +09:00
Devon Hollowood
a46bf3f456 Clarify lint description 2017-10-12 05:54:33 -03:00
Devon Hollowood
e31a0941e2 Fix output for write macros 2017-10-12 05:53:20 -03:00
Devon Hollowood
4105593eee Run rustfmt 2017-10-12 05:35:13 -03:00
Devon Hollowood
888076b698 Add suggest_print lint 2017-10-12 05:30:35 -03:00
sinkuu
31f16b87b7 Use rustc_typeck::hir_ty_to_ty 2017-10-11 23:08:36 +09:00
sinkuu
5a61d88fa1 Apply suggestions 2017-10-11 22:17:00 +09:00
Oliver Schneider
f0aa2c1587 Merge pull request #2127 from rust-lang-nursery/enum_variant_names_fp
Don't lint accidental "prefixes" on enum variants
2017-10-11 13:16:59 +02:00
Oliver Schneider
58002b0e37 Merge pull request #2119 from camsteffen/never_loop
Another never_loop fix
2017-10-11 08:21:28 +02:00
sinkuu
159cc8413c Add implicit_hasher lint (#2101) 2017-10-11 12:10:26 +09:00
Cameron Steffen
752900ca3b change expect message 2017-10-10 16:30:10 -05:00
Lukas Stevens
4438c41d14 Make suggested changes
- Fix copy-paste error
- Check for opt.map_or argument after ensuring that opt is an Option
- Use span_lint_and_then and span_suggestion
- Update reference
2017-10-10 15:35:24 +02:00
Lukas Stevens
c0fac7cf56 Remove unnecessary borrow 2017-10-10 14:04:41 +02:00
Lukas Stevens
eb53cca768 Add lint for opt.map_or(None, f)
Change to Warn and add multiline support

Fix typo

Update reference
2017-10-10 13:37:45 +02:00
Oliver Schneider
af6e2a1e4e
Don't lint accidental "prefixes" on enum variants 2017-10-10 12:37:59 +02:00
Oliver Schneider
28c401f9db Merge pull request #2118 from chyvonomys/relax-needless-loop
relax `needless_range_loop` so that it reports only direct indexing
2017-10-10 09:37:51 +02:00
Cameron Steffen
9ccb7108b5 fix never_loop 2017-10-08 17:26:39 -05:00
Cameron Steffen
533a50547f remove contains_continue functions 2017-10-08 17:24:32 -05:00
Oliver Schneider
73a1dd8e7f Merge pull request #2117 from sinkuu/improve_take_by_value
Improve needless_pass_by_value
2017-10-08 20:14:55 +02:00
Andriy S. from cobalt
52bd7bb662 relax needless_range_loop so that it reports only direct indexing 2017-10-08 18:34:31 +03:00
sinkuu
8ffec33fd3 Remove intermediate vec 2017-10-08 20:17:04 +09:00
Niklas Fiekas
e9be7530c6 Allow range_plus_one while ..= ranges are unstable 2017-10-08 12:51:00 +02:00
Niklas Fiekas
d8e01237e2 Lint range_plus_one and range_minus_one (closes #329) 2017-10-08 12:51:00 +02:00
Oliver Schneider
a54baad4fa Merge pull request #2112 from topecongiro/issue-2109
Add a suggestion to replace `map(f).unwrap_or(None)` with `and_then(f)`.
2017-10-08 11:51:15 +02:00
sinkuu
fdc9a649ff Exclude Fn traits 2017-10-08 18:04:45 +09:00
sinkuu
2be6245179 Duplicate ptr_arg's suggestion logic 2017-10-08 17:51:44 +09:00
sinkuu
bf97cd0338 Reduce false-positives for needless_pass_by_value lint
Excluding a type whose reference also fulfills the trait bound.
2017-10-08 17:25:56 +09:00
Chris Emerson
fcdce8fc1d Merge branch 'master' into no_effect_with_drop 2017-10-07 23:24:36 +01:00
Seiichi Uchida
63d6df2101 Add a comment that explains about comparing snippet to raw text 2017-10-07 00:12:30 +09:00
Seiichi Uchida
f5c941a404 Update OPTION_MAP_UNWRAP_OR lint
Add a suggestion to replace `map(f).unwrap_or(None)` with `and_then(f)`.
2017-10-06 22:06:47 +09:00
Cameron Steffen
d92d5a8811 fix never_loop 2017-10-06 00:04:39 -05:00
sinkuu
771d2220d2 Add identity_conversion lint (fixes #1051) 2017-10-04 22:16:16 +09:00
PizzaIter
47df717229 Add lints transmute_int_to_* 2017-10-03 14:27:42 +02:00
Oliver Schneider
ebc9891fc6 Merge pull request #1838 from rust-lang-nursery/fix-doc
Don't lint autolinks in `doc_markdown`
2017-09-30 17:10:09 +02:00
mcarton
aca6c1e065 Have a separate message for raw URLs in doc 2017-09-30 14:59:22 +02:00
mcarton
b10610cdeb Add the url crate as a dependency 2017-09-30 14:53:22 +02:00
mcarton
e40c270d4f Don't lint autolinks in doc_markdown 2017-09-30 14:46:55 +02:00
Laura Peskin
8e6abc6fd7 alphabetize paths to pass dogfood 2017-09-29 21:48:10 -04:00
Laura Peskin
ddad5e0f86 add tests for false positives 2017-09-29 21:01:11 -04:00
Laura Peskin
f3e51d8d65 add lint for creation of invalid references 2017-09-29 21:01:10 -04:00
mcarton
7e956ac7c4 Fix regression with print! 2017-09-29 19:13:21 +02:00
mcarton
cae9cedeb5 Fix regression with format! 2017-09-29 18:36:03 +02:00
Oliver Schneider
bc76f397c6 Merge pull request #2084 from ykrivopalov/bit_mask_verbosity_threshold
Configuration option for VERBOSE_BIT_MASK threshold
2017-09-29 08:49:27 +02:00
Manish Goregaokar
02e7fada5c Bump to 0.0.165 2017-09-28 10:44:29 -07:00
Manish Goregaokar
201b5c2f24 Use ..= in the suggestion 2017-09-28 10:40:36 -07:00
Manish Goregaokar
0ca166277c Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27) 2017-09-28 07:11:34 -07:00
Yury Krivopalov
5c56c924fc Clarify verbose_bit_mask_threshold description 2017-09-27 10:31:39 +03:00
Manish Goregaokar
387efd459c
Merge branch 'pr-1945' 2017-09-25 20:11:10 -07:00
Manish Goregaokar
15a2d1a473
Bump to 0.0.164 2017-09-25 19:56:51 -07:00
Manish Goregaokar
bebc99d893 Run prepublish script 2017-09-25 19:54:24 -07:00
Manish Goregaokar
66eea5e662
Fix dogfood needless-borrow 2017-09-25 19:52:30 -07:00
Manish Goregaokar
1b4aba47b7
Fix dogfood filter-map 2017-09-25 19:52:30 -07:00
Manish Goregaokar
2551bd8924
Reduce cyclomatic complexity of types::check_ty 2017-09-25 19:52:29 -07:00
Manish Goregaokar
fabb6b6645
Rustup to rustc 1.22.0-nightly (6c476ce46 2017-09-25) 2017-09-25 19:52:29 -07:00
Manish Goregaokar
d337c7f927
Update changelog 2017-09-25 18:43:34 -07:00
Manish Goregaokar
94c6f4a868 Pass dogfood 2017-09-25 18:39:50 -07:00
Yury Krivopalov
a3ad409341 Configuration option for VERBOSE_BIT_MASK threshold
By default is 1. u64, because I didn't figure out how to deserialize
u128 option from config.
2017-09-25 23:38:49 +03:00
Manish Goregaokar
6842a522bb Merge pull request #2079 from rust-lang-nursery/ptr_arg-vs-capacity
avoid linting `ptr_arg` if `.capacity()` is called.
2017-09-25 10:22:57 -07:00
Laura Peskin
d7867ef8c1 add lint for mutable borrow; may have false positives. pushed for feedback 2017-09-25 02:00:21 -04:00
Laura Peskin
2fe968774a replace defids with nodeids for local variables 2017-09-25 01:44:47 -04:00
Laura Peskin
c326a779dd use def_id of function in check_for_mutation 2017-09-24 15:40:17 -04:00
Laura Peskin
9a17150a06 refactor, add spans to warnings, add tests 2017-09-24 15:40:17 -04:00
Manish Goregaokar
d0eff10a7c Update test, fix lint 2017-09-24 15:40:16 -04:00
Manish Goregaokar
27d5ff6c9c Rustup 2017-09-24 15:40:16 -04:00
Laura Peskin
74f4fd32e9 attempt to add check for mutation of range bound within loop; compiles but doesn't work as intended. pushed for feedback 2017-09-24 15:40:16 -04:00
Laura Peskin
319f12a4c4 implement lint for mutable range bound 2017-09-24 15:40:16 -04:00
Laura Peskin
b091fb9b24 add lint declaration and example that should trigger the lint 2017-09-24 15:40:16 -04:00
Oliver Schneider
4ab2223e59 Merge pull request #2060 from mrecachinas/feature/int-plus-one
Addresses #1955 - Suggests >= y + 1 become > y
2017-09-24 13:57:56 +02:00
Michael Recachinas
f571cf0b5e Change rtype of int_plus_one detection to Option<String> 2017-09-24 12:31:12 +01:00
Michael Recachinas
9437d2909c Change to returning Option<(bool, Option<String>)> 2017-09-24 10:30:29 +01:00
Michael Recachinas
fff35736e4 Remove old return-value 2017-09-24 09:58:58 +01:00
Manish Goregaokar
287e997b1e Bump to 0.0.163 2017-09-23 13:36:18 -07:00
Manish Goregaokar
e3c4ec74d7 Rust upgrade to rustc 1.22.0-nightly (14039a42a 2017-09-22) 2017-09-23 13:30:29 -07:00
Michael Recachinas
21e9a1285d Use span_lint_and_then as per feedback 2017-09-23 19:32:11 +01:00
Andre Bogus
1e0268fda8 avoid linting ptr_arg if .capacity() is called. Also suggest removing .as_str() where applicable.
THis fixes #2070.

Also fixes a few formatting mishaps
2017-09-20 23:59:23 +02:00
Chris Emerson
9a0a8a0010 Move has_drop to the utils module. 2017-09-19 21:38:35 +01:00
Manish Goregaokar
31489d75a3 Bump to 0.0.162 2017-09-18 20:27:24 -07:00
Manish Goregaokar
35fa4429e3 Rust upgrade to rustc 1.22.0-nightly (0701b37d9 2017-09-18) 2017-09-18 20:23:08 -07:00
Martin Carton
0b64222a68 Fix case in doc_valid_idents
BibTeX and BibLaTeX use the usual capitalization of TeX tools:
- https://www.ctan.org/pkg/bibtex
- https://www.ctan.org/pkg/biblatex
2017-09-18 22:40:00 +02:00
Chris Emerson
f680eb164d Update unnecessary_operation and no_effect to not suggest removing
structs/enums wrappers when that type implements Drop as noted
in #2061.
2017-09-18 20:07:33 +01:00
Luca Bruno
62ae6d2251
lints/doc_markdown: add two more entries 2017-09-18 14:44:28 +00:00
Michael Recachinas
535302efda Register 'int_plus_one' lint case in clippy_lints 2017-09-17 17:27:16 +01:00
Michael Recachinas
d7ea6addf0 (#1955): Suggests x > y over x >= y + 1 for ints
This module handles the following cases:
- `... >= ... + 1` and `... >= 1 + ...`
- `... - 1 >= ...` and `-1 + ... >= ...`
- `... + 1 <= ...` and `... + 1 <= ...`
- `... <= ... - 1` and `... <= -1 + ...`

Note: this only goes 1 level deep (i.e., does not constant-fold) and
does not currently simplify expressions. Examples of these
cases include:
```rust
let x = 1;
y >= y + x; // won't catch this case or any permutation

x + 1 >= y + 2; // won't catch this case

x + 1 - 1 >= y - 1 + 1; // WILL catch this case when it likely shouldn't
```
2017-09-17 17:18:12 +01:00
Oliver Schneider
2bb8efdb4d Merge pull request #2058 from rust-lang-nursery/ptr_arg-vs-clone
add suggestions for .clone() in ptr_arg fns
2017-09-17 15:37:21 +02:00
Marcus Klaas
48ed3c058f Extend MANUAL_MEMCPY lint so that it also detects manual clones between slices 2017-09-16 19:17:22 -04:00
Marcus Klaas
e461e3f915 Format loops.rs with latest stable rustfmt 2017-09-16 18:45:28 -04:00
llogiq
708a818094 Merge pull request #2057 from topecongiro/issue-1818
Enhance CHARS_*_CMP lint
2017-09-16 09:16:55 +02:00
Andre Bogus
72be166756 add suggestions for .clone() in ptr_arg fns 2017-09-16 09:10:26 +02:00
topecongiro
81f5c69131 Enhance CHARS_*_CMP lint 2017-09-16 14:50:07 +09:00
topecongiro
197664e989 Add suggestion to needless_borrow 2017-09-16 11:27:24 +09:00
Seiichi Uchida
1f6801dd6a Add ExprLoop to contains_continue_expr() 2017-09-14 22:26:59 +09:00
Oliver Schneider
86d609fdf6
Version bump 2017-09-14 09:13:54 +02:00
Oliver Schneider
b2c88b0a35
Merge remote-tracking branch 'origin/master' into rustup 2017-09-13 15:41:09 +02:00
Oliver Schneider
32a9394490
Rustup 2017-09-13 15:34:04 +02:00
Tuomas Siipola
d768fe8c16
Fix link in trivial_regex 2017-09-12 19:08:25 +03:00
Tuomas Siipola
6d3db724b7
Fix empty documentation in unit_expr 2017-09-12 19:08:25 +03:00
Tuomas Siipola
2b698db1ae
Fix links in approx_const 2017-09-12 19:08:18 +03:00
Oliver Schneider
b7222be917
Version bump 2017-09-12 14:40:24 +02:00
Oliver Schneider
b127ad251f
Rustup 2017-09-12 14:38:59 +02:00
Andre Bogus
e7e8e79020 suggestion for ptr_arg 2017-09-10 19:32:24 +02:00
Aaron Hill
d318ced660
Add CLONE_ON_REF_PTR lint
Closes issue #1645
2017-09-09 21:52:19 -04:00
Oliver Schneider
81d32123f4
Bump version 2017-09-09 14:37:16 +02:00
Oliver Schneider
edcf6e7e80
Use hir_id instead of fetching hir_id via the NodeId 2017-09-09 14:06:41 +02:00
Aaron Hill
8adc42b5b4
Update for latest Rust
This is mainly due to https://github.com/rust-lang/rust/commit/dead08cb33134
2017-09-09 01:23:08 -04:00
Manish Goregaokar
8aa1d118b3 Merge pull request #2004 from sunfishcode/master
When suggesting `from(x)` for lossless casts, strip parens from `x`.
2017-09-05 15:09:39 -07:00
Manish Goregaokar
44b852b10e Merge pull request #2023 from montrivo/while_let_loop
`while_let_loop` doesn't take into account break-with-value #1948
2017-09-05 14:19:00 -07:00
Tim Nielens
7489a84c6a while_let_loop doesn't take into account break-with-value #1948 2017-09-05 22:28:30 +02:00
Oliver Schneider
8c824e4cbc Also ignore continue statements in is_unit_expr 2017-09-05 12:12:44 -07:00
Manish Goregaokar
7e9ba81297 for loops -> for-loops 2017-09-05 12:10:53 -07:00
Dan Gohman
396cfa7055 Only strip parens for binary expressions. 2017-09-05 10:55:08 -07:00
Dan Gohman
35cf2715dc When suggesting from(x) for lossless casts, strip parens from x. 2017-09-05 10:55:04 -07:00
Manish Goregaokar
bc602df324 Update changelog 2017-09-05 10:54:45 -07:00
Manish Goregaokar
07d5dba0b7 Update changelog 2017-09-05 09:45:14 -07:00
Marcus Klaas
90f345df94
Add lint to detect manual slice copies 2017-09-05 12:56:26 +02:00
Oliver Schneider
e4524ac4de
Run nightly rustfmt 2017-09-05 12:39:27 +02:00
M. Hasbini
ee8c51be00 Fix "further information" link
"further information" link was missing the `v` part from the url.
e.g.
wrong (404 notfound): https://rust-lang-nursery.github.io/rust-clippy/0.0.157/index.html#map_entry
correct: https://rust-lang-nursery.github.io/rust-clippy/v0.0.157/index.html#map_entry
2017-09-04 20:03:51 +03:00
Oliver Schneider
1850c89528
Version Bump 2017-09-04 17:07:19 +02:00
Oliver Schneider
7757c893ef
Fix len_zero ICE 2017-09-04 17:05:47 +02:00
Oliver Schneider
009f5aaf83
Update to latest nightly 2017-09-04 16:10:36 +02:00
Manish Goregaokar
5e1899138f
Fix dogfood 2017-09-03 14:58:27 -07:00
Manish Goregaokar
2544458559
Run rustfmt 2017-09-03 14:15:18 -07:00
Manish Goregaokar
35eda0531a
Fix unit_expr expectations and changelog entry 2017-09-03 14:14:20 -07:00
Manish Goregaokar
e56da2782c Merge branch 'pr-2016' into HEAD 2017-09-03 14:02:16 -07:00
Zaki Manian
0d9f56674d Mention the false positive 2017-09-03 14:01:29 -07:00
Manish Goregaokar
5bc0a2dbfc Bump to 0.0.156 2017-09-03 13:57:40 -07:00
Manish Goregaokar
4807909152 Rustup to rustc 1.22.0-nightly (744dd6c1d 2017-09-02) (fixes #2013) 2017-09-03 13:55:45 -07:00
Zaki Manian
8b53f2238b Fix all the clippy lints
Add false positive tests
2017-09-03 13:39:49 -07:00
Zaki Manian
6657d4e7ff Remove direct call for Deref
Remove "assigns" from the lint
2017-09-03 12:50:02 -07:00
Zaki Manian
e0caf26586 RustFmt file and tests 2017-09-03 11:19:59 -07:00
Zaki Manian
1c7583776b Don't trigger lint on break or return 2017-09-03 11:17:20 -07:00
Zaki Manian
98ec8657e4 Improve the lint message 2017-09-03 09:52:28 -07:00
Zaki Manian
0233d9b0e7 Fix false positives in assignment inside the else condition 2017-09-03 08:31:15 -07:00
Zaki Manian
93e78c81a1 RustFmt changes 2017-09-02 21:33:26 -07:00
Zaki Manian
27e55c96ce Switch back to manual deref 2017-09-02 20:45:40 -07:00
Zaki Manian
789e78e72e Improved spans for lints and support match expressions 2017-09-02 20:36:24 -07:00
Zaki Manian
34edc3f782 Handle method calls 2017-09-02 15:04:52 -07:00
Zaki Manian
e7c5825378 Fix brace indentation 2017-09-02 14:20:22 -07:00
Zaki Manian
d6d78cdbbe Check method calls 2017-09-02 14:19:45 -07:00
Zaki Manian
2a97aadacf More initial work 2017-09-02 14:09:41 -07:00
Zaki Manian
9e3be6ae49 Introduce check_stmt 2017-09-02 12:20:43 -07:00
Zaki Manian
a25a172e60 Use the type from the macro 2017-09-02 11:29:01 -07:00
Zaki Manian
f581aa7779 Initial commit of unit expr 2017-09-02 11:25:33 -07:00