flip1995
027780ca2c
Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup
2020-08-11 17:50:45 +02:00
Dylan DPC
9e73d33680
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
...
Clippy pointer cast lint experiment
This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html ), and figuring out how to create an instance of that type inside `clippy`.
This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064 ).
r? @oli-obk
2020-08-11 01:56:30 +02:00
Ryan1729
873e5f5c19
add allow unused_unsafe and allow dead_code
2020-08-09 00:39:14 -06:00
Ryan1729
bc8d32d36b
fix unary minus on usize and unused variable errors in .fixed file
2020-08-09 00:28:56 -06:00
Ryan1729
84db238fa1
add a test example of where transmutes_expressible_as_ptr_casts should not suggest anything
2020-08-09 00:15:56 -06:00
Ryan1729
a1ca12581a
update stderr for transmutes_expressible_as_ptr_casts
2020-08-08 21:03:41 -06:00
bors
a7fa264ae7
Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
...
Check whether locals are too large instead of whether accesses into them are too large
Essentially this stops const prop from attempting to optimize
```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```
I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).
r? @wesleywiser
2020-08-07 15:28:07 +00:00
Ryan1729
fe9ad57e98
copy over *.fixed file
2020-08-06 20:28:29 -06:00
Ryan Wiedemann
49c7e39d03
Apply suggestions from code review
...
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-08-06 07:57:31 -06:00
Ryan1729
b0c8c7af16
add newline to transmutes_expressible_as_ptr_casts.rs
2020-08-06 04:49:06 -06:00
Ryan1729
ded2d6c233
add extra error message to the expected stderr for transmutes_expressible_as_ptr_casts test
2020-08-06 04:24:25 -06:00
Ryan1729
94340d6e17
add documentation to functions that call do_check
and add a test against lint ordering changing
2020-08-06 04:24:25 -06:00
Ryan1729
ccc4747f46
get the expected number of errors by acknowledging that other lints are covering the same ground
2020-08-06 04:24:25 -06:00
Ryan1729
de05212987
try putting the can_be_expressed_as_pointer_cast at the top and find that we still get an ICE
2020-08-06 04:24:24 -06:00
Ryan1729
46ef4e8651
write currently failing test for transmutes_expressible_as_ptr_casts
...
There are 5 errors, when there should be 7.
2020-08-06 04:24:24 -06:00
Ryan1729
5e84b8c2fb
run cargo dev new_lint then move transmutes_expressible_as_ptr_casts into transmute module
2020-08-06 04:24:24 -06:00
liuzhenyu
24a6130da2
fix typos
2020-08-02 23:20:00 +08:00
Oliver Scherer
98f3c79385
Update clippy ui test.
...
The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.
2020-07-29 22:14:19 +02:00
flip1995
d164ab65f7
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
2020-07-26 21:07:07 +02:00
flip1995
6f25adbd5a
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
2020-07-14 14:59:59 +02:00
Manish Goregaokar
b57ceb45b0
Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
...
Stabilize `transmute` in constants and statics but not const fn
cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)
Previous attempt: #64011
r? @RalfJung
cc @rust-lang/wg-const-eval
2020-07-11 08:53:06 -07:00
Oliver Scherer
1eb0053dcd
Stabilize transmute
in constants and statics but not const fn
2020-07-11 09:22:17 +02:00
Tamir Duberstein
cf91c54cc6
Avoid "whitelist"
...
Other terms are more inclusive and precise.
2020-07-10 07:39:28 -04:00
Eduard-Mihai Burtescu
30c046ede4
Use 'tcx for references to AccessLevels wherever possible.
2020-07-03 00:04:48 +03:00
Dylan MacKenzie
3c5ee3300f
Update tests
2020-06-28 10:08:12 -07:00
flip1995
80bcbf521c
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup
2020-06-23 17:05:22 +02:00
Lzu Tao
c9bd35cac3
Migrate to numeric associated consts
2020-06-10 01:35:47 +00:00
Lzu Tao
8db24840f7
Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy
2020-06-09 14:36:01 +00:00
flip1995
a0e9f9bd0d
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
2020-05-28 15:45:24 +02:00
bors
8164832c4b
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
...
Stabilize fn-like proc macros in expression, pattern and statement positions
I.e. all the positions in which stable `macro_rules` macros are supported.
Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`").
cc https://github.com/rust-lang/rust/issues/54727
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446
Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503 .
2020-05-19 03:11:32 +00:00
flip1995
f1d3086492
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup
2020-05-17 17:36:26 +02:00
flip1995
d13d8987b0
Merge commit '43a1777b89cf6791f9e20878b4e5e3ae907867a5' into clippyup
2020-05-11 20:23:47 +02:00
Vadim Petrochenkov
2d10babb71
Stabilize fn-like proc macros in expression, pattern and statement positions
2020-05-03 19:24:41 +03:00
CrazyRoka
20c069beec
Fixed incorrect suggestion of clone_double_ref
lint
...
- Added `<_>` to suggestion
- Changed help message
2020-04-29 22:40:57 +03:00
flip1995
cd3480991a
Rustup to rust-lang/rust#71518
2020-04-29 15:48:43 +02:00
Eduardo Broto
fc5fc6378c
Test that we lint the awaited expression
2020-04-27 21:29:31 +02:00
Eduardo Broto
3a96f548d1
used_underscore_binding: do not lint on await
desugaring
2020-04-27 21:20:08 +02:00
bors
d13ffbe3fe
Auto merge of #5522 - CrazyRoka:match_vec_item, r=phansch
...
New lint `match_vec_item`
Added new lint to warn a match on index item which can panic. It's always better to use `get(..)` instead.
Closes #5500
changelog: New lint `match_on_vec_items`
2020-04-27 06:02:05 +00:00
Eduardo Broto
303e7d1af8
Split tests in unix/non-unix
2020-04-26 21:27:29 +02:00
Eduardo Broto
4a405c9977
Remove some OSes from the test to comply with stderr line limit
2020-04-26 21:27:29 +02:00
Eduardo Broto
ce50e42ed6
Use the span of the attribute for the error message
2020-04-26 21:27:29 +02:00
Eduardo Broto
d24a106395
Apply suggestions from PR review
...
- Show just one error message with multiple suggestions in case of
using multiple times an OS in target family position
- Only suggest #[cfg(unix)] when the OS is in the Unix family
- Test all the operating systems
2020-04-26 21:27:29 +02:00
Eduardo Broto
149f6d6046
Implement mismatched_target_os lint
2020-04-26 21:27:29 +02:00
CrazyRoka
940c662654
Small lint update
...
- Changed lint category to `correctness`
- Moved main function to bottom in test file
- Added `FIXME` comment to `span_lint_and_sugg` to improve later
2020-04-26 18:00:51 +03:00
bors
07dd5fada9
Auto merge of #5511 - alex-700:fix-redundant-pattern-matching, r=flip1995
...
Fix redundant_pattern_matching lint
fixes #5504
changelog: Fix suggestion in `redundant_pattern_matching` for macros.
2020-04-25 21:41:56 +00:00
bors
44eb953adc
Auto merge of #5525 - flip1995:issue_1654, r=phansch
...
Don't trigger while_let_on_iterator when the iterator is recreated every iteration
r? @phansch
Fixes #1654
changelog: Fix false positive in [`while_let_on_iterator`]
2020-04-25 21:29:03 +00:00
bors
a76bfd46c5
Auto merge of #5530 - ebroto:issue_5524, r=flip1995
...
map_clone: avoid suggesting `copied()` for &mut
changelog: map_clone: avoid suggesting `copied()` for &mut
Fixes #5524
2020-04-25 21:16:06 +00:00
Eduardo Broto
806d973adc
map_clone: avoid suggesting copied()
for &mut
2020-04-25 22:52:19 +02:00
Aleksei Latyshev
69fe6b4c98
fix redundant_pattern_matching lint
...
- now it gives correct suggestion in case of macros
- better tests
- remove a couple of non-relevant tests
2020-04-25 23:51:30 +03:00
Philipp Krones
9b882bab26
Rollup merge of #5523 - phansch:add-new-ret-no-self-testcase, r=flip1995
...
Add lifetime test case for `new_ret_no_self`
cc https://github.com/rust-lang/rust-clippy/issues/734#issuecomment-619344352
changelog: none
2020-04-25 21:06:31 +02:00