]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUse Span::from_expansion instead of in_macro
Cameron Steffen [Fri, 29 Oct 2021 16:14:22 +0000 (11:14 -0500)]
Use Span::from_expansion instead of in_macro

2 years agoAuto merge of #7928 - xFrednet:rust-90354-deploy-clippy-docs, r=flip1995
bors [Thu, 4 Nov 2021 12:27:50 +0000 (12:27 +0000)]
Auto merge of #7928 - xFrednet:rust-90354-deploy-clippy-docs, r=flip1995

Reference `clippy_utils` docs on nightly-rustc and some other documentation updates

The `clippy_utils` crate is now part of the nightly-rustc documentation. See [**very beautiful documentation**](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/). This PR references them in our documentation and updates some other documentation.

changelog: none

2 years agoAdded note about the usage of `clippy_utils::path`
xFrednet [Thu, 4 Nov 2021 12:27:08 +0000 (13:27 +0100)]
Added note about the usage of `clippy_utils::path`

2 years agoAuto merge of #7929 - flip1995:rustup, r=flip1995
bors [Thu, 4 Nov 2021 12:07:07 +0000 (12:07 +0000)]
Auto merge of #7929 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-11-04
flip1995 [Thu, 4 Nov 2021 12:03:53 +0000 (12:03 +0000)]
Bump nightly version -> 2021-11-04

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 4 Nov 2021 12:03:28 +0000 (12:03 +0000)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAdd clippy docs to check for a specific type
xFrednet [Thu, 4 Nov 2021 11:39:42 +0000 (12:39 +0100)]
Add clippy docs to check for a specific type

2 years agoImprove `clippy_utils` function docs
xFrednet [Thu, 4 Nov 2021 11:09:48 +0000 (12:09 +0100)]
Improve `clippy_utils` function docs

2 years agoReference nightly-rustc docs in clippy's docs
xFrednet [Thu, 4 Nov 2021 11:09:15 +0000 (12:09 +0100)]
Reference nightly-rustc docs in clippy's docs

2 years agoAuto merge of #7926 - lengyijun:patch-1, r=giraffate
bors [Thu, 4 Nov 2021 05:12:59 +0000 (05:12 +0000)]
Auto merge of #7926 - lengyijun:patch-1, r=giraffate

lower_case in  span_lint_and_help document

changelog: none

2 years agoUpdate diagnostics.rs
lyj [Thu, 4 Nov 2021 03:57:14 +0000 (11:57 +0800)]
Update diagnostics.rs

2 years agoRollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995
Matthias Krüger [Tue, 2 Nov 2021 22:48:49 +0000 (23:48 +0100)]
Rollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995

Update Clippy dependencies

Clippy has two outdated dependencies, where one indirect dependency has been flagged by rustsec for dropping a lifetime. See [RUSTSEC-2020-0146](https://rustsec.org/advisories/RUSTSEC-2020-0146). This PR updates these dependencies.

With previous dependency updates, it was tried to prevent duplicates in the `Cargo.lock` file of rust-lang/rust. I've tried to keep this in mind with this update.

* Dependency `semver`
    * Used in `src/tools/cargo/Cargo.toml` as version `1.0.3`
    * Used in `src/tools/rust-analyzer/crates/project_model/Cargo.toml` as version `1`
    * Updated in Clippy from `0.11` to `1.0` (Clippy usually defines the major and minor patch version). The `Cargo.lock` file lists `1.0.3` which is one patch version behind the most recent one but prevents a duplicate with cargo's pinned version.
* Dependency `cargo_metadata`
    * Used in several tools as `0.14`
    * Used in `src/tools/tidy` and `src/tools/rls` as `0.12`
    * Updated in Clippy from `0.12` to `0.14`

All updates to the `Cargo.lock` have been done automatically by `x.py`.

There are still some tools with these outdated dependencies. Clippy didn't require any changes, and it would be likely that the others could also be updated without any problem. Let me know if I should try to update them as well :upside_down_face:.

Keep up the good work, whoever is reading this :crab:

---

For Clippy:

changelog: none

2 years agoAuto merge of #7904 - Serial-ATA:improve-doc-suggestion, r=xFrednet
bors [Tue, 2 Nov 2021 21:07:21 +0000 (21:07 +0000)]
Auto merge of #7904 - Serial-ATA:improve-doc-suggestion, r=xFrednet

Add suggestion to missing backticks error

changelog: Add a machine applicable suggestion for the [`doc_markdown`] missing backticks lint

closes: #7737

2 years agoSpecify fixable doc tests
Serial [Tue, 2 Nov 2021 21:04:35 +0000 (17:04 -0400)]
Specify fixable doc tests

2 years agoAdd suggestion to missing backticks error
Serial [Sun, 31 Oct 2021 00:11:06 +0000 (20:11 -0400)]
Add suggestion to missing backticks error

2 years agoAuto merge of #7916 - samueltardieu:double-colon-prefix, r=xFrednet
bors [Tue, 2 Nov 2021 17:02:06 +0000 (17:02 +0000)]
Auto merge of #7916 - samueltardieu:double-colon-prefix, r=xFrednet

Advise to put a :: prefix inside the ticks

Fixes #7914.

changelog: Keep an initial `::` when [`doc_markdown`] suggests to use ticks

2 years agoAdvise to put a :: prefix inside the ticks
Samuel Tardieu [Tue, 2 Nov 2021 13:44:21 +0000 (14:44 +0100)]
Advise to put a :: prefix inside the ticks

2 years agoAuto merge of #7918 - samueltardieu:use-config-toml, r=flip1995
bors [Tue, 2 Nov 2021 16:16:20 +0000 (16:16 +0000)]
Auto merge of #7918 - samueltardieu:use-config-toml, r=flip1995

Use .cargo/config.toml instead of .cargo/config

`.cargo/config.toml` is the preferred form for the local configuration file. This is emphasized in _The Cargo Book_ with the following note:

> Note: Cargo also reads config files without the `.toml` extension, such as `.cargo/config`. Support for the `.toml` extension was added in version 1.39 and is the preferred form.

Moreover, this helps with toml-aware text editors as they will recognize the file extension.

changelog: none

2 years agoUse .cargo/config.toml instead of .cargo/config
Samuel Tardieu [Tue, 2 Nov 2021 16:04:39 +0000 (17:04 +0100)]
Use .cargo/config.toml instead of .cargo/config

`.cargo/config.toml` is the preferred form for the local configuration
file. This is emphasized in _The Cargo Book_ with the following note:

> Note: Cargo also reads config files without the `.toml` extension, such
> as `.cargo/config`. Support for the `.toml` extension was added in version
> 1.39 and is the preferred form.

Moreover, this helps with toml-aware text editors as they will recognize
the file extension.

2 years agoAuto merge of #7906 - smoelius:master, r=camsteffen
bors [Tue, 2 Nov 2021 14:06:36 +0000 (14:06 +0000)]
Auto merge of #7906 - smoelius:master, r=camsteffen

Fix #7903

Fixes #7903 (cc: `@Arnavion)`

changelog: none (bug is in same release)

r? `@camsteffen`

2 years agoUpdate clippy dependencies
xFrednet [Tue, 2 Nov 2021 13:19:31 +0000 (14:19 +0100)]
Update clippy dependencies

* semver = "0.11" -> "1.0"
* cargo_metadata = "0.12" -> "0.14"

2 years agoAuto merge of #7907 - Alexendoo:non-ascii-restriction, r=flip1995
bors [Tue, 2 Nov 2021 10:36:26 +0000 (10:36 +0000)]
Auto merge of #7907 - Alexendoo:non-ascii-restriction, r=flip1995

Move non_ascii_literal to restriction

It feels like the more apt category, since cases where you'd want it enabled would be pretty specific

changelog: Move [`non_ascii_literal`] to `restriction`

2 years agoAuto merge of #7901 - samueltardieu:fix-7893, r=xFrednet,flip1995
bors [Tue, 2 Nov 2021 10:23:15 +0000 (10:23 +0000)]
Auto merge of #7901 - samueltardieu:fix-7893, r=xFrednet,flip1995

Prevent clippy::needless_lifetimes false positive in async function definition

Scan `OpaqueDef` bounds for lifetimes as well. Those `OpaqueDef` instances are generated while desugaring an `async` function definition.

This fixes #7893

changelog: Prevent [`clippy::needless_lifetimes`] false positive in `async` function definition

2 years agoAuto merge of #7851 - nbdd0121:master, r=flip1995
bors [Tue, 2 Nov 2021 10:09:47 +0000 (10:09 +0000)]
Auto merge of #7851 - nbdd0121:master, r=flip1995

Fix manual_assert and match_wild_err_arm for `#![no_std]` and Rust 2021

Rust 2015 `std::panic!` has a wrapping block while `core::panic!` and Rust 2021 `std::panic!` does not. See rust-lang/rust#88919 for details.

Note that the test won't pass until clippy changes in rust-lang/rust#88860 is synced.

---

changelog: Fix [`manual_assert`] and [`match_wild_err_arm`] for `#![no_std]` and Rust 2021.

Fixes #7723

2 years agoAdd test case for `clippy::needless_lifetimes` in async context
Samuel Tardieu [Sat, 30 Oct 2021 10:11:45 +0000 (12:11 +0200)]
Add test case for `clippy::needless_lifetimes` in async context

Edition needs to be set to 2018 due to the use of `async`.

2 years agoAuto merge of #7726 - dswij:unseparated-literal-suffix, r=flip1995
bors [Tue, 2 Nov 2021 09:57:12 +0000 (09:57 +0000)]
Auto merge of #7726 - dswij:unseparated-literal-suffix, r=flip1995

Unseparated literal suffix

Closes #7658

Since `literal_suffix` style is opinionated, we should disable by default and only enforce if it's stated as so.

changelog: [`unseparated_literal_suffix`] is renamed to `literal_suffix`, adds a new configuration `literal-suffix-style` to enforce a certain style writing literal_suffix. Possible values for `literal-suffix-style`: `"separated"`, `"unseparated"`

2 years agoExamine lifetimes in `OpaqueDef` bounds as well
Samuel Tardieu [Sat, 30 Oct 2021 10:02:20 +0000 (12:02 +0200)]
Examine lifetimes in `OpaqueDef` bounds as well

Fix #7893.

2 years agoAuto merge of #7819 - rust-lang:avoid-linting-impossible-truncation, r=flip1995
bors [Tue, 2 Nov 2021 09:44:27 +0000 (09:44 +0000)]
Auto merge of #7819 - rust-lang:avoid-linting-impossible-truncation, r=flip1995

avoid linting `possible_truncation` on bit-reducing operations

---

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

changelog: avoid linting `possible_truncation` on bit-reducing operations

2 years agoAuto merge of #7911 - giraffate:small_fixes_for_missing_backticks, r=Manishearth
bors [Tue, 2 Nov 2021 00:19:57 +0000 (00:19 +0000)]
Auto merge of #7911 - giraffate:small_fixes_for_missing_backticks, r=Manishearth

Small fixes for missing backticks in doc

changelog: none

2 years agoSmall fixes for missing backticks in doc
Takayuki Nakata [Tue, 2 Nov 2021 00:09:22 +0000 (09:09 +0900)]
Small fixes for missing backticks in doc

2 years agoFix #7903
Samuel E. Moelius III [Mon, 1 Nov 2021 23:16:37 +0000 (19:16 -0400)]
Fix #7903

2 years agoAccount for revisions in missing-test-files
Gary Guo [Sun, 24 Oct 2021 21:19:59 +0000 (22:19 +0100)]
Account for revisions in missing-test-files

2 years agoFix manual_assert for `#![no_std]` and Rust 2021
Gary Guo [Wed, 20 Oct 2021 23:08:18 +0000 (00:08 +0100)]
Fix manual_assert for `#![no_std]` and Rust 2021

2 years agoAuto merge of #7866 - rust-lang:edition-2021-tests, r=Manishearth
bors [Mon, 1 Nov 2021 15:18:57 +0000 (15:18 +0000)]
Auto merge of #7866 - rust-lang:edition-2021-tests, r=Manishearth

update most tests to 2021 edition

Some tests would no longer work at all, so I added `edition:2015` or `edition:2018` to them.

Notably 2021 panics are not yet detected correctly. Once ready, this closes #7842.

---

changelog: none

2 years agoUpdate CHANGELOG to include `separated_literal_suffix`
dswij [Mon, 4 Oct 2021 03:54:27 +0000 (11:54 +0800)]
Update CHANGELOG to include `separated_literal_suffix`

2 years agoAdd `separated_literal_suffix` as an alternative for
Dharma Saputra Wijaya [Wed, 22 Sep 2021 14:13:54 +0000 (22:13 +0800)]
Add `separated_literal_suffix` as an alternative for
`unseparated_literal_suffix`

This commit adds a configuration `literal-suffix-style` to enforce a
specific style for unseparated_literal_suffix. The configuration accepts
two values:
- "separated"
    enforce all literals to be written separately (e.g. `123_i32`)
- "unseparated"
    enforce all literals to be written as unseparated (e.g. `123i32`)

Not specifying a value means that there is no preference on style and
any style should not be warned.

2 years agoMove non_ascii_literal to restriction
Alex Macleod [Sun, 31 Oct 2021 12:25:53 +0000 (12:25 +0000)]
Move non_ascii_literal to restriction

2 years agoRollup merge of #89786 - jkugelman:must-use-len-and-is_empty, r=joshtriplett
Matthias Krüger [Sun, 31 Oct 2021 12:20:05 +0000 (13:20 +0100)]
Rollup merge of #89786 - jkugelman:must-use-len-and-is_empty, r=joshtriplett

Add #[must_use] to len and is_empty

Parent issue: #89692

r? `@joshtriplett`

2 years agoAdd #[must_use] to len and is_empty
John Kugelman [Mon, 11 Oct 2021 20:15:50 +0000 (16:15 -0400)]
Add #[must_use] to len and is_empty

2 years agoAuto merge of #7899 - mikerite:fullint-20211030, r=xFrednet
bors [Sat, 30 Oct 2021 13:29:56 +0000 (13:29 +0000)]
Auto merge of #7899 - mikerite:fullint-20211030, r=xFrednet

Refactoring `FullInt`

Refactoring `FullInt`

changelog: None

2 years agoupdate most tests to 2021 edition
Andre Bogus [Sat, 23 Oct 2021 07:42:52 +0000 (09:42 +0200)]
update most tests to 2021 edition

2 years agoSimplify FullInt Ord impl
Michael Wright [Sat, 30 Oct 2021 04:22:19 +0000 (06:22 +0200)]
Simplify FullInt Ord impl

`cmp_s_u` is a tiny helper function only used by `cmp` and isn't useful on
it's own. Making it a nested function of `cmp` makes that clear and as a
bonus it's easier to call and doesn't require a `#[must_use]` attribute.

2 years agoSimplify FullInt Ord impl (2)
Michael Wright [Sat, 30 Oct 2021 04:22:19 +0000 (06:22 +0200)]
Simplify FullInt Ord impl (2)

2 years agoSimplify FullInt Ord impl
Michael Wright [Sat, 30 Oct 2021 04:22:19 +0000 (06:22 +0200)]
Simplify FullInt Ord impl

2 years agoRemove casts from FullInt impl
Michael Wright [Sat, 30 Oct 2021 04:22:19 +0000 (06:22 +0200)]
Remove casts from FullInt impl

2 years agoRemove expects from FullInt Partial{Ord,Eq}
Michael Wright [Sat, 30 Oct 2021 04:22:19 +0000 (06:22 +0200)]
Remove expects from FullInt Partial{Ord,Eq}

2 years agoAuto merge of #7895 - ahmedkrmn:master, r=Manishearth
bors [Fri, 29 Oct 2021 20:31:51 +0000 (20:31 +0000)]
Auto merge of #7895 - ahmedkrmn:master, r=Manishearth

Disable "if_not_else" lints from firing on else-ifs

Fixes #7892

1. Convert `['if_not_else']` to `LateLintPass` and use `clippy_utils::is_else_clause` for checking.
2. Update tests.

changelog: [`if_not_else`] now ignores else if statements.

2 years agoDisable "if_not_else" lints firing on else-ifs
Ahmed Karaman [Fri, 29 Oct 2021 02:11:43 +0000 (04:11 +0200)]
Disable "if_not_else" lints firing on else-ifs

1. Convert IfNotElse to LateLintPass and use clippy_utils::is_else_clause for checking.
2. Handle the case where the span comes from desugaring.
3. Update tests.

2 years agoavoid linting `possible_truncation` on bit-reducing operations
Andre Bogus [Wed, 13 Oct 2021 11:45:53 +0000 (13:45 +0200)]
avoid linting `possible_truncation` on bit-reducing operations

2 years agoAuto merge of #7890 - Alexendoo:ptr-arg-alias, r=camsteffen
bors [Fri, 29 Oct 2021 19:45:26 +0000 (19:45 +0000)]
Auto merge of #7890 - Alexendoo:ptr-arg-alias, r=camsteffen

Ignore references to type aliases in ptr_arg

Works using the fact that the hir path will point to a TyAlias, rather than being resolved to the underlying type

Fixes #7699

changelog: [`ptr_arg`] No longer lints references to type aliases

2 years agoAuto merge of #7810 - camsteffen:if-then-panic-pedantic, r=flip1995
bors [Thu, 28 Oct 2021 14:43:40 +0000 (14:43 +0000)]
Auto merge of #7810 - camsteffen:if-then-panic-pedantic, r=flip1995

Move if_then_panic to pedantic and rename to manual_assert

Closes #7718

changelog: none (lint added since last release)

2 years agoRename if_then_panic to manual_assert
Cameron Steffen [Tue, 12 Oct 2021 14:23:05 +0000 (09:23 -0500)]
Rename if_then_panic to manual_assert

2 years agoMove if_then_panic to pedantic
Cameron Steffen [Tue, 12 Oct 2021 14:09:54 +0000 (09:09 -0500)]
Move if_then_panic to pedantic

2 years agoAuto merge of #7891 - giraffate:fix_ice_for_undocumented_unsafe_blocks, r=flip1995
bors [Thu, 28 Oct 2021 13:37:40 +0000 (13:37 +0000)]
Auto merge of #7891 - giraffate:fix_ice_for_undocumented_unsafe_blocks, r=flip1995

Fix ice in `undocumented_unsafe_blocks`

Fix https://github.com/rust-lang/rust-clippy/issues/7868

changelog: Fix ice in [`undocumented_unsafe_blocks`]

2 years agoFix ICE in `undocumented_unsafe_blocks`
Takayuki Nakata [Thu, 28 Oct 2021 13:10:59 +0000 (22:10 +0900)]
Fix ICE in `undocumented_unsafe_blocks`

2 years agoAuto merge of #7847 - mikerite:fix-7829, r=flip1995
bors [Thu, 28 Oct 2021 08:59:21 +0000 (08:59 +0000)]
Auto merge of #7847 - mikerite:fix-7829, r=flip1995

Fix false positive in `match_overlapping_arm`

Fixes #7829

changelog: Fix false positive in [`match_overlapping_arm`].

2 years agoAuto merge of #7885 - devonhollowood:deprecated-cleanup, r=llogiq
bors [Wed, 27 Oct 2021 18:38:38 +0000 (18:38 +0000)]
Auto merge of #7885 - devonhollowood:deprecated-cleanup, r=llogiq

Clean up `tests/ui/deprecated.rs`

Clean up `tests/ui/deprecated.rs`

Along with #7884, this fixes #7057

changelog: none

2 years agoIgnore references to type aliases in ptr_arg
Alex Macleod [Wed, 27 Oct 2021 15:24:00 +0000 (16:24 +0100)]
Ignore references to type aliases in ptr_arg

Works using the fact that the hir path will point to a TyAlias, rather
than being resolved to the underlying type

2 years agoAuto merge of #7875 - mbStavola:unit-hash, r=xFrednet
bors [Wed, 27 Oct 2021 14:37:54 +0000 (14:37 +0000)]
Auto merge of #7875 - mbStavola:unit-hash, r=xFrednet

Add unit-hash lint

changelog: [`unit_hash`] Add lint for hashing unit values

This will lint for situations where the end user is attempting to hash a unit value (`()`), as the implementation in `std` simply [does nothing][impl]. Closes #7159 .

Example:

```rust
().hash(&mut state);

// Should (probably) be replaced with:
0_u8.hash(&mut state);
```

[impl]: https://github.com/rust-lang/rust/blob/a5f164faad4a2fed606b8160fd7ecd2d5cbba381/library/core/src/hash/mod.rs#L656

2 years agoAdd unit-hash lint
Matt Stavola [Mon, 25 Oct 2021 04:14:20 +0000 (21:14 -0700)]
Add unit-hash lint

2 years agoAuto merge of #7880 - Alexendoo:newlint-add-pass, r=flip1995
bors [Wed, 27 Oct 2021 07:33:00 +0000 (07:33 +0000)]
Auto merge of #7880 - Alexendoo:newlint-add-pass, r=flip1995

Register the generated lints from `cargo dev new_lint`

How to register a lint was something that took me a couple reads to figure out, this will hopefully make that easier. It appends the created lint to the end of the list when running `cargo dev new_lint`

changelog: none

2 years agoAdd test case
Takayuki Nakata [Wed, 27 Oct 2021 00:12:13 +0000 (09:12 +0900)]
Add test case

2 years agoAuto merge of #7860 - dswij:question-mark-fp, r=giraffate
bors [Tue, 26 Oct 2021 23:46:21 +0000 (23:46 +0000)]
Auto merge of #7860 - dswij:question-mark-fp, r=giraffate

Fix `question_mark` FP on custom error type

Closes #7859

#7840 aims to ignore `question_mark` when the return type is custom, which is [covered here](https://github.com/rust-lang/rust-clippy/blob/df65291edd6b89a241fed483ab165c32df468746/tests/ui/question_mark.rs#L144-L149). But this fails when there is a call in conditional predicate

changelog: [`question_mark`] Fix false positive when there is call in conditional predicate

2 years agoAuto merge of #7884 - devonhollowood:rename-cleanup, r=xFrednet
bors [Tue, 26 Oct 2021 21:16:44 +0000 (21:16 +0000)]
Auto merge of #7884 - devonhollowood:rename-cleanup, r=xFrednet

Clean up tests/ui/rename.rs

Part one of #7057, cleaning up `tests/ui/rename.rs`. `tests/ui/deprecated.rs` will be updated in a subsequent PR.

changelog: none

2 years agoUpdate tests after reviewer suggestions
Devon Hollowood [Tue, 26 Oct 2021 21:01:46 +0000 (14:01 -0700)]
Update tests after reviewer suggestions

2 years agoAuto merge of #7887 - xFrednet:7172-hiding-hidden-lines-online, r=flip1995
bors [Tue, 26 Oct 2021 20:56:23 +0000 (20:56 +0000)]
Auto merge of #7887 - xFrednet:7172-hiding-hidden-lines-online, r=flip1995

Remove hidden code lines in Clippy's lint list

This PR removes code lines from Clippy's lint list, which would also be hidden, when generating docs with rustdoc.

"A picture is worth a thousand words"... and here are even two pictures:

**Before:**

![image](https://user-images.githubusercontent.com/17087237/138952314-676dd9e7-ee80-459e-b521-bc42d8d03517.png)

**After:**

![image](https://user-images.githubusercontent.com/17087237/138952684-4fef969d-6880-4434-a338-b1a5a45539f0.png)

---

changelog: none

r? `@camsteffen` (Since you implemented the code block filtering :upside_down_face: )

2 years agoApply suggestions from code review
Devon Hollowood [Tue, 26 Oct 2021 20:55:51 +0000 (13:55 -0700)]
Apply suggestions from code review

Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
2 years agoRemove hidden code lines in Clippy's lint list
xFrednet [Tue, 26 Oct 2021 19:39:32 +0000 (21:39 +0200)]
Remove hidden code lines in Clippy's lint list

2 years agoRegister the generated lints from `cargo dev new_lint`
Alex Macleod [Mon, 25 Oct 2021 17:14:54 +0000 (18:14 +0100)]
Register the generated lints from `cargo dev new_lint`

2 years agoClean up `tests/ui/deprecated.rs`
Devon Hollowood [Tue, 26 Oct 2021 17:52:35 +0000 (10:52 -0700)]
Clean up `tests/ui/deprecated.rs`

This also removes the uplifted lints from this test suite -- these are now
tested in `tests/ui/rename.rs`

2 years agoFurther clean up tests/ui/rename.rs
Devon Hollowood [Tue, 26 Oct 2021 17:26:35 +0000 (10:26 -0700)]
Further clean up tests/ui/rename.rs

Now it is just a collection of lints + an empty main function

2 years agoRename variable name in `question_mark`
Dharma Saputra Wijaya [Tue, 26 Oct 2021 13:22:22 +0000 (21:22 +0800)]
Rename variable name in `question_mark`

2 years agoUpdate `question_mark` test to behave better
dswij [Fri, 22 Oct 2021 06:11:04 +0000 (14:11 +0800)]
Update `question_mark` test to behave better

2 years agoUpdate `question_mark` expected test output
dswij [Fri, 22 Oct 2021 05:43:21 +0000 (13:43 +0800)]
Update `question_mark` expected test output

2 years agoFix `question_mark` FP on calls
dswij [Fri, 22 Oct 2021 05:41:46 +0000 (13:41 +0800)]
Fix `question_mark` FP on calls

2 years agoAdd #7859 FP test case for `question_mark`
dswij [Fri, 22 Oct 2021 05:36:13 +0000 (13:36 +0800)]
Add #7859 FP test case for `question_mark`

2 years agoAuto merge of #7878 - rust-lang:string-slice, r=giraffate
bors [Tue, 26 Oct 2021 08:11:49 +0000 (08:11 +0000)]
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`]

2 years agoClean up tests/ui/rename.rs
Devon Hollowood [Tue, 26 Oct 2021 07:53:53 +0000 (00:53 -0700)]
Clean up tests/ui/rename.rs

2 years agonew lint: string-slice
Andre Bogus [Mon, 25 Oct 2021 07:46:47 +0000 (09:46 +0200)]
new lint: string-slice

2 years agoAuto merge of #7865 - Herschel:fix-match-str-case-mismatch, r=xFrednet
bors [Mon, 25 Oct 2021 21:34:11 +0000 (21:34 +0000)]
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

2 years agoAuto merge of #7873 - xFrednet:7869-string-index-ice, r=Manishearth
bors [Mon, 25 Oct 2021 19:20:05 +0000 (19:20 +0000)]
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 :upside_down_face:

Not too much more to say. Have a nice day :sun_with_face:

---

Fixes: rust-lang/rust-clippy#7869
changelog: ICE Fix: [`enum_variant_names`] #7869

2 years agoAuto merge of #7874 - xFrednet:7756-move-lint, r=llogiq
bors [Mon, 25 Oct 2021 18:56:57 +0000 (18:56 +0000)]
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`

2 years agoMove `non_send_fields_in_send_ty` to `suspicious`
xFrednet [Sun, 24 Oct 2021 21:01:44 +0000 (23:01 +0200)]
Move `non_send_fields_in_send_ty` to `suspicious`

Also updated one configuration for nicer formatting

2 years agoAuto merge of #7855 - flip1995:changelog, r=xFrednet
bors [Mon, 25 Oct 2021 11:05:25 +0000 (11:05 +0000)]
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

2 years agoUpdate CHANGELOG
flip1995 [Thu, 21 Oct 2021 15:37:57 +0000 (17:37 +0200)]
Update CHANGELOG

2 years agoAuto merge of #7872 - calebcartwright:sync-use-new-branch, r=flip1995
bors [Mon, 25 Oct 2021 08:46:51 +0000 (08:46 +0000)]
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

2 years agoRefactored some string handling to prevent ICEs and FNs
xFrednet [Sun, 24 Oct 2021 20:47:39 +0000 (22:47 +0200)]
Refactored some string handling to prevent ICEs and FNs

2 years agoAlways sort suggestions before emitting them
Esteban Kuber [Fri, 1 Oct 2021 18:09:31 +0000 (18:09 +0000)]
Always sort suggestions before emitting them

2 years agodocs: recommend new branch
Caleb Cartwright [Sun, 24 Oct 2021 20:14:45 +0000 (15:14 -0500)]
docs: recommend new branch

2 years agoRefactor `camel_case` util functions for new `StrIndex`
xFrednet [Sun, 24 Oct 2021 19:06:17 +0000 (21:06 +0200)]
Refactor `camel_case` util functions for new `StrIndex`

2 years agoAuto merge of #7871 - camsteffen:fmt-update, r=camsteffen
bors [Sun, 24 Oct 2021 17:55:49 +0000 (17:55 +0000)]
Auto merge of #7871 - camsteffen:fmt-update, r=camsteffen

Update rustfmt

changelog: none

Something changed with `rustup update nightly`

2 years agoUpdate rustfmt
Cameron Steffen [Sun, 24 Oct 2021 17:52:38 +0000 (12:52 -0500)]
Update rustfmt

2 years agoRename `clippy_utils::camal_case` to `clippy_utils::str_utils`
xFrednet [Sun, 24 Oct 2021 15:42:13 +0000 (17:42 +0200)]
Rename `clippy_utils::camal_case` to `clippy_utils::str_utils`

2 years agoAuto merge of #7867 - dswij:utils-typo, r=llogiq
bors [Sat, 23 Oct 2021 16:09:45 +0000 (16:09 +0000)]
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` :slightly_smiling_face:

changelog: none

2 years agoFix typo on utils/lib
Dharma Saputra Wijaya [Sat, 23 Oct 2021 15:42:31 +0000 (23:42 +0800)]
Fix typo on utils/lib

2 years agoFix `match_str_case_mismatch` false positives
Mike Welsh [Sat, 23 Oct 2021 06:47:38 +0000 (23:47 -0700)]
Fix `match_str_case_mismatch` false positives

Properly consider uncased and titlecased characters.
Fixes #7863.

2 years agoRollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Yuki Okushi [Fri, 22 Oct 2021 10:42:45 +0000 (19:42 +0900)]
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.

2 years agoAuto merge of #7856 - Manishearth:impl-safety, r=xFrednet
bors [Thu, 21 Oct 2021 21:51:24 +0000 (21:51 +0000)]
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`

2 years agouse a variable
Manish Goregaokar [Thu, 21 Oct 2021 21:40:33 +0000 (14:40 -0700)]
use a variable

2 years agoAuto merge of #7857 - flip1995:fix_deploy, r=xFrednet
bors [Thu, 21 Oct 2021 20:54:47 +0000 (20:54 +0000)]
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