Commit graph

64 commits

Author SHA1 Message Date
Philipp Krones
e9e7a815a7
Merge remote-tracking branch 'upstream/master' into rustup 2024-06-27 18:49:59 +02:00
vohoanglong0107
2f9f204123 feat: unnecessary_min_max lint 2024-06-20 13:57:16 +00:00
Trevor Gross
c693f31ee2 Update float tests to include f16 and f128 2024-06-19 13:30:21 -04:00
Mats Macke
0b1f09e6f7 Fixed reduction of & in cast_possible_truncation
Fixed formatting

Added tests for issue #12721

Checking for reduction on RHS
2024-04-28 16:01:33 +02:00
Francisco Salgueiro
ac225a3b1f
Fix #11738: allow cast lints in macros
Removed the `from_expansion` guard clause for cast lints, so that these warnings can be generated for internal macros.
2024-04-03 21:43:06 +01:00
y21
3930f8b45d fix infinite loop when peeling unwrap method calls 2024-03-19 00:13:18 +01:00
Philipp Krones
80c6f8ff7b Merge commit '20b085d500dfba5afe0869707bf357af3afe20be' into clippy-subtree-update 2024-05-02 17:26:44 +02:00
Philipp Krones
a5aaf33422 Merge commit 'ca3b393750ee8d870bf3215dcf6509cafa5c0445' into clippy-subtree-update 2024-04-18 17:48:52 +02:00
Philipp Krones
0ae4a048c6 Merge commit '9725c4a162502a02c1c67fdca6b797fe09b2b73c' into clippy-subtree-update 2024-04-04 19:52:55 +02:00
Philipp Krones
7be6e2178e Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into clippy-subtree-update 2024-02-27 15:50:17 +01:00
teor
6bc7c96bb3 cargo bless 2024-02-20 07:53:04 +10:00
teor
367a403367 Add test coverage for cast_sign_loss changes 2024-02-20 07:52:40 +10:00
Philipp Krones
aa220c7ee7 Merge commit '26ac6aab023393c94edf42f38f6ad31196009643' 2024-01-11 17:27:03 +01:00
J-ZhengLi
eae2317977 improve [cast_sign_loss], to skip warning on mathmatical expression that is always positive 2023-12-14 09:27:01 +08:00
Philipp Krones
772296c50e Merge commit '7671c283a50b5d1168841f3014b14000f01dd204' into clippyup 2023-09-25 11:28:58 +02:00
mojave2
3665a4102b
fix ICE by u64::try_from(<u128>) 2023-09-17 19:44:25 +08:00
Philipp Krones
cc61aeea54 Merge commit '080b587854a73f2a8cbaecff1884860a78e2ff37' into clippyup 2023-08-24 21:32:12 +02:00
Guillaume Gomez
a05d3a4137 Automatic generation of error annotations for ui tests 2023-08-22 17:18:11 +02:00
Guillaume Gomez
3a31c05578 Remove/move comments to prevent weird rustfmt wrapping 2023-08-22 17:17:48 +02:00
Oli Scherer
3d88fae050 Update ui test crate 2023-08-11 14:02:28 +00:00
Philipp Krones
cb3ecf7b79 Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup 2023-07-02 14:59:02 +02:00
Philipp Krones
6b95029f17 Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup 2023-04-11 15:31:08 +02:00
asquared31415
6681914b54 make cast_possible_wrap not lint on conversions for sizes that cannot wrap, and make it work correctly for 16 bit {u,i}size 2023-03-28 23:55:47 -04:00
J-ZhengLi
52c4dc65d9 fix [cast_possible_truncation] offering wrong suggestion when casting from float
suggest `try_into` when casting to wildcard type;
fix [`cast_possible_truncation`] suggesting useless parenthesis;

remove suggesting for float to float conversion in [`cast_possible_truncation`]

style nit
2023-03-25 09:26:43 +08:00
Philipp Krones
5c7a65251a Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup 2023-01-27 21:09:08 +01:00
xFrednet
5cb6246c3e
Address PR reivew 2023-01-12 12:37:56 +01:00
flip1995
7cd86aa1be Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup 2022-05-05 15:12:52 +01:00
Alex Macleod
4a21082da2 Fix subtraction overflow in cast_possible_truncation 2022-04-11 18:54:44 +01:00
flip1995
71131351de Merge commit '984330a6ee3c4d15626685d6dc8b7b759ff630bd' into clippyup 2022-04-08 10:06:10 +01:00
Paolo Borelli
b0edbca0e6 new lint cast_abs_to_unsigned
Add a lint to detect cast to unsigned for abs() and suggest
unsigned_abs() to avoid panic when called on MIN.
2022-04-07 11:28:14 +02:00
flip1995
35020280a0 Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup 2022-02-26 14:26:21 +01:00
Jason Newcomb
90bb7a3476 New lint cast_enum_truncation 2022-02-18 09:16:17 -05:00
Jason Newcomb
8a466454ab Lint enum-to-int casts with cast_possible_truncation 2022-02-18 09:11:15 -05:00
flip1995
e674d0a599 Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup 2021-11-04 12:52:36 +00:00
Andre Bogus
00ea73e162 avoid linting possible_truncation on bit-reducing operations 2021-10-29 21:59:24 +02:00
ThibsG
566244a8bc Do not lint when cast is coming from signum method call 2021-10-21 19:15:26 +02:00
Lzu Tao
c9bd35cac3 Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Krishna Veera Reddy
c0fb74baf5 Add widening tests for cast_sign_loss lint 2019-12-05 17:18:27 -08:00
Krishna Veera Reddy
7002a9ee83 Fix false positive with cast_sign_loss lint
`cast_sign_loss` lint incorrectly suggests that the result of
`checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot
be casted to an unsigned integer without loss.
2019-12-05 15:47:15 -08:00
HMPerson1
0e1dd65c14
Allow casts from the result of abs to unsigned 2019-10-02 17:23:54 -04:00
Philipp Hansch
2d84d0361d
Split up cast.rs tests, run-rustfix for unnecessary_cast
This splits up the cast.rs tests and enables rustfix tests for the part
of the `unnecessary_cast` lint that emits `MachineApplicable`
suggestions.

cc #3630
2019-08-04 08:24:23 +02:00
cemil
8eae2d3707 Ignore unnecessary cast if inside macro 2019-04-25 12:06:20 +02:00
Philipp Hansch
8163a1a5f8
Move two cast_lossless tests to their correct files
First part of checking off the `tests/ui/cast.rs` checkbox in #3630.
2019-04-18 06:54:32 +02:00
rink1969
d9dd008e44 casting integer literal to float is unnecessary 2019-03-14 15:53:08 +08:00
Michael Wright
3cf8c0b3b5 Fix cast_sign_loss false positive
This checks if the value is a non-negative constant before linting about
losing the sign.

Because the `constant` function doesn't handle const functions, we check if
the value is from a call to a `max_value` function directly. A utility method
called `get_def_path` was added to make checking for the function paths
easier.

Fixes #2728
2019-01-31 06:32:29 +02:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Matthias Krüger
f1d5194e3d tests: revert some changs and add further rustfmt::skip attributes. 2018-12-11 00:59:59 +01:00
Matthias Krüger
435299be30 rustfmt tests 2018-12-09 23:26:16 +01:00
Oliver Scherer
b8654eaa6c Stabilize tool lints 2018-10-11 12:16:22 +02:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00