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
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
Philipp Hansch
eb5f146f14
Fix 'impossible case reached' ICE
2018-10-01 22:34:52 +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
f5ffac4fce
Implement unnecesary_filter_map lint
2018-09-26 06:52:36 +02:00
Jane Lusby
14feb3670f
Lint for chaining flatten after map
...
This change adds a lint to check for instances of `map(..).flatten()`
that can be trivially shortened to `flat_map(..)`
Closes #3196
2018-09-24 14:29:16 -07:00
Michael Wright
ab71f08663
Fix single_char_pattern crash ( #3204 )
...
This commit fixes the crash by removing constant checking from the lint.
Closes #3204 .
2018-09-24 08:33:57 +02:00
ms2300
523ba2a009
Full fix of get unwrap issue
2018-09-23 19:53:25 -07:00
ms2300
de8d233b06
#3006 : Fixing for .get().unwrap().foo()
2018-09-23 19:53:25 -07:00
Philipp Krones
bc6d85ceaf
Merge pull request #3207 from mikerite/fix-3206
...
Fix double_parens false positive
2018-09-23 18:24:27 +02:00
Michael Wright
867ac98d38
Fix double_parens false positive
...
Closes #3206
2018-09-22 17:20:34 +02:00
Jay Kickliter
2f53aaa5bd
mem_replace: match on path.
2018-09-19 14:41:22 -07:00
Jay Kickliter
598df08d88
Add lint for mem::replace(.., None)
.
...
Suggest `Option::take()` as an alternative.
2018-09-19 14:38:34 -07:00
Eduard-Mihai Burtescu
85caaf5905
Fix useless_attribute
to also whitelist unused_extern_crates
.
2018-09-15 11:16:45 +03:00
Oliver Schneider
3e4f7fc4c0
Don't use the old feature gate
2018-09-10 15:44:41 +02:00
Philipp Krones
f30cf51a70
Merge pull request #3135 from JoshMcguigan/explicit_counter_loop-1219
...
Closes #1219 false positive for explicit_counter_loop
2018-09-09 23:49:03 +02:00
Matthias Krüger
160959d27f
add tests for #3057 and #2651
...
Fixes #3057
Fixes #2651
2018-09-08 09:04:04 +02:00
Josh Mcguigan
9168746c38
Corrected explicit_counter_loop behavior with nested loops
2018-09-07 20:46:36 -07:00
Josh Mcguigan
53c262048c
Fix #1219 false positive for explicit_counter_loop
2018-09-07 19:58:19 -07:00
flip1995
90f7997771
Add regression test
2018-09-07 17:41:03 +02:00
Josh Mcguigan
ce554267b8
Updated explicit_counter_loop tests based on discussion in #3135
2018-09-07 05:32:56 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
63a46b1e1a
Merge pull request #3129 from mipli/3091-numeric-typo
...
Add lint for misstyped literal casting
2018-09-07 09:54:43 +02:00
Josh Mcguigan
edfa9feac2
Corrected explicit_counter_loop missing lints if variable used after loop
2018-09-06 06:20:25 -07:00
Matthias Krüger
a0f56edfc3
print_with_newline / write_with_newline: don't warn about string with several \n
s in them.
...
Fixes #3126
2018-09-06 12:59:34 +02:00
Josh Mcguigan
4b668159d2
Closes #1219 false positive for explicit_counter_loop
2018-09-05 19:14:01 -07:00
Michael A. Plikk
38d287fecd
Add lint for misstyped literal casting
2018-09-05 19:46:49 +02:00
Josh Mcguigan
0f6d422817
Added test case for ptr_arg
2018-09-05 05:59:07 -07:00
daubaris
db391c4613
Merge branch 'master' of https://github.com/rust-lang-nursery/rust-clippy into range-plus-one
2018-09-04 18:52:18 +03:00