Commit graph

12520 commits

Author SHA1 Message Date
Nathaniel Hamovitz
523b013161 Implement getting an array of attributes! 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
7ee8e7a9b8 Implement detecting trailing zero-sized array 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
92d3b775bd ayy it compiles! ship it, right? 😎 /s
why was `rustc_lint_defs` not already externed in `lib.rs`?
and how was r-a able to find it but cargo wasn't? 🤔
2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
c69387a0d5 Well it builds 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
797507c583 Add boilerplate and basic tests 2021-10-18 03:05:18 -07:00
bors
389a74b31a Auto merge of #7835 - mikerite:unneeded-allow-20211018, r=xFrednet
Remove unneeded allow

Remove unneeded allow

changelog: none
2021-10-18 07:25:12 +00:00
Michael Wright
63d715209e Remove unneeded allow 2021-10-18 08:46:11 +02:00
bors
af85240049 Auto merge of #7832 - narpfel:implicit-saturating-sub-false-positive-else, r=giraffate
Fix false positive of `implicit_saturating_sub` with `else` clause

Fixes #7831

changelog: Fix false positive of [`implicit_saturating_sub`] with `else` clause
2021-10-18 00:22:48 +00:00
Paul Gey
a550133b8f Fix false positive of implicit_saturating_sub with else clause
Fixes #7831
2021-10-17 15:56:59 +02:00
bors
d50cfd26e5 Auto merge of #7827 - zvavybir:master, r=xFrednet
Fixed naive doc formatting for `#[must_use]` lints

The documentation of a few lints around the `#[must_use]` attribute had a few times "[`#[must_use]`]" (without the parentheses, but with the `[]`) and once the "`" was missing.

changelog: Fixed naive doc formatting for `#[must_use]` lints ([`must_use_unit`], [`double_must_use`], [`must_use_candidate`], [`let_underscore_must_use`])
2021-10-16 19:07:37 +00:00
Matthias Kaak
25ff7ce128 Fixed naive doc formatting for #[must_use] lints 2021-10-16 15:26:47 +00:00
bors
e1871ba0da Auto merge of #7743 - smoelius:master, r=camsteffen
Add `format_in_format_args` and `to_string_in_format_args` lints

Fixes #7667 and #7729

I put these in `perf` since that was one of `@jplatte's` suggestions, and `redundant_clone` (which I consider to be similar) lives there as well.

However, I am open to changing the category or anything else.

r? `@camsteffen`

changelog: Add `format_in_format_args` and `to_string_in_format_args` lints
2021-10-15 17:05:13 +00:00
Samuel E. Moelius III
75e9f8cbd6 Remove redundant to_strings 2021-10-15 12:44:49 -04:00
Samuel E. Moelius III
47014d81a1 Fix adjacent tests 2021-10-15 12:44:49 -04:00
Samuel E. Moelius III
c9599d79a3 Add format_in_format_args and to_string_in_format_args lints
Fixes #7667 and #7729
2021-10-15 12:44:38 -04:00
bors
db403bb889 Auto merge of #7823 - mikerite:match-overlapping-arm-20211015, r=xFrednet
Some small improvements to the `match_overlapping_arm` tests

changelog: none
2021-10-15 12:42:16 +00:00
bors
70f36e0454 Auto merge of #7824 - dswij:unnecessary_sort_by, r=llogiq
`unnecessary_sort_by` checks if argument implements `Ord` trait

closes #7822

changelog: [`unnecessary_sort_by`] now checks if argument implements `Ord` trait
2021-10-15 11:16:57 +00:00
dswij
e4ac4c2e1a Add test on unnecessary_sort_by when argument does not implement Ord 2021-10-15 18:12:47 +08:00
dswij
ec5071931e unnecessary_sort_by only warns if argument impl Ord trait 2021-10-15 18:10:55 +08:00
Michael Wright
28a249b53e Add unbounded pats to match_overlapping_arm tests 2021-10-15 06:25:11 +02:00
Michael Wright
e664a76add Refactor overlapping arm tests
Make the `println!`s match the patterns. Currently they are using the
deprecated syntax for inclusive ranges and extra spacing.
2021-10-15 06:20:28 +02:00
bors
4996e17b14 Auto merge of #7815 - nhamovitz:patch-1, r=giraffate
Fix typo in example for `match_result_ok`

changelog: Fix typo in example for ``[`match_result_ok`]``
2021-10-13 23:44:42 +00:00
bors
b9b11a96d2 Auto merge of #7805 - aDotInTheVoid:transmute-num-bits, r=camsteffen
Add lint transmute_num_to_bytes

Closes #7803

changelog: [`transmute_num_to_bytes`] new lint
2021-10-13 19:40:33 +00:00
nhamovitz
09aa4ad6dc
Fix typo in example for match_result_ok 2021-10-13 12:12:46 -07:00
Nixon Enraght-Moony
58969807ab Add lint transmute_num_to_bytes
Closes #7803

changelog: [`transmute_num_to_bytes`] new lint
2021-10-13 20:05:05 +01:00
bors
57dc0343bd Auto merge of #7788 - flip1995:eq_if_let_sugg, r=giraffate
Do not expand macros in equatable_if_let suggestion

Fixes #7781

Let's use Hacktoberfest as a motivation to start contributing PRs myself again :)

changelog: [`equatable_if_let`]: No longer expands macros in the suggestion
2021-10-13 12:04:57 +00:00
bors
3d9c4a655b Auto merge of #7682 - Qwaz:uninit_vec, r=xFrednet
Implement uninit_vec lint

changelog: add the new lint [`uninit_vec`]

Fix #7681
2021-10-12 21:04:13 +00:00
Yechan Bae
4ed3a4fe2f Update lint description for new() and default() 2021-10-12 16:02:13 -04:00
bors
d3905af454 Auto merge of #7806 - Serial-ATA:lint-match-case-mismatch, r=llogiq
Add match_str_case_mismatch lint

changelog: Added a new lint [`match_str_case_mismatch`]

Fixes #7440
2021-10-12 18:39:09 +00:00
bors
5c97b27825 Auto merge of #7808 - Veykril:patch-1, r=xFrednet
Bring [`manual_split_once`] docs in line with other lint docs

changelog: none
2021-10-12 11:42:23 +00:00
Serial
0c99de0ab2 Add a suggestion 2021-10-12 07:13:19 -04:00
Lukas Wirth
5adf17cb43
Bring manual_split_once docs in line with other lint docs 2021-10-12 09:42:42 +02:00
Serial
99bfee7201 Don't run examples 2021-10-11 20:40:13 -04:00
Serial
9e0ce14700 Add match_str_case_mismatch lint 2021-10-11 20:19:34 -04:00
bors
77dda9c6b1 Auto merge of #7791 - JamesHinshelwood:reason-in-disallowed-type, r=giraffate
Allow giving reasons for `disallowed_types`

Similar to #7609 but for the `disallowed_type` lint. The permitted form of configuration is the same as for `disallowed_methods`.

changelog: Allow giving reasons for [`disallowed_type`]
2021-10-12 00:17:37 +00:00
bors
72723663a3 Auto merge of #7793 - mikerite:new_lint-msrv-2, r=Manishearth
Add option to `new_lint` to generate MSRV enabled lint

changelog: none
2021-10-11 17:41:00 +00:00
James Hinshelwood
886cbb1882
Rename disallowed to conf_disallowed
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
2021-10-11 08:29:56 +01:00
James Hinshelwood
857a4073b8
Add reason config example for disallowed_type
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
2021-10-11 08:29:41 +01:00
bors
bc9ad848eb Auto merge of #7795 - ThibsG:MutMut6922, r=giraffate
Fix FP in external macros for `mut_mut` lint

Fix FP in `mut_mut` lint when type is defined in external macros.

fixes: #6922

changelog: [`mut_mut`] Fix FP when type is defined in external macros
2021-10-11 01:14:53 +00:00
bors
9205e3d800 Auto merge of #7800 - 1nF0rmed:no-lint-in-match-single-amp, r=llogiq
Refactor `clippy::match_ref_pats` to check for multiple reference patterns

fixes #7740

When there is only one pattern, to begin with, i.e. a single deref(`&`), then in such cases we suppress `clippy::match_ref_pats`.
This is done by checking the count of the reference pattern and emitting `clippy::match_ref_pats` when more than one pattern is present.

Removed certain errors in the `stderr` tests as they would not be triggered.

changelog: Refactor `clippy::match_ref_pats` to check for multiple reference patterns
2021-10-10 11:13:05 +00:00
1nF0rmed
1080f6c70c Adds additional tests for lint 2021-10-10 14:46:28 +05:30
1nF0rmed
fc32425521 Refactor to check for multiple reference patterns 2021-10-09 22:30:12 +05:30
ThibsG
1e18b8a269 Fix FP in external macros for mut_mut lint 2021-10-09 15:54:16 +02:00
bors
8f1555f123 Auto merge of #7794 - ThibsG:FieldReassignDefault6312, r=llogiq
Fix false positive when `Drop` and `Copy` involved in `field_reassign_with_default` lint

Fix FP in `field_reassign_with_default` lint when type implements `Drop` but not all fields are `Copy`.

fixes: #6312

changelog: [`field_reassign_with_default`] Fix FP when `Drop` and `Copy` are involved
2021-10-09 13:44:36 +00:00
ThibsG
7aaed02b8c Fix false positive when Drop and Copy involved 2021-10-09 14:56:33 +02:00
Yechan Bae
03fed75c89 Address internal lints 2021-10-09 05:59:53 -04:00
Yechan Bae
2181387c3a Improved error message for set_len() on empty Vec 2021-10-09 05:47:07 -04:00
Yechan Bae
de0d2b1500 Add testcases 2021-10-09 05:47:07 -04:00
Yechan Bae
b1aa3064b6 Address PR comments 2021-10-09 05:47:06 -04:00
Yechan Bae
dd9c8d32f2 Extract get_vec_init_kind and share it 2021-10-09 05:43:58 -04:00