Maxwell Anderson
183e19a1c3
Merge remote-tracking branch 'upstream/master'
2018-10-27 12:50:12 -06:00
Philipp Hansch
840e50e97f
Don't expand macro in or_fun_call suggestion
2018-10-27 15:47:56 +02:00
Philipp Hansch
af1548f58f
Don't expand macro in single_match suggestion
2018-10-27 15:47:56 +02:00
Philipp Hansch
aa7bcb9074
Don't expand macro in identity_conversion suggestion
2018-10-27 15:47:56 +02:00
Jane Lusby
19ac2e94c6
fix: correctly reconstruct raw strings
2018-10-26 09:12:01 -07:00
Jane Lusby
f9020bb2dd
fix: extra semicolon, only create callsite once
2018-10-26 09:12:01 -07:00
Jane Lusby
c209fc9349
Fix string_lit_as_bytes lint for macros
...
Prior to this change, string_lit_as_bytes would trigger for constructs
like `include_str!("filename").as_bytes()` and would recommend fixing it
by rewriting as `binclude_str!("filename")`.
This change updates the lint to act as an EarlyLintPass lint. It then
differentiates between string literals and macros that have bytes
yielding alternatives.
Closes #3205
2018-10-26 09:12:01 -07:00
bors[bot]
457e7f12e9
Merge #3355
...
3355: Lint to remove redundant `clone()`s r=oli-obk a=sinkuu
This PR adds lint `redundant_clone`. It suggests to remove redundant `clone()` that clones a owned value that will be dropped without any usage after that.
Real-world example: https://github.com/rust-lang/rust/compare/7b0735a..sinkuu:redundant_clone2
Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2018-10-26 10:36:43 +00:00
bors[bot]
ead29847ff
Merge #3357
...
3357: Check existential types in `use_self` r=oli-obk a=HMPerson1
Fixes #3231
Co-authored-by: HMPerson1 <hmperson1@gmail.com>
2018-10-26 08:48:12 +00:00
Shotaro Yamada
9a150b4aa1
Use lint_root
2018-10-26 01:16:14 +09:00
Shotaro Yamada
105ae712f4
update_references indexing_slicing
2018-10-26 01:16:14 +09:00
Shotaro Yamada
3ca0895920
Add redundant_clone lint
2018-10-26 01:15:55 +09:00
bors[bot]
a87e1b02ab
Merge #3331
...
3331: Disable arithmetic lints in constant items r=oli-obk a=pengowen123
Currently this will not catch cases in associated constants. I'm not sure whether checking spans is the best way to solve this issue, but I don't think it will cause any problems.
Fixes #1858
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
2018-10-25 09:38:00 +00:00
HMPerson1
d53e6f87e9
Add tests for more than one level of reference
2018-10-24 23:39:55 -04:00
HMPerson1
1a6bfecf38
Add test case for mem::discriminant
inside a macro
2018-10-24 23:39:55 -04:00
HMPerson1
aabf8083bd
Add lint for calling mem::discriminant
on a non-enum type
2018-10-24 23:39:54 -04:00
HMPerson1
3db14f182c
Check existential types in use_self
2018-10-24 23:32:33 -04:00
Owen Sanchez
0b9e9c9e3d
Disable arithmetic lints in constant items
2018-10-24 20:27:26 -07:00
bors[bot]
4c6201dceb
Merge #3312
...
3312: OUT_OF_BOUNDS_INDEXING false negative r=phansch a=JoshMcguigan
fixes #3102
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2018-10-24 21:17:43 +00:00
bors[bot]
bce190558f
Merge #3338
...
3338: new_ret_no_self false positives r=flip1995 a=JoshMcguigan
~~WORK IN PROGRESS~~
I plan to fix all of the false positives in #3313 in this PR, but I wanted to open it now to start gathering feedback.
In this first commit, I've updated the lint to allow tuple return types as long as `Self` shows up at least once, in any position of the tuple. I believe this is the broadest possible interpretation of what should be allowed for tuple return types, but I would certainly be okay making the lint more strict.
fixes #3313
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2018-10-24 14:42:40 +00:00
Josh Mcguigan
30ffc17ef7
new_ret_no_self added test cases
2018-10-24 06:43:21 -07:00
bors[bot]
03f8899fa5
Merge #3350
...
3350: Don't emit `new_without_default_derive` if an impl of Default exists regardless of generics r=oli-obk a=pengowen123
Fixes #2226
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
2018-10-24 07:59:06 +00:00
Owen Sanchez
50b9e7aebc
Don't emit new_without_default_derive
if an impl of Default exists
2018-10-23 20:44:31 -07:00
Maxwell Anderson
6a695ffb3d
added float support for mistyped literal lints
2018-10-23 15:54:27 -06:00
Josh Mcguigan
a624583557
new_ret_no_self added test cases
2018-10-20 06:29:17 -07:00
HMPerson1
553d01d9c7
Update ui/for_loop
test output
2018-10-19 17:17:13 -04:00
HMPerson1
2e9172aea2
Check for known array length in needless_range_loop
2018-10-19 16:34:16 -04:00
Josh Mcguigan
097df8f223
new_ret_no_self correct false positive on raw pointer return types
2018-10-19 05:20:33 -07:00
Josh Mcguigan
6e75050be0
new_ret_no_self correct linting of tuple return types
2018-10-19 04:55:06 -07:00
Maxwell Anderson
9f637288cf
Merge remote-tracking branch 'upstream/master'
2018-10-18 15:45:05 -06:00
Lukas Stevens
5614dcb4ea
Support multiline comments and hopefully fix panic
2018-10-18 18:57:16 +02:00
Lukas Stevens
8753e568bf
Check for comments in collapsible ifs
2018-10-18 18:00:21 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
1264bb6b7d
Merge pull request #3323 from pengowen123/fix_manual_memcpy
...
Simplify manual_memcpy suggestion in some cases
2018-10-18 09:44:24 +02:00
Philipp Hansch
284c63e84d
Merge pull request #3281 from CYBAI/redundant-match
...
Add lint for redundant pattern matching for explicit return boolean
2018-10-17 07:31:09 +02:00
CYBAI
66ae3b1249
Rename if_let_redundant_pattern_matching to redundant_pattern_matching
...
Also, making the old one deprecated
2018-10-17 11:20:42 +08:00
CYBAI
3b7c88888b
Add lint for redundant pattern matching for explicit return boolean
2018-10-17 11:14:37 +08:00
Giorgio Gambino
aa88e68902
Fix issue #3322 : reword help message for len_zero
2018-10-16 23:23:31 +02:00
Owen Sanchez
8c902d1cf2
Simplify manual_memcpy suggestion in some cases
2018-10-16 12:38:23 -07:00
Bruno Kirschner
2d8b4f3d5c
Avoid linting boxed_local
on trait implementations.
2018-10-15 20:34:45 +02:00
Josh Mcguigan
66d3672b26
out_of_bounds_indexing improved reporting of out of bounds value
2018-10-15 04:44:39 -07:00
Owen Sanchez
456843f1cd
Swap order of methods in needless_range_loop
suggestion in some cases
2018-10-14 20:14:16 -07:00
Josh Mcguigan
0f3345e8b2
OUT_OF_BOUNDS_INDEXING fix #3102 false negative
2018-10-13 13:51:53 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
601cc9d2c5
Merge pull request #3310 from JoshMcguigan/explicit_counter_loop-3308
...
explicit_counter_loop fix #3308 false positive
2018-10-13 20:11:50 +02:00
Josh Mcguigan
c6f79c7ba0
explicit_counter_loop fix #3308 false positive
2018-10-13 06:57:52 -07:00
Josh Mcguigan
3f386d33f9
new_ret_no_self test remove tool lints cfg flag
2018-10-13 06:33:46 -07:00
Josh Mcguigan
348d18ebd8
Removed new_ret_no_self tests from method.rs
2018-10-13 06:25:10 -07:00
Josh Mcguigan
a5e4805ecf
new_ret_no_self correctly lint impl return
2018-10-13 06:20:39 -07:00
Josh Mcguigan
1c4fa419f3
new_ret_no_self fix false positive for impl trait return with associated type self
2018-10-13 06:20:39 -07:00
Josh Mcguigan
13ce96c4bf
new_ret_no_self corrected panic and added test stderr
2018-10-13 06:20:39 -07:00
Josh Mcguigan
eb854b233c
new_ret_no_self added positive test cases
2018-10-13 06:20:39 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
8b12eee112
Merge pull request #3233 from rust-lang-nursery/unused-unit
...
new lint: unused_unit
2018-10-13 09:30:19 +02:00
Andre Bogus
e8687a6677
unused unit lint
2018-10-13 00:42:55 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
d445dbfe16
Merge pull request #3291 from JoshMcguigan/cmp_owned-3289
...
cmp_owned wording and false positive
2018-10-12 15:07:12 +02:00
Josh Mcguigan
c9718fa589
cmp_owned correct error message if rhs is deref
2018-10-12 04:34:41 -07:00
Maxwell Anderson
63fbeaab68
Merge remote-tracking branch 'upstream/master'
2018-10-11 22:16:05 -06:00
Maxwell Anderson
9fad38dca9
tmp progress
2018-10-11 22:15:01 -06:00
Josh Mcguigan
0b65462ca5
cmp_owned current suggestion for multiple deref
2018-10-11 05:03:02 -07:00
Oliver Scherer
9d3373137b
Remove now-useless allow(unknown_lints)
2018-10-11 12:18:27 +02:00
Oliver Scherer
b8654eaa6c
Stabilize tool lints
2018-10-11 12:16:22 +02:00
mikerite
31eb3b73d3
Merge pull request #3127 from mikerite/fix-2937
...
Fix 2937
2018-10-11 06:22:02 +02:00
Karim SENHAJI
f9e4f5695d
Limit commutative assign op lint to primitive types
2018-10-10 19:10:44 +02:00
Josh Mcguigan
d41615548e
cmp_owned add test for multiple dereference
2018-10-10 04:51:06 -07:00
Michael Wright
7499cb543d
Fix #2937
2018-10-10 07:52:58 +02:00
Josh Mcguigan
b0d7aea946
Fixes 3289, cmp_owned wording and false positive
2018-10-09 19:25:03 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
f6882ede4d
Merge pull request #3287 from JoshMcguigan/cmp_owned-2925
...
cmp_owned false positive
2018-10-09 10:01:31 +02:00
Josh Mcguigan
ad5c29a445
Fixes #2925 cmp_owned false positive
2018-10-08 19:04:29 -07:00
Matthias Krüger
a578cb2d62
if_let_redundant_pattern_matching: use Span.to() instead of Span.with_hi() to fix crash.
...
Fixes #3064
2018-10-08 17:34:43 +02:00
Rotem Yaari
1ef32e4096
Improve diagnostics in case of lifetime elision ( closes #3284 )
2018-10-08 13:07:21 +03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
02705d4cf5
Merge pull request #3282 from JoshMcguigan/excessive_precision-2840
...
Fix excessive_precision false positive
2018-10-08 08:24:13 +02:00
Ryan Cumming
9bd4e5469e
Don't suggest cloned() for map Box deref
...
Boxes are a bit magic in that they need to use `*` to get an owned value
out of the box. They implement `Deref` but that only returns a
reference. This means an easy way to convert an `Option<Box<T>>` to an
`<Option<T>` is:
```
box_option.map(|b| *b)
```
However, since b36bb0a6
the `map_clone` lint is detecting this as an
attempt to copy the box. Fix by excluding boxes completely from the
deref part of this lint.
Fixes #3274
2018-10-08 06:20:32 +11:00
Josh Mcguigan
8a77a25b8a
Fix excessive_precision false positive
2018-10-07 11:38:20 -07:00
Philipp Hansch
63ceabf0cf
Merge pull request #3280 from d-dorazio/fix-new_without_default-should-not-fire-unsafe-new
...
new_without_default should not warn about unsafe new
2018-10-07 13:09:37 +01:00
Philipp Hansch
d365742bc6
Fix FP in fn_to_numeric_cast_with_truncation
...
We only want this lint to check casts to numeric, as per the lint title.
Rust already has a built-in check for all other casts
[here][rust_check].
[rust_check]: 5472b0718f/src/librustc_typeck/check/cast.rs (L430-L433)
2018-10-07 12:50:36 +02:00
Daniele D'Orazio
59c4ff77f1
new_without_default should not warn about unsafe new
2018-10-07 12:39:54 +02:00
Manish Goregaokar
e9c025ea70
Add license header to Rust files
2018-10-06 09:43:08 -07:00
Manish Goregaokar
75965030c7
Merge pull request #3251 from rust-lang-nursery/relicense-rewrite
...
[do not merge] Relicensing rewrite
2018-10-05 20:14:55 +02:00
Philipp Hansch
8407957ec6
Fix fn_to_numeric_cast UI tests
...
This collapses both lint tests into one file.
Somehow allowing the other lint in the respective files did not work
correctly. Maybe that's fixed as part of fixing #3198 .
2018-10-05 07:49:08 +02:00
Philipp Hansch
1544a1a681
Merge remote-tracking branch 'origin/master' into relicense-rewrite
2018-10-05 07:18:24 +02:00
Joel Gallant
163780ee0b
Solves #3222 by checking the BareFnTy Abi type
2018-10-04 18:49:03 -06:00
Philipp Hansch
8b3d2073fa
Only run tests if pointer width is 64bit
...
If the pointer width of the architechture is 32bit or something else,
then the tests will most likely produce different results.
2018-10-04 22:26:54 +02:00
Philipp Hansch
c0ab8b2531
Reimplement the fn_to_numeric_cast_with_truncation
lint
2018-10-04 21:44:16 +02:00
mcarton
5173ed0c03
Don't suggest to_string().to_string
in USELESS_FORMAT
2018-10-03 20:59:59 +02:00
Philipp Hansch
f42272102a
Reimplement the fn_to_numeric_cast
lint
2018-10-03 12:02:06 +02:00
mcarton
7eebd5b20c
Ignore format!
with precision in USELESS_FORMAT
2018-10-02 23:57:22 +02:00
mcarton
d18c7b2722
Add test for variable width in USELESS_FORMAT
2018-10-02 23:54:50 +02:00
Oliver Schneider
b36bb0a68d
Reimplement the map_clone
lint from scratch
2018-10-02 15:13:43 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
11cc8472a9
Merge pull request #3245 from JoshMcguigan/wrong_self_convention-1530
...
Correct false positive in wrong_self_convention lint for to_mut
2018-10-02 14:54:36 +02:00
Josh Mcguigan
f142098474
Correct false positive in wrong_self_convention lint for to_mut
2018-10-02 04:47:38 -07:00
Manish Goregaokar
057243f16b
relicensing: Remove map_clone
...
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/427
2018-10-02 12:51:38 +02:00
Manish Goregaokar
fffcd093b2
relicensing: Remove fn_to_numeric_cast, fn_to_numeric_cast_with_truncation
...
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/2814
2018-10-02 12:49:27 +02:00
Manish Goregaokar
902aca70bd
Merge pull request #3243 from flip1995/appveyor_disable_dogfood
...
Disable dogfood under windows until rust-lang-nursery/rustup.rs#1499 is merged
2018-10-02 12:20:14 +02:00
Philipp Hansch
eb5f146f14
Fix 'impossible case reached' ICE
2018-10-01 22:34:52 +02:00
flip1995
14335f372b
Disable dogfood until rust-lang-nursery/rustup.rs#1499 is merged
2018-09-30 12:59:15 +02:00
Michael Wright
50133fbd3a
Merge branch 'master' into unnecessary_filter_map
2018-09-30 06:39:56 +02:00
Josh Mcguigan
e25f884e6f
Fixes #3180 , suppress excessive_precision lint for floats with no decimal part
2018-09-29 07:39:30 -07:00
Michael Wright
c2ee9c29ab
Merge branch 'master' into unnecessary_filter_map
2018-09-29 15:27:47 +02:00
Michael Wright
db5c63b77a
Move tests into separate file
2018-09-29 13:57:04 +02:00
Philipp Hansch
8e808664fa
Merge pull request #3178 from ms2300/bad_unwrap
...
Fix for bad get unwrap suggestion
2018-09-28 07:38:00 +01:00
Michael Wright
2f364d9ac5
Merge branch 'master' into unnecessary_filter_map
2018-09-27 06:12:01 +02:00
Matthias Krüger
41d3df7321
tests: dogfood: extend to run with --all-features and clippy::internal enabled.
...
Run it on rustc_tools_util and clippy_dev as well.
2018-09-26 12:32:20 +02:00