]>
git.lizzy.rs Git - rust.git/log
Nathaniel Hamovitz [Tue, 19 Oct 2021 00:18:07 +0000 (17:18 -0700)]
Revert "!: this is the commit that demonstrates the ICE"
This reverts commit
d85f903c91d909534003ee2ff0e16316b20687dc .
Nathaniel Hamovitz [Tue, 19 Oct 2021 00:07:51 +0000 (17:07 -0700)]
!: this is the commit that demonstrates the ICE
Nathaniel Hamovitz [Mon, 18 Oct 2021 23:53:17 +0000 (16:53 -0700)]
Don't need `rustc_attr` anymore
Nathaniel Hamovitz [Mon, 18 Oct 2021 23:53:05 +0000 (16:53 -0700)]
Improve help message
Nathaniel Hamovitz [Mon, 18 Oct 2021 22:33:11 +0000 (15:33 -0700)]
All five `has_repr_attr` agree + are correct
Nathaniel Hamovitz [Mon, 18 Oct 2021 14:02:00 +0000 (07:02 -0700)]
Exploring emitting other sorts of `span`s
Nathaniel Hamovitz [Mon, 18 Oct 2021 11:59:03 +0000 (04:59 -0700)]
Better testcase names
Nathaniel Hamovitz [Mon, 18 Oct 2021 11:22:43 +0000 (04:22 -0700)]
One more test
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:56:49 +0000 (03:56 -0700)]
Still renaming lmao
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:52:57 +0000 (03:52 -0700)]
Improve doc and span messages
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:52:37 +0000 (03:52 -0700)]
Rename stderr
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:45:08 +0000 (03:45 -0700)]
Rename lint
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:16:10 +0000 (03:16 -0700)]
run rustfmt
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:13:48 +0000 (03:13 -0700)]
Tidy import + update expected stderr
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:04:50 +0000 (03:04 -0700)]
Tidy imports
Nathaniel Hamovitz [Mon, 18 Oct 2021 10:03:48 +0000 (03:03 -0700)]
Check for tuple structs
Nathaniel Hamovitz [Mon, 18 Oct 2021 07:51:30 +0000 (00:51 -0700)]
Refactor ZS array detection again and this one seems great 👍
Nathaniel Hamovitz [Mon, 18 Oct 2021 00:28:45 +0000 (17:28 -0700)]
update testsuite and expand `if_chain`
Nathaniel Hamovitz [Sun, 17 Oct 2021 05:03:08 +0000 (22:03 -0700)]
Tidy comments + tests; revert 'size-is-zero' detection
Nathaniel Hamovitz [Sun, 17 Oct 2021 00:49:13 +0000 (17:49 -0700)]
tried to simplify but it doesn't work :/
Nathaniel Hamovitz [Sat, 16 Oct 2021 23:13:14 +0000 (16:13 -0700)]
intermediate step
Nathaniel Hamovitz [Sat, 16 Oct 2021 22:26:10 +0000 (15:26 -0700)]
add multiple `get_attrs` and `includes_repr` and they all work!
Nathaniel Hamovitz [Sat, 16 Oct 2021 09:26:08 +0000 (02:26 -0700)]
Ran `dev bless`!
Nathaniel Hamovitz [Sat, 16 Oct 2021 09:01:17 +0000 (02:01 -0700)]
output looks fantastic
Nathaniel Hamovitz [Sat, 16 Oct 2021 07:51:09 +0000 (00:51 -0700)]
it works i think (incl some `dbg`s)
Nathaniel Hamovitz [Sat, 16 Oct 2021 06:44:39 +0000 (23:44 -0700)]
Implement getting an array of attributes!
Nathaniel Hamovitz [Fri, 15 Oct 2021 23:16:27 +0000 (16:16 -0700)]
Implement detecting trailing zero-sized array
Nathaniel Hamovitz [Fri, 15 Oct 2021 08:31:26 +0000 (01:31 -0700)]
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? 🤔
Nathaniel Hamovitz [Fri, 15 Oct 2021 07:13:42 +0000 (00:13 -0700)]
Well it builds
Nathaniel Hamovitz [Fri, 15 Oct 2021 03:08:38 +0000 (20:08 -0700)]
Add boilerplate and basic tests
bors [Mon, 18 Oct 2021 07:25:12 +0000 (07:25 +0000)]
Auto merge of #7835 - mikerite:unneeded-allow-
20211018 , r=xFrednet
Remove unneeded allow
Remove unneeded allow
changelog: none
Michael Wright [Mon, 18 Oct 2021 06:46:11 +0000 (08:46 +0200)]
Remove unneeded allow
Matthias Krüger [Mon, 18 Oct 2021 06:13:30 +0000 (08:13 +0200)]
Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiser
rustc_span: `Ident::invalid` -> `Ident::empty`
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
bors [Mon, 18 Oct 2021 00:22:48 +0000 (00:22 +0000)]
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
Vadim Petrochenkov [Sun, 17 Oct 2021 20:20:30 +0000 (23:20 +0300)]
rustc_span: `Ident::invalid` -> `Ident::empty`
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
Dmitry Borodin [Sun, 17 Oct 2021 16:59:36 +0000 (18:59 +0200)]
Add reference to another doc with explanation
Add reference to another doc that explains which repository should be passed in this command since this is not covered in the command help itself.
Matthias Krüger [Sun, 17 Oct 2021 16:18:59 +0000 (18:18 +0200)]
Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisa
Some "parenthesis" and "parentheses" fixes
"Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that.
Inspired by #89958
Paul Gey [Sun, 17 Oct 2021 13:56:59 +0000 (15:56 +0200)]
Fix false positive of `implicit_saturating_sub` with `else` clause
Fixes #7831
r00ster91 [Sun, 17 Oct 2021 10:04:01 +0000 (12:04 +0200)]
Some "parenthesis" and "parentheses" fixes
bors [Sat, 16 Oct 2021 19:07:37 +0000 (19:07 +0000)]
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`])
Matthias Kaak [Sat, 16 Oct 2021 15:23:34 +0000 (15:23 +0000)]
Fixed naive doc formatting for `#[must_use]` lints
bors [Fri, 15 Oct 2021 17:05:13 +0000 (17:05 +0000)]
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
Samuel E. Moelius III [Thu, 30 Sep 2021 11:38:03 +0000 (07:38 -0400)]
Remove redundant `to_string`s
Samuel E. Moelius III [Thu, 30 Sep 2021 11:40:46 +0000 (07:40 -0400)]
Fix adjacent tests
Samuel E. Moelius III [Thu, 30 Sep 2021 11:45:03 +0000 (07:45 -0400)]
Add `format_in_format_args` and `to_string_in_format_args` lints
Fixes #7667 and #7729
bors [Fri, 15 Oct 2021 12:42:16 +0000 (12:42 +0000)]
Auto merge of #7823 - mikerite:match-overlapping-arm-
20211015 , r=xFrednet
Some small improvements to the `match_overlapping_arm` tests
changelog: none
bors [Fri, 15 Oct 2021 11:16:57 +0000 (11:16 +0000)]
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
dswij [Fri, 15 Oct 2021 10:06:02 +0000 (18:06 +0800)]
Add test on `unnecessary_sort_by` when argument does not implement `Ord`
dswij [Fri, 15 Oct 2021 10:00:02 +0000 (18:00 +0800)]
`unnecessary_sort_by` only warns if argument impl `Ord` trait
Cameron Steffen [Thu, 14 Oct 2021 18:28:30 +0000 (13:28 -0500)]
Fix clippy with changed macro statement spans
Michael Wright [Fri, 15 Oct 2021 04:25:11 +0000 (06:25 +0200)]
Add unbounded pats to `match_overlapping_arm` tests
Michael Wright [Fri, 15 Oct 2021 04:20:28 +0000 (06:20 +0200)]
Refactor overlapping arm tests
Make the `println!`s match the patterns. Currently they are using the
deprecated syntax for inclusive ranges and extra spacing.
bors [Wed, 13 Oct 2021 23:44:42 +0000 (23:44 +0000)]
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`]``
bors [Wed, 13 Oct 2021 19:40:33 +0000 (19:40 +0000)]
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
nhamovitz [Wed, 13 Oct 2021 19:12:46 +0000 (12:12 -0700)]
Fix typo in example for `match_result_ok`
Nixon Enraght-Moony [Mon, 11 Oct 2021 22:46:49 +0000 (23:46 +0100)]
Add lint transmute_num_to_bytes
Closes #7803
changelog: [`transmute_num_to_bytes`] new lint
bors [Wed, 13 Oct 2021 12:04:57 +0000 (12:04 +0000)]
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
Oli Scherer [Wed, 13 Oct 2021 11:06:14 +0000 (11:06 +0000)]
Update clippy ui output
bors [Tue, 12 Oct 2021 21:04:13 +0000 (21:04 +0000)]
Auto merge of #7682 - Qwaz:uninit_vec, r=xFrednet
Implement uninit_vec lint
changelog: add the new lint [`uninit_vec`]
Fix #7681
Yechan Bae [Tue, 12 Oct 2021 20:01:58 +0000 (16:01 -0400)]
Update lint description for new() and default()
bors [Tue, 12 Oct 2021 18:39:09 +0000 (18:39 +0000)]
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
bors [Tue, 12 Oct 2021 11:42:23 +0000 (11:42 +0000)]
Auto merge of #7808 - Veykril:patch-1, r=xFrednet
Bring [`manual_split_once`] docs in line with other lint docs
changelog: none
Serial [Tue, 12 Oct 2021 11:13:19 +0000 (07:13 -0400)]
Add a suggestion
bors [Tue, 12 Oct 2021 09:43:37 +0000 (09:43 +0000)]
Auto merge of #89770 - jkugelman:must-use-from-and-into, r=joshtriplett
Add #[must_use] to From::from and Into::into
Risk of churn: **High**
Magic 8-Ball says: **Outlook not so good**
I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.
Parent issue: #89692
r? `@joshtriplett`
Lukas Wirth [Tue, 12 Oct 2021 07:42:42 +0000 (09:42 +0200)]
Bring `manual_split_once` docs in line with other lint docs
Serial [Tue, 12 Oct 2021 00:40:13 +0000 (20:40 -0400)]
Don't run examples
Serial [Tue, 12 Oct 2021 00:19:34 +0000 (20:19 -0400)]
Add match_str_case_mismatch lint
bors [Tue, 12 Oct 2021 00:17:37 +0000 (00:17 +0000)]
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`]
John Kugelman [Mon, 11 Oct 2021 14:13:50 +0000 (10:13 -0400)]
Add #[must_use] to From::from and Into::into
bors [Mon, 11 Oct 2021 17:41:00 +0000 (17:41 +0000)]
Auto merge of #7793 - mikerite:new_lint-msrv-2, r=Manishearth
Add option to `new_lint` to generate MSRV enabled lint
changelog: none
flip1995 [Mon, 11 Oct 2021 08:10:16 +0000 (10:10 +0200)]
Deprecate mem_discriminant_non_enum
This lint has been uplifted and is now included in
enum_intrinsics_non_enums.
James Hinshelwood [Mon, 11 Oct 2021 07:28:32 +0000 (08:28 +0100)]
Rename `disallowed` to `conf_disallowed`
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
James Hinshelwood [Mon, 11 Oct 2021 07:25:30 +0000 (08:25 +0100)]
Add reason config example for disallowed_type
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
bors [Mon, 11 Oct 2021 01:14:53 +0000 (01:14 +0000)]
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
bors [Sun, 10 Oct 2021 11:13:05 +0000 (11:13 +0000)]
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
1nF0rmed [Sun, 10 Oct 2021 09:16:28 +0000 (14:46 +0530)]
Adds additional tests for lint
1nF0rmed [Sat, 9 Oct 2021 17:00:12 +0000 (22:30 +0530)]
Refactor to check for multiple reference patterns
ThibsG [Sat, 9 Oct 2021 13:54:16 +0000 (15:54 +0200)]
Fix FP in external macros for `mut_mut` lint
bors [Sat, 9 Oct 2021 13:44:36 +0000 (13:44 +0000)]
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
ThibsG [Sat, 9 Oct 2021 12:56:33 +0000 (14:56 +0200)]
Fix false positive when `Drop` and `Copy` involved
Yechan Bae [Sat, 9 Oct 2021 09:59:53 +0000 (05:59 -0400)]
Address internal lints
Yechan Bae [Thu, 7 Oct 2021 15:53:08 +0000 (11:53 -0400)]
Improved error message for set_len() on empty Vec
Yechan Bae [Thu, 7 Oct 2021 15:18:01 +0000 (11:18 -0400)]
Add testcases
Yechan Bae [Tue, 5 Oct 2021 15:43:44 +0000 (11:43 -0400)]
Address PR comments
Yechan Bae [Sun, 3 Oct 2021 04:23:57 +0000 (00:23 -0400)]
Extract get_vec_init_kind and share it
Yechan Bae [Tue, 21 Sep 2021 13:56:56 +0000 (09:56 -0400)]
Add #allow attribute to suppress FP #7698
Yechan Bae [Mon, 20 Sep 2021 19:32:53 +0000 (15:32 -0400)]
Improve error messages
Yechan Bae [Fri, 17 Sep 2021 18:42:32 +0000 (14:42 -0400)]
Handle PR feedbacks first round
Yechan Bae [Fri, 17 Sep 2021 07:27:31 +0000 (03:27 -0400)]
Fix clippy lints
Yechan Bae [Fri, 17 Sep 2021 06:55:26 +0000 (02:55 -0400)]
Implement uninit_vec lint
Michael Wright [Sat, 9 Oct 2021 03:58:05 +0000 (05:58 +0200)]
Use `indoc` for formatting
Michael Wright [Sat, 9 Oct 2021 03:58:05 +0000 (05:58 +0200)]
Fix `clippy::too-many-arguments` violation
Michael Wright [Sat, 9 Oct 2021 03:58:05 +0000 (05:58 +0200)]
Add `--msrv` option to `new_lint` command
bors [Fri, 8 Oct 2021 21:30:16 +0000 (21:30 +0000)]
Auto merge of #7789 - flip1995:double_semi_if_nothing_returned, r=camsteffen
Don't trigger semicolon_if_nothing_returned in expanded code
Fixes #7768
Before, this lint didn't trigger on macros. With rust-lang/rust#88175
this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was
introduced. This overrides the span of expanded expressions when
lowering the while loop. So if a while loop is in a macro, the
expressions that it expands to are no longer marked with
`ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is
the correct behavior and the same that is done for `ForLoop`s. It just
tripped up this lint.
r? `@camsteffen`
changelog: [`semicolon_if_nothing_returned`]: Fix regression on macros containing while loops
James Hinshelwood [Fri, 8 Oct 2021 19:45:44 +0000 (20:45 +0100)]
Allow giving reasons for `disallowed_types`
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
flip1995 [Fri, 8 Oct 2021 14:16:56 +0000 (16:16 +0200)]
Don't trigger semicolon_if_nothing_returned in expanded code
Before this lint didn't trigger on macros. With rust-lang/rust#88175
this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was
introduced. This overrides the span of expanded expressions when
lowering the while loop. So if a while loop is in a macro, the
expressions that it expands to are no longer marked with
`ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is
the correct behavior and the same that is done for `ForLoop`s. It just
tripped up this lint.
flip1995 [Fri, 8 Oct 2021 13:26:10 +0000 (15:26 +0200)]
Do not expand macros in equatable_if_let suggestion
bors [Fri, 8 Oct 2021 07:29:26 +0000 (07:29 +0000)]
Auto merge of #7748 - Serial-ATA:lint-undocumented-unsafe, r=flip1995
Add undocumented_unsafe_blocks lint
changelog: Added a new lint [`undocumented_unsafe_blocks`]
Fixes #7464, #7238 (?)
Serial [Sat, 2 Oct 2021 03:25:48 +0000 (23:25 -0400)]
Add undocumented_unsafe_blocks lint
bors [Thu, 7 Oct 2021 14:14:19 +0000 (14:14 +0000)]
Auto merge of #7705 - michaelsproul:fn_to_numeric_cast_any, r=camsteffen
Restriction lint for function pointer casts
The existing lints for function pointer casts cover the cases where a cast is non-portable or would result in truncation, however there's currently no way to forbid numeric function pointer casts entirely.
I've added a new lint `fn_to_numeric_cast_any`, which allows one to ban _all_ numeric function pointer casts, including to `usize`. This is useful if you're writing high-level Rust and want to opt-out of potentially surprising behaviour, avoiding silent bugs from forgotten parentheses, e.g.
```rust
fn foo() -> u32 {
10
}
fn main() {
let _ = foo as usize; // oops, forgot to call foo and got a random address instead!
}
```
~~I'm open to suggestions for the naming of the lint, because `fn_to_numeric_cast_any` is a bit clunky. Ideally I'd call this lint `fn_to_numeric_cast`, but that name is already taken for the more specific lint~~. We've stuck with `fn_to_numeric_cast_any` to avoid renaming the existing lint, or choosing a different name that's too generic (like `fn_cast`).
I'm also open to changing the suggestion behaviour, as adding parentheses is only one of many possible ways to fix the lint.
changelog: add ``[`fn_to_numeric_cast_any`]`` restriction lint