Commit graph

12681 commits

Author SHA1 Message Date
bors
150a65982b Auto merge of #7926 - lengyijun:patch-1, r=giraffate
lower_case in  span_lint_and_help document

changelog: none
2021-11-04 05:12:59 +00:00
lyj
df9f5e4b22
Update diagnostics.rs 2021-11-04 11:57:14 +08:00
bors
4d26c5c82c 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
2021-11-02 21:07:21 +00:00
Serial
3732d117da Specify fixable doc tests 2021-11-02 17:04:35 -04:00
Serial
0db8c52291 Add suggestion to missing backticks error 2021-11-02 16:50:47 -04:00
bors
c68af43b3d 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
2021-11-02 17:02:06 +00:00
Samuel Tardieu
7f8198acad Advise to put a :: prefix inside the ticks 2021-11-02 17:57:50 +01:00
bors
b6c8168cff 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
2021-11-02 16:16:20 +00:00
Samuel Tardieu
a68c13563a 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.
2021-11-02 17:08:10 +01:00
bors
2ebd535eae Auto merge of #7906 - smoelius:master, r=camsteffen
Fix #7903

Fixes #7903 (cc: `@Arnavion)`

changelog: none (bug is in same release)

r? `@camsteffen`
2021-11-02 14:06:36 +00:00
bors
18cc4e74f8 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`
2021-11-02 10:36:26 +00:00
bors
9720619432 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
2021-11-02 10:23:15 +00:00
bors
276e8951f1 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
2021-11-02 10:09:47 +00:00
Samuel Tardieu
9bcf966e35 Add test case for clippy::needless_lifetimes in async context
Edition needs to be set to 2018 due to the use of `async`.
2021-11-02 10:57:23 +01:00
bors
38d80257d0 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"`
2021-11-02 09:57:12 +00:00
Samuel Tardieu
3f84010688 Examine lifetimes in OpaqueDef bounds as well
Fix #7893.
2021-11-02 10:54:58 +01:00
bors
4e355ebb6e 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
2021-11-02 09:44:27 +00:00
bors
08b7e87843 Auto merge of #7911 - giraffate:small_fixes_for_missing_backticks, r=Manishearth
Small fixes for missing backticks in doc

changelog: none
2021-11-02 00:19:57 +00:00
Takayuki Nakata
ec456de2a3 Small fixes for missing backticks in doc 2021-11-02 09:09:22 +09:00
Samuel E. Moelius III
5edb02adad Fix #7903 2021-11-01 19:33:27 -04:00
Gary Guo
14e0390fdf Account for revisions in missing-test-files 2021-11-01 15:47:34 +00:00
Gary Guo
7e5f99ab58 Fix manual_assert for #![no_std] and Rust 2021 2021-11-01 15:47:33 +00:00
bors
7cd9bf5af3 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
2021-11-01 15:18:57 +00:00
dswij
bb1cf72999 Update CHANGELOG to include separated_literal_suffix 2021-11-01 22:26:38 +08:00
Dharma Saputra Wijaya
1085df58ac 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.
2021-11-01 22:26:13 +08:00
Alex Macleod
28c225f775 Move non_ascii_literal to restriction 2021-10-31 12:59:53 +00:00
bors
310ecb0a5c Auto merge of #7899 - mikerite:fullint-20211030, r=xFrednet
Refactoring `FullInt`

Refactoring `FullInt`

changelog: None
2021-10-30 13:29:56 +00:00
Andre Bogus
a4ede72b3d update most tests to 2021 edition 2021-10-30 14:50:53 +02:00
Michael Wright
e8c4046841 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.
2021-10-30 06:22:19 +02:00
Michael Wright
4a86156c66 Simplify FullInt Ord impl (2) 2021-10-30 06:22:19 +02:00
Michael Wright
c6dca68eca Simplify FullInt Ord impl 2021-10-30 06:22:19 +02:00
Michael Wright
c8edd9a16e Remove casts from FullInt impl 2021-10-30 06:22:19 +02:00
Michael Wright
665ff57fde Remove expects from FullInt Partial{Ord,Eq} 2021-10-30 06:22:19 +02:00
bors
4c70c182c0 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.
2021-10-29 20:31:51 +00:00
Ahmed Karaman
2f327aaba5
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.
2021-10-29 22:07:05 +02:00
Andre Bogus
00ea73e162 avoid linting possible_truncation on bit-reducing operations 2021-10-29 21:59:24 +02:00
bors
dbe167daaa 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
2021-10-29 19:45:26 +00:00
bors
00821ca937 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)
2021-10-28 14:43:40 +00:00
Cameron Steffen
022146d2c3 Rename if_then_panic to manual_assert 2021-10-28 09:41:53 -05:00
Cameron Steffen
d8fcfd7d64 Move if_then_panic to pedantic 2021-10-28 09:38:01 -05:00
bors
7788af9c47 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`]
2021-10-28 13:37:40 +00:00
Takayuki Nakata
35bf041c21 Fix ICE in undocumented_unsafe_blocks 2021-10-28 22:10:59 +09:00
bors
89a11564cc 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`].
2021-10-28 08:59:21 +00:00
bors
ed71addee7 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
2021-10-27 18:38:38 +00:00
Alex Macleod
e2c30f05c1 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
2021-10-27 19:08:42 +01:00
bors
962e21cf15 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]: a5f164faad/library/core/src/hash/mod.rs (L656)
2021-10-27 14:37:54 +00:00
Matt Stavola
36d4a4ea82
Add unit-hash lint 2021-10-27 06:32:37 -07:00
bors
444ef3e4d5 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
2021-10-27 07:33:00 +00:00
Takayuki Nakata
73c026b73f Add test case 2021-10-27 09:12:13 +09:00
bors
ba2ac3e263 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](df65291edd/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
2021-10-26 23:46:21 +00:00