Commit graph

7217 commits

Author SHA1 Message Date
bors
db5739ac55 Auto merge of #8610 - SabrinaJewson:transmute-int-to-char-const, r=xFrednet
Don't warn int-to-char transmutes in const contexts

changelog: Don't warn ``[`transmute_int_to_char`]`` in const contexts

fixes: #8379
2022-03-30 20:23:03 +00:00
SabrinaJewson
d6f05c6a89
Don't warn int-to-char transmutes in const contexts 2022-03-30 18:47:50 +01:00
bors
c0a5693abc Auto merge of #8602 - giraffate:fix_ice_for_iter_overeager_cloned, r=llogiq
Fix ICE for `iter_overeager_cloned`

Fix https://github.com/rust-lang/rust-clippy/issues/8527

changelog: Fix ICE for [`iter_overeager_cloned`]
2022-03-30 17:12:24 +00:00
bors
fe7254ff6f Auto merge of #8576 - smoelius:crate_in_macro_def, r=llogiq
Add `crate_in_macro_def` lint

This PR adds a lint to check for `crate` as opposed to `$crate` used in a macro definition.

I think this can close #4798. That issue focused on the case where the macro author "imports something into said macro."

But I think use of `crate` is likely to be a bug whether it appears in a `use` statement or not. There could be some use case I am failing to see, though. (cc: `@nilscript` `@flip1995)`

changelog: `crate_in_macro_def`
2022-03-30 16:57:24 +00:00
Samuel E. Moelius III
d6eb82c0a8 Move crate_in_macro_def to suspicious 2022-03-30 12:40:53 -04:00
Samuel Moelius
75dc406e84
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:44 -04:00
Samuel Moelius
abc221e7f6
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:25 -04:00
Samuel Moelius
9b304533ab
Update clippy_lints/src/crate_in_macro_def.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-03-30 12:40:16 -04:00
bors
0031f69999 Auto merge of #8592 - c410-f3r:stuff, r=flip1995
Do not fire `panic` in a constant environment

Let rustc handle panics in constant environments.

Since https://github.com/rust-lang/rust-clippy/issues/8348 I thought that such modification would require a lot of work but thanks to https://github.com/rust-lang/rust-clippy/pull/8588 I now know that it is not the case.

changelog: [`panic`]: No longer lint in constant context. `rustc` already handles this.
2022-03-30 16:04:14 +00:00
bors
d9819c3b8d Auto merge of #8584 - Alexendoo:map-unit-fn-context, r=Manishearth
Provide suggestion context in map_unit_fn

Fixes #8569

changelog: Fix incorrect suggestion for `option_map_unit_fn` , `result_map_unit_fn`
2022-03-30 15:25:37 +00:00
Takayuki Nakata
c22b7b8814 Fix ICE for iter_overeager_cloned 2022-03-29 21:51:37 +09:00
Samuel E. Moelius III
cb307bbfcd Address review comments 2022-03-28 04:48:12 -04:00
bors
6206086dd5 Auto merge of #8487 - dswij:8478, r=giraffate
[`map_identity`] checks for needless `map_err`

Closes #8478

changelog: [`map_identity`] checks for needless `map_err`
2022-03-28 00:25:45 +00:00
bors
59c0f29916 Auto merge of #8519 - tysg:redundant-modulo, r=giraffate
Check if lhs < rhs in modulos in `identity_op`

Fixes #8508

changelog: [`identity_op`] now checks for modulos, e.g. `1 % 3`
2022-03-28 00:11:32 +00:00
Tianyi Song
52b563b283 Emit lint when rhs is negative 2022-03-27 21:49:38 +08:00
Caio
c687f6575f Do not fire panic in a constant environment 2022-03-26 15:39:21 -03:00
Alex Macleod
610db04222 Provide suggestion context in map_unit_fn 2022-03-25 20:47:54 +00:00
flip1995
1147b2c481
Merge remote-tracking branch 'upstream/master' into rustup 2022-03-24 14:22:35 +01:00
Samuel Moelius
86872059ed
Typo 2022-03-24 08:57:08 -04:00
Yoav Lavi
b60a7fb7b6
unnecessary_join lint 2022-03-24 13:18:18 +01:00
Samuel E. Moelius III
65a26692fd Add crate_in_macro_def lint 2022-03-24 05:08:10 -04:00
bors
f07ee8a998 Auto merge of #8232 - Jarcho:match_same_arm_860, r=xFrednet
`match_same_arms` fix

fixes #860
fixes #1140

changelog: Don't lint `match_same_arms` when an interposing arm's pattern would overlap
2022-03-21 20:42:51 +00:00
bors
4a07662d94 Auto merge of #8561 - FoseFx:use_unwrap_or, r=xFrednet
add `or_then_unwrap`

Closes #8557

changelog: New lint [`or_then_unwrap`]
2022-03-21 20:08:29 +00:00
J-ZhengLi
5b6295d663 allowing [map_flatten] to split long suggestions
add new function `span_lint_and_sugg_` for edges in `clippy_utils::diagnostics`
2022-03-21 14:11:22 +08:00
Max Baumann
765cce11b1
refactor: remove need for MethodCall matching 2022-03-21 00:04:37 +01:00
Max Baumann
4580c8a9b7
refactor: use is_lang_ctor() 2022-03-20 23:54:04 +01:00
Max Baumann
0f83753934
feat: change error message 2022-03-20 23:43:17 +01:00
Max Baumann
895de1f13e
feat: make fixable 2022-03-18 23:18:36 +01:00
Max Baumann
f00e844a1f
feat: use span_lint_and_sugg 2022-03-18 22:44:56 +01:00
Max Baumann
34ad33c57a
refactor: move into methods module 2022-03-18 21:11:54 +01:00
bors
a31dcb77be Auto merge of #8562 - Jarcho:enum_tuple_variant_as_int, r=Manishearth
Add lint `cast_enum_constructor`

fixes: #1116

changelog: Add lint `cast_enum_constructor`
2022-03-18 15:54:45 +00:00
bors
9fd3c2d788 Auto merge of #8543 - dswij:8393, r=giraffate
`unnecessary_lazy_eval` show suggestions on multiline lint

Closes #8393

changelog: [`unnecessary_lazy_eval`] now shows suggestions for long-line lints
2022-03-18 00:42:18 +00:00
Max Baumann
3c4192f3e9
fix: ran update_lints 2022-03-18 01:12:39 +01:00
Max Baumann
05e05eaed7
refactor: rename lint to or_then_unwrap 2022-03-18 01:04:33 +01:00
Jason Newcomb
39329d1d40 Add lint cast_enum_constructor 2022-03-17 19:57:35 -04:00
Max Baumann
44c62c9aa2
feat: add tests and fix existing ones 2022-03-18 00:51:26 +01:00
Max Baumann
17ff85081d
feat: rename variable in example 2022-03-18 00:34:24 +01:00
Max Baumann
4493fc7d27
refactor: use pattern matching for MethodCall arguments
Co-authored-by: xFrednet <xFrednet@gmail.com>
2022-03-18 00:23:55 +01:00
Max Baumann
c22ff6cd6e
fix: fix clippy_lints 2022-03-17 19:52:07 +01:00
Max Baumann
747bb245e7
fix: fix broken dogfood tests 2022-03-17 19:29:59 +01:00
Max Baumann
3f00f074de
fix: fix tests 2022-03-17 19:13:44 +01:00
Max Baumann
f49a2c3457
feat: add use_unwrap_or 2022-03-17 18:57:28 +01:00
bors
8d5c0eadde Auto merge of #8552 - Jarcho:ptr_arg_8495, r=xFrednet
Don't lint `ptr_arg` on `&mut Cow<_>`

fixes: #8495

changelog: Don't lint `ptr_arg` on `&mut Cow<_>`
2022-03-17 17:05:26 +00:00
dswij
bd888d4354 Add some comments 2022-03-17 14:38:39 +08:00
Jason Newcomb
773d20341a Fix mixed enum variant kinds + code cleanup 2022-03-17 01:09:25 -04:00
Jason Newcomb
08a7157a37 Improve message for match_single_arms 2022-03-16 13:58:09 -04:00
Jason Newcomb
4f8f4b4c82 Handle slice patterns in match_same_arms 2022-03-16 13:53:52 -04:00
Jason Newcomb
5508f461b8 Use DroplessArena when allocating ResolvedPats
Fix tuple handling in `match_same_arms`
2022-03-16 13:49:19 -04:00
Jason Newcomb
b37317b028 Check if there are any overlapping patterns between equal arm bodies in match_same_arm 2022-03-16 13:18:29 -04:00
Jason Newcomb
8e5208cbff Don't lint transmute_undefined_repr when changing the type of generic params 2022-03-16 12:56:23 -04:00