Commit Graph

12722 Commits

Author SHA1 Message Date
bors
075996efd7 Auto merge of #7878 - rust-lang:string-slice, r=giraffate
new lint: string-slice

This is a restriction lint to highlight code that should have tests containing non-ascii characters. See #6623.

changelog: new lint: [`string-slice`]
2021-10-26 08:11:49 +00:00
Devon Hollowood
d0c04b4d78 Clean up tests/ui/rename.rs 2021-10-26 00:53:53 -07:00
Andre Bogus
999b3004c4 new lint: string-slice 2021-10-26 09:05:28 +02:00
bors
cb0132d209 Auto merge of #7865 - Herschel:fix-match-str-case-mismatch, r=xFrednet
Fix `match_str_case_mismatch` on uncased chars

False positives would result because `char::is_lowercase` and friends will return `false` for non-alphabetic chars and alphabetic chars lacking case (such as CJK scripts). Care also has to be taken for handling titlecase characters (`Dz`) and lowercased chars with no uppercase equivalent (`ʁ`).

For example, when verifying lowercase:
 * Check `!any(char::is_ascii_uppercase)` instead of `all(char::is_ascii_lowercase)` for ASCII.
 * Check that `all(|c| c.to_lowercase() == c)` instead of `all(char::is_lowercase)` for non-ASCII

Fixes #7863.

changelog: Fix false positives in [`match_str_case_mismatch`] on uncased characters
2021-10-25 21:34:11 +00:00
bors
3ef1f19d60 Auto merge of #7873 - xFrednet:7869-string-index-ice, r=Manishearth
Update `str` utils to prevent ICEs and FNs

This PR reworks some string handling for lints regarding enum naming. I hope the refactoring will prevent future ICEs and help with new bug free implementations.

It might be better to review this PR by going through the commits, as `clippy_utils::camel_case` was renamed to `clippy_utils::str_utils` and then changed further. GH sadly doesn't really make the changes that obvious 🙃

Not too much more to say. Have a nice day 🌞

---

Fixes: rust-lang/rust-clippy#7869

changelog: ICE Fix: [`enum_variant_names`] #7869
2021-10-25 19:20:05 +00:00
bors
4f46f4266a Auto merge of #7874 - xFrednet:7756-move-lint, r=llogiq
Move `non_send_fields_in_send_ty` to `suspicious`

Stabilize the `non_send_fields_in_send_ty` lint and update the lint for the `allowed_scripts` configuration.

---

closes: rust-lang/rust-clippy#7756

changelog: Move `non_send_fields_in_send_ty` to `suspicious`
2021-10-25 18:56:57 +00:00
xFrednet
1ad04f4054 Move non_send_fields_in_send_ty to suspicious
Also updated one configuration for nicer formatting
2021-10-25 19:32:17 +02:00
bors
cc2d93349a Auto merge of #7855 - flip1995:changelog, r=xFrednet
Update CHANGELOG

r? `@xFrednet`  (you showed to be a reliable reviewer for this :) )

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none
2021-10-25 11:05:25 +00:00
flip1995
949fc44ccc
Update CHANGELOG 2021-10-25 10:50:49 +02:00
bors
4064e971ac Auto merge of #7872 - calebcartwright:sync-use-new-branch, r=flip1995
recommend new branch or deleting branch when synching from rust

changelog: none

r? `@flip1995` - thanks again for your assistance in zulip earlier, figured I'd take a pass at incorporating your recommendation to delete or use a new branch into the excellent docs here
2021-10-25 08:46:51 +00:00
xFrednet
7517ae2fb3 Refactored some string handling to prevent ICEs and FNs 2021-10-24 22:47:39 +02:00
Esteban Kuber
f674e6f49c Always sort suggestions before emitting them 2021-10-24 20:28:44 +00:00
Caleb Cartwright
1b2c57c2dd
docs: recommend new branch 2021-10-24 15:14:45 -05:00
xFrednet
d38fddd899 Refactor camel_case util functions for new StrIndex 2021-10-24 21:13:43 +02:00
bors
73a443d611 Auto merge of #7871 - camsteffen:fmt-update, r=camsteffen
Update rustfmt

changelog: none

Something changed with `rustup update nightly`
2021-10-24 17:55:49 +00:00
Cameron Steffen
20fb7f2916 Update rustfmt 2021-10-24 12:52:38 -05:00
xFrednet
1b91d986ea Rename clippy_utils::camal_case to clippy_utils::str_utils 2021-10-24 17:42:13 +02:00
bors
ba0cfc7deb Auto merge of #7867 - dswij:utils-typo, r=llogiq
Fix typo on utils/lib

Found some typo when looking through `clippy_utils/src/lib.rs` 🙂

changelog: none
2021-10-23 16:09:45 +00:00
Dharma Saputra Wijaya
a5a3e6192d Fix typo on utils/lib 2021-10-23 23:42:31 +08:00
Mike Welsh
e953dff536 Fix match_str_case_mismatch false positives
Properly consider uncased and titlecased characters.
Fixes #7863.
2021-10-23 02:03:15 -07:00
Yuki Okushi
efef16f6ed Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-22 19:42:45 +09: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
6714eff09a Auto merge of #7857 - flip1995:fix_deploy, r=xFrednet
Fix deploy script

I broke this script in #7502, so that the stable symlink isn't generated
anymore. This reverts this change.

changelog: none
2021-10-21 20:54:47 +00: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
flip1995
96126e7ce9
Fix deploy script
I broke this script in #7502, so that the stable symlink isn't generated
anymore. This reverts this change.
2021-10-21 18:00:57 +02:00
Manish Goregaokar
1e8d9fb18c Handle 'implementation safety' headers as well 2021-10-21 08:50:50 -07:00
flip1995
7631fc5d82 Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup 2021-10-21 13:11:36 +02:00
bors
91496c2ac6 Auto merge of #7853 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-10-21 10:23:11 +00:00
flip1995
8e48333bf1
Bump nightly version -> 2021-10-21 2021-10-21 12:19:46 +02: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
bors
535262cc8c Auto merge of #7852 - surechen:fix_typo, r=xFrednet
Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items.

Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items.

changelog: none
2021-10-21 09:08:22 +00: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
bors
76150a4922 Auto merge of #7848 - Veykril:patch-1, r=xFrednet
Fix doc heading of `transmute_num_to_bytes`

changelog: none
2021-10-20 12:02:32 +00: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
Michael Wright
1ede540b21 Fix false positive in match_overlapping_arm
The bug was dues to the constant bytes being compared instead of their
values. This meant that negative values were being treated as larger
than some positive values.

Fixes #7829
2021-10-20 06:13:42 +02:00
Michael Wright
c4d5471a45 Add test for #7829 2021-10-20 06:13:42 +02:00
Michael Wright
4679eb3a0d Move const int value code to utils 2021-10-20 06:13:42 +02:00
bors
5bdd2cebe2 Auto merge of #7833 - Dmitry-Borodin:patch-1, r=giraffate
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.
changelog: none
2021-10-19 23:47:20 +00: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