Commit Graph

16538 Commits

Author SHA1 Message Date
blyxyas
b4732679fc
Talk about symbol information in "Early Lint Pass" 2023-04-12 23:59:56 +02:00
blyxyas
c19c08f4b2
Fix CI 2023-04-10 11:09:52 +02:00
blyxyas
0b1b535116
Add "Lint Passes" chapter 2023-04-10 10:59:12 +02:00
bors
015fb8a9e3 Auto merge of #10618 - KisaragiEffective:patch-2, r=llogiq
[missing_const_for_fn] fix #7121

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

changelog: [`missing_const_for_fn`] note about removing const may break compatibility

fix #7121
2023-04-09 18:49:52 +00:00
bors
7de7ca802e Auto merge of #10610 - beetrees:max-line-length, r=Jarcho
Add `max_line_length` to `.editorconfig`, matching `rustfmt.toml`

Add `max_line_length` to `.editorconfig` to match the `max_width` in `rustfmt.toml`.

changelog: none
2023-04-09 18:38:18 +00:00
Kisaragi
ba1f19ee30
apply code review suggestion
Co-authored-by: llogiq <bogusandre@gmail.com>
2023-04-10 01:31:30 +09:00
Kisaragi
5109a8a840
[missing_const_for_fn] fix #7121 2023-04-10 00:55:32 +09:00
bors
82d71b1b3a Auto merge of #10605 - blyxyas:book-type_checking, r=llogiq
Clippy Book Chapter Updates Reborn: Type Checking

This PR adds a new chapter to the book: "Type Checking", it hasn't changed a lot from the source mainly because there wasn't many reviews on it and I haven't see a lot of things that needed a change.

## Notes

- I have some doubts about the whole "`is_*` Usage" section, what do you think about it.
- For discussion about  the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions, and more information)

changelog: Add a new "Type Checking" chapter to the book

r? `@flip1995`
2023-04-08 22:22:47 +00:00
blyxyas
1cf64060e3
Add "hir::Ty and ty::Ty" section 2023-04-08 17:14:55 +02:00
beetrees
4905a2130a
Add max_line_length to .editorconfig, matching rustfmt.toml 2023-04-08 15:03:34 +01:00
bors
592ea3954d Auto merge of #10604 - blyxyas:fix-book_broken_links, r=flip1995
(Small) Fix broken links for Rust merge

rust-lang/rust#110003's CI is [currently broken](https://github.com/rust-lang/rust/actions/runs/4628510374/jobs/8187672234?pr=110003) because of broken links. This PR fixes that.
It was tested against `lintcheck` and found another broken link in `usage.md` (apart from CI's broken links)

changelog:Fix broken links in the book
Sorry for putting more work on you, but you're the one doing the Rust PR
r? `@flip1995`
2023-04-07 11:51:08 +00:00
bors
4a2cb5a7b8 Auto merge of #10497 - y21:outer_doc_comment_bang, r=dswij
new lint: suspicious_doc_comments

Fixes #10485.

This PR adds a new lint (`suspicious_doc_comments`) that triggers when the user writes `///!` or `/**!`.
This is almost certainly a mistake and the user probably meant to write an inner doc comment (`//!`, `/*!`) to document the module or crate that this comment is contained in.

changelog: [`suspicious_doc_comments`]: new lint
2023-04-07 11:14:10 +00:00
blyxyas
90e6ddc8e7
New chapter: "Type Checking" 2023-04-07 13:11:18 +02:00
y21
5d01e6e96c new lint: suspicious_doc_comments 2023-04-07 12:04:55 +02:00
bors
b8cbce8e6a Auto merge of #10601 - schubart:manual_slice_size_calculation, r=llogiq
Add [`manual_slice_size_calculation`]

Fixes: #10518

---

changelog: new lint [`manual_slice_size_calculation`]
2023-04-07 07:39:11 +00:00
bors
9408d013e3 Auto merge of #10566 - ebobrow:iss10549, r=giraffate
fix `single_component_path_imports` FP on `self::<import>::..`

fixes #10549

I noticed that a couple functions in the file I was working on took `cx` as a parameter but didn't use them, so I removed that. Can revert if desired because it isn't related to my changes.

changelog: [`single_component_path_imports`] don't suggest removing import when it is used as `self::<import>::..`
2023-04-07 00:14:45 +00:00
Michael Schubart
b1c784d31f Fix false negatives by using expr_or_init 2023-04-07 08:00:53 +09:00
blyxyas
cf260bc90f
Fix broken links for Rust merge 2023-04-06 22:02:23 +02:00
bors
de5c6d6b1e Auto merge of #10594 - J-ZhengLi:issue9824, r=Jarcho
fix [`mem_replace_option_with_none`] not considering field variables

fixes: #9824

---

changelog: fix [`mem_replace_option_with_none`] not considering field variables
2023-04-06 14:01:08 +00:00
Michael Schubart
b47a322ef1 Add tests suggested by @llogiq 2023-04-06 13:45:50 +01:00
Michael Schubart
b66aa09b95 Add [manual_slice_size_calculation] 2023-04-06 11:48:20 +01:00
bors
2b05f794e7 Auto merge of #10602 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-04-06 10:34:47 +00:00
Philipp Krones
fa425061e6
Bump nightly version -> 2023-04-06 2023-04-06 12:32:47 +02:00
Philipp Krones
04c387efe7
Merge remote-tracking branch 'upstream/master' into rustup 2023-04-06 12:32:32 +02:00
J-ZhengLi
008e07d4e8 fix [mem_replace_option_with_none] not considering field variables 2023-04-06 16:16:22 +08:00
bors
26e245d2ff Auto merge of #10554 - samueltardieu:redundant-async-block, r=Jarcho
Make redundant_async_block a more complete late pass

This lets us detect more complex situations: `async { x.await }` is simplified into `x` if:

- `x` is an expression without side-effect
- or `x` is an `async` block itself

In both cases, no part of the `async` expression can be part of a macro expansion.

Fixes #10509.
Fixes #10525.

changelog: [`redundant_async_block`] Do not lint expressions with side effects.
2023-04-05 18:31:32 +00:00
Samuel "Sam" Tardieu
2891d8f72f Make redundant_async_block a more complete late pass
This lets us detect more complex situations: `async { x.await }` is
simplified into `x` if:

- `x` is an expression without side-effect
- or `x` is an async block itself

In both cases, no part of the `async` expression can be part of a macro
expansion.
2023-04-05 10:06:01 +02:00
Oli Scherer
e9c7fb10b9 Rename ast::Static to ast::StaticItem to match ast::ConstItem 2023-04-04 15:34:40 +00:00
Oli Scherer
e610ddfa5e box a bunch of large types 2023-04-04 13:58:50 +00:00
bors
5d149c5dac Auto merge of #10543 - blyxyas:tests_outside_test_module, r=flip1995
Add `tests_outside_test_module` lint

Adds `tests_outside_test_module` from #10506. This PR **doesn't** close the issue, just resolves task 1.

changelog: [`tests_outside_test_module`]: The lint has been added
2023-04-04 09:46:50 +00:00
Oli Scherer
ff7636db6a Split out ast::ItemKind::Const into its own struct 2023-04-04 09:44:50 +00:00
Oli Scherer
929696d754 rust-analyzer guided tuple field to named field 2023-04-04 09:44:50 +00:00
Oli Scherer
a6beddcc5a rust-analyzer guided enum variant structification 2023-04-04 09:44:45 +00:00
blyxyas
b2f9191820
Fix formatting and lint description 2023-04-04 11:42:32 +02:00
bors
73e412b6d4 Auto merge of #10592 - beetrees:parent-dir-bug-fix, r=giraffate
Fix bug with getting parent directories in `lookup_conf_file`

Currently `lookup_conf_file` doesn't canonicalize the configuration directory before using [`PathBuf::pop`](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.pop) to get the parent directory. This isn't usually an issue when clippy is invoked via `cargo clippy` as `CARGO_MANIFEST_DIR` is already canonicalized. However, this currently causes `clippy-driver` to ignore any `clippy.toml` in any parent directories when  `CARGO_MANIFEST_DIR` and `CLIPPY_CONF_DIR` are not set.

changelog: Fix a bug that would cause parent directories not to be searched for `clippy.toml` when using `clippy-driver` directly.
2023-04-04 04:48:35 +00:00
bors
85d9f176b7 Auto merge of #10589 - blyxyas:fix-double_must_use, r=giraffate
Mini-fix `double_must_use` for async functions

From Rust 1.67 onwards, the `#[must_use]` attribute also applies to the `Future::Output` (rust-lang/rust#100633). So the lint `double_must_use` was linting all async functions. This PR changes the `double_must_use` lint so it ignores `async` functions.

---

Closes #10486
changelog: [`double_must_use`]: Fix false positive in async function
2023-04-04 00:09:11 +00:00
blyxyas
bd2a5b2322
Remove check for #[cfg(test)] 2023-04-03 18:42:00 +02:00
bhould287
3b22352d0d
Fix bug with getting parent directories in lookup_conf_file 2023-04-03 16:16:48 +01:00
bors
9e53b6544f Auto merge of #10591 - beetrees:warnings-not-eprintln, r=flip1995
Show multiple clippy.toml warnings with `sess.warn` instead of `eprintln!`

Use `sess.warn` to display the multiple clippy.toml warning instead of `eprintln!`.

changelog: none
2023-04-03 14:22:34 +00:00
blyxyas
a37eb4dfc9
Fix false negative on Result<(), ()> 2023-04-03 16:07:17 +02:00
bhould287
afdfbf8fde
Show multiple clippy.toml warnings with sess.warn instead of eprintln! 2023-04-03 15:03:05 +01:00
blyxyas
d602743558
only focus on double_must_use + Add Result<(), ()> test 2023-04-03 15:16:18 +02:00
bors
e903af506f Auto merge of #10229 - danielparks:doc-feature-cargo-clippy, r=flip1995
Document `cargo-clippy` feature

It is possible to use conditional compilation to prevent Clippy from evaluating certain code at all. Unfortunately, it was no longer documented anywhere. This adds a brief explanation of how to use the feature with conditional compilation, and mentions a few downsides.

Fixes #10220 — Ability to skip files or blocks entirely
changelog: none
<!-- changelog_checked -->
2023-04-03 12:12:17 +00:00
bors
207955cee5 Auto merge of #10574 - jyn514:update-docs, r=flip1995
Update subtree sync docs for changes in rustc-dev-guide

Companion PR to https://github.com/rust-lang/rustc-dev-guide/pull/1653. That still keeps a `contributing.html` with an "External Contributions" section, so hopefully it won't be too disruptive.

changelog: none
2023-04-03 11:43:22 +00:00
blyxyas
e2742a0ea2
Fix double_must_use for async functions 2023-04-03 01:27:53 +02:00
bors
7fe83edc11 Auto merge of #10588 - blyxyas:fix-allow_nonminimal_bool, r=llogiq
Fix `nonminimal_bool` `#[allow]` attributes.

Closes #10435
changelog: [`nonminimal_bool`]: Fix false-positive where the lint ignore `#[allow]` attributes.

r? `@llogiq`
2023-04-02 22:12:46 +00:00
bors
8f0ba1f2e0 Auto merge of #10563 - nyurik:handle-all-fmt2, r=llogiq
Partial no-op refactoring of #9948

This contains some prep work for #9948 to keep that change to the minimum, and make it easier to review it.

This should be a noop, but it has some tests from that PR discussion, and should help in the future with the corner case format handling.

cc: `@Alexendoo` `@llogiq` `@xFrednet`  as the 3 people who reviewed the parent PR

----

changelog: none
2023-04-02 17:08:20 +00:00
bors
8d83c15d20 Auto merge of #10585 - c410-f3r:aaaaaaaaaaaa, r=Jarcho
[arithmetic_side_effects] Fix #10583

Fixes #10583

```
changelog: [`arithmetic_side_effects`]: Correctly handle division and module when the right-hand-side is unknown
```
2023-04-02 16:39:38 +00:00
blyxyas
36047b0216
Fix nonminimal_bool #[allow] attributes. 2023-04-02 16:18:03 +02:00
Caio
05650b7215 [arithmetic_side_effects] Fix #10583 2023-04-02 07:50:25 -03:00