Jason Newcomb
17c8bee95a
Add a couple of examples to undocumented_unsafe_blocks
2022-04-02 00:46:45 -04:00
Peter Jaszkowiak
c70f1e0f8f
ignore &x | &y
in unnested_or_patterns
...
replacing it with `&(x | y)` is actually more characters
2022-04-01 22:36:30 -06:00
Jason Newcomb
ae5af0cd1a
Remove cargo_metadata dependency from clippy
2022-04-01 23:18:47 -04:00
bors
f6b29923c6
Auto merge of #8616 - pitaj:single_element_loop_arrays, r=llogiq
...
single_element_loop: handle arrays for Edition2021
changelog: [`single_element_loop`] handle arrays in Edition 2021, handle `.iter_mut()` and `.into_iter()`, and wrap in parens if necessary
2022-04-01 18:45:49 +00:00
Peter Jaszkowiak
3bbb3e3329
single_element_loop: handle arrays for Edition2021
...
also handle `.iter_mut()`, `.into_iter()`,
and wrapping in parens if necessary
2022-04-01 00:04:19 -06:00
SabrinaJewson
11045f94e2
Don't unnecessarily suggest unsafe block
2022-04-01 06:32:22 +01:00
SabrinaJewson
7a80c23f83
Suggest from_utf8_unchecked in const contexts
2022-03-30 21:49:13 +01:00
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
Max Baumann
e552267db3
style -> pedantic
2022-03-30 20:13:16 +02:00
Max Baumann
2953cba116
unit_like_struct_brackets -> empty_structs_with_brackets
2022-03-30 20:13:16 +02:00
Max Baumann
37d5a6264c
changes after review
2022-03-30 20:12:58 +02:00
Max Baumann
33383a418d
use span_suggestion_hidden
2022-03-30 20:12:58 +02:00
Max Baumann
7192297c28
additional checks for conditionally compiled code
2022-03-30 20:12:58 +02:00
Max Baumann
315521afc6
fix uitests
2022-03-30 20:12:58 +02:00
Max Baumann
9be3945be7
fix existing clippy tests
2022-03-30 20:12:58 +02:00
Max Baumann
528ada958b
add unit_like_struct_brackets
2022-03-30 20:12:58 +02:00
SabrinaJewson
d6f05c6a89
Don't warn int-to-char transmutes in const contexts
2022-03-30 18:47:50 +01:00
Alex Macleod
10a6d872d4
Handle relative paths in module_files lints
2022-03-30 18:44:04 +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
aaf04dc043
Fix error message in crate_in_macro_def.stderr
2022-03-30 12:52:31 -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
lcnr
104ba478f2
clippy: nameres for primitive type impls
2022-03-30 11:57:53 +02:00
lcnr
148b593954
get clippy to compile again
2022-03-30 11:23:58 +02:00
Takayuki Nakata
c22b7b8814
Fix ICE for iter_overeager_cloned
2022-03-29 21:51:37 +09:00
J-ZhengLi
448a26d696
improve parent expr check
2022-03-29 15:23:19 +08:00
Samuel E. Moelius III
cb307bbfcd
Address review comments
2022-03-28 04:48:12 -04:00
Jaic1
ec851b870b
First submit
2022-03-28 12:09:01 +08: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
bors
a7da8a6019
Auto merge of #95274 - jendrikw:slice-must-use, r=Dylan-DPC
...
add #[must_use] to functions of slice and its iterators.
Continuation of #92853 .
Tracking issue: #89692 .
2022-03-26 20:17:04 +00:00
Caio
af8ed04e09
Rustfmt
2022-03-26 15:48:17 -03:00
Caio
c687f6575f
Do not fire panic
in a constant environment
2022-03-26 15:39:21 -03:00
Jendrik
41f1413085
add #[must_use] to functions of slice and its iterators.
2022-03-26 16:19:47 +01:00
Jendrik
96f4e1c630
add #[must_use] to functions of slice and its iterators.
2022-03-26 15:37:48 +01:00
Peter Jaszkowiak
21eae8ceb6
fix indexing_slicing
with const
...
- should not fire if indexing with a constant block
- should not fire if indexing within a constant context
(const statement or const block)
2022-03-25 23:05:38 -06:00
Alex Macleod
610db04222
Provide suggestion context in map_unit_fn
2022-03-25 20:47:54 +00:00
bors
b7b0dad656
Auto merge of #95273 - flip1995:clippyup, r=manishearth
...
Update Clippy
r? `@Manishearth`
2022-03-24 22:52:34 +00:00
flip1995
1fa3d66e62
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup
2022-03-24 14:50:04 +01:00
flip1995
1147b2c481
Merge remote-tracking branch 'upstream/master' into rustup
2022-03-24 14:22:35 +01:00
Yoav Lavi
b60a7fb7b6
unnecessary_join
lint
2022-03-24 13:18:18 +01:00
Oli Scherer
6fc3850847
update clippy stderr file
2022-03-24 11:27:07 +00: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
0f83753934
feat: change error message
2022-03-20 23:43:17 +01:00
Max Baumann
20c352a4f6
test: add method chain test
2022-03-19 18:17:43 +01:00