Commit graph

6553 commits

Author SHA1 Message Date
xFrednet
1b91d986ea Rename clippy_utils::camal_case to clippy_utils::str_utils 2021-10-24 17:42:13 +02:00
bors
df65291edd Auto merge of #7856 - Manishearth:impl-safety, r=xFrednet
missing_safety_doc: Handle 'implementation safety' headers as well

We hit some FPs on this in `yoke`, it's somewhat normal to mark trait impl safety with "implementation safety". We could also broaden the check for headers which contain the word "safety" somehow, or split out impl safety stuff to only apply to traits.

changelog: handle 'implementation safety' headers in `missing_safety_doc`
2021-10-21 21:51:24 +00:00
Manish Goregaokar
9def82d382 use a variable 2021-10-21 14:40:33 -07:00
bors
2ba1a6a331 Auto merge of #7801 - aDotInTheVoid:empty-format, r=camsteffen
Make useless_format recognize format!("")

Closes #7796

changelog: [`useless_format`] Fix for false negitive for `format!("")`
2021-10-21 18:15:23 +00:00
bors
c97a06d9af Auto merge of #7850 - ThibsG:PossibleCastTruncation5395, r=camsteffen
Fix FP: no lint when cast is coming from `signum` method call for `cast_possible_truncation` lint

Fixes a FP when cast is coming from `signum` method call

fixes: #5395

changelog: [`cast_possible_truncation`] Fix FP when cast is coming from `signum` method call
2021-10-21 18:01:39 +00:00
Nixon Enraght-Moony
081d0f82f4 Make useless_format recognize format!("")
Closes #7796
2021-10-21 19:01:28 +01:00
ThibsG
566244a8bc Do not lint when cast is coming from signum method call 2021-10-21 19:15:26 +02:00
Manish Goregaokar
1e8d9fb18c Handle 'implementation safety' headers as well 2021-10-21 08:50:50 -07:00
flip1995
122233091a
Bump Clippy Version -> 0.1.58 2021-10-21 12:19:32 +02:00
flip1995
085181e29d
Merge remote-tracking branch 'upstream/master' into rustup 2021-10-21 12:18:12 +02:00
surechen
abb7ae9a79 Fix typo for INVALID_NULL_PTR_USAGE and MISSING_INLINE_IN_PUBLIC_ITEMS. 2021-10-21 14:33:43 +08:00
bors
300b821d51 Auto merge of #7838 - nhamovitz:trailing_zs_arr_wo_repr, r=Manishearth
Warn on structs with a trailing zero-sized array but no `repr` attribute

Closes #2868

changelog: Implement ``[`trailing_empty_array`]``, which warns if a struct is defined where the last field is a zero-sized array but there are no `repr` attributes. Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters. Either way, a `repr` attribute is needed.
2021-10-20 20:35:58 +00:00
bors
f11905af15 Auto merge of #7849 - ThibsG:SafetyDoc, r=llogiq
FIx FP in `missing_safety_doc` lint

Fix FP where lint souldn't fire if any parent has `#[doc(hidden)]` attribute

fixes: #7347

changelog: [`missing_safety_doc`] Fix FP if any parent has `#[doc(hidden)]` attribute
2021-10-20 16:46:38 +00:00
ThibsG
3630afb57f Do not lint if any parent has hidden attribute 2021-10-20 17:53:05 +02:00
Lukas Wirth
9cf68e40fe
Fix doc heading of TRANSMUTE_NUM_TO_BYTES 2021-10-20 13:46:12 +02:00
bors
06722c0c15 Auto merge of #7775 - F3real:no_effect, r=xFrednet
Detect underscored variables with no side effects

Fixes #7545

changelog: Lint on underscored variables with no side effects in [`no_effect`]
2021-10-20 09:33:45 +00:00
bors
ee8c155527 Auto merge of #7840 - dswij:question-mark-result, r=llogiq
Cover `Result` for `question_mark`

closes #7135

changelog: [`question_mark`] now covers `Result`
2021-10-20 07:27:13 +00:00
dswij
083a4546f6 Small refactor on question_mark condition checks 2021-10-20 13:41:44 +08:00
F3real
6b22bba902 Lint on underscore variable assignment
Fix tests after no_effect update

Add a drop testcase

Don't lint _ variables in macro expansion

Address review comments and update tests

Don't shadow unnecessary operation lint if no_effect is allowed

Revert shadowing change and remove no_effect allows

Update clippy_lints/src/no_effect.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Update clippy_lints/src/no_effect.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Address review comments
2021-10-20 00:39:28 +02:00
Nathaniel Hamovitz
0f9f591e30 Rename lint 2021-10-19 14:33:43 -07:00
bors
c1e7a07c9c Auto merge of #7811 - rust-lang:eq-op-testless, r=xFrednet
avoid `eq_op` in test code

Add a check to `eq_op` that will avoid linting in functions annotated with `#[test]`

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: avoid `eq_op` in test functions
2021-10-19 19:54:40 +00:00
Andre Bogus
e88c956e1e avoid eq_op in test code 2021-10-19 21:02:30 +02:00
dswij
687f3925da Cover Result for question_mark 2021-10-19 18:50:49 +08:00
Nathaniel Hamovitz
5283d24b38 formatting 🙃 2021-10-18 18:42:01 -07:00
Nathaniel Hamovitz
4c8e816972 Use real type in doc examples 2021-10-18 18:32:00 -07:00
Nathaniel Hamovitz
02b1f266d6 Remove explicit lifetime 2021-10-18 18:20:35 -07:00
Nathaniel Hamovitz
bc32be0fec Remove comment 2021-10-18 18:03:00 -07:00
Nathaniel Hamovitz
c654cc56da One more test + final tidying 2021-10-18 17:41:27 -07:00
Nathaniel Hamovitz
6303d2d075 Revert "!: this is the commit that demonstrates the ICE"
This reverts commit d85f903c91.
2021-10-18 17:18:07 -07:00
Nathaniel Hamovitz
d85f903c91 !: this is the commit that demonstrates the ICE 2021-10-18 17:07:51 -07:00
Nathaniel Hamovitz
48cf9c284a Don't need rustc_attr anymore 2021-10-18 16:53:17 -07:00
Nathaniel Hamovitz
18c863dd0e Improve help message 2021-10-18 16:53:05 -07:00
Nathaniel Hamovitz
d8bacf078a All five has_repr_attr agree + are correct 2021-10-18 15:33:11 -07:00
Nathaniel Hamovitz
3a41f226c5 Exploring emitting other sorts of spans 2021-10-18 07:02:00 -07:00
Nathaniel Hamovitz
a54dbf6445 Improve doc and span messages 2021-10-18 03:52:57 -07:00
Nathaniel Hamovitz
7f84e3d791 Rename lint 2021-10-18 03:45:08 -07:00
Nathaniel Hamovitz
149b372873 run rustfmt 2021-10-18 03:16:10 -07:00
Nathaniel Hamovitz
6377fb2fe7 Tidy import + update expected stderr 2021-10-18 03:13:48 -07:00
Nathaniel Hamovitz
cd6862283e Tidy imports 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
9f402b370c Check for tuple structs 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
2a5a4f07cf Refactor ZS array detection again and this one seems great 👍 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
c5d3167a23 update testsuite and expand if_chain 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
a3420f7004 Tidy comments + tests; revert 'size-is-zero' detection 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
9b3f55ee61 tried to simplify but it doesn't work :/ 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
5fdf93415b intermediate step 2021-10-18 03:05:19 -07:00
Nathaniel Hamovitz
003972f428 add multiple get_attrs and includes_repr and they all work! 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
b9948c4be6 Ran dev bless! 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
4b4db59772 output looks fantastic 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
e53a4da4a1 it works i think (incl some dbgs) 2021-10-18 03:05:18 -07:00
Nathaniel Hamovitz
523b013161 Implement getting an array of attributes! 2021-10-18 03:05:18 -07:00