Commit Graph

1392 Commits

Author SHA1 Message Date
Raghul Nanth A 7ac15f9000 Add lint to check lint formulation messages
Fix lints that don't conform to the standard formulation
2023-06-03 00:00:30 +05:30
bors 00001d6e08 Auto merge of #10699 - blyxyas:book-lint_config, r=flip1995
Clippy Book Chapter Updates Reborn: Refresh Lint Configuration's looks

This PR modernizes and clears up some confusion with the "Lint Configuration Options" chapter from the book.

### Changes

- **Remove 'Option - Default Value" table**

    - Why was it even there?
    - It shouldn't be the first thing an user sees when they enter the chapter. It's clunky, ugly and not useful. The default values for configs are stated in a per-config basis if needed.

- **Add a simple description of what the chapter contains, and the scheme of each configuration option**

- **Minor formatting, mainly adding code fragments to code text**

    - It seemed weird and jarring not having back-ticks on text like "arithmetic_side_effects".
    -  Improves readability and separation between configs.

- **Separate a little bit the Affected Lints list + "Affected lists" message**

    - Not having something indicating that the list is about the lints that use the configuration option is confusing.
    - It isn't as important as the description and example. Therefore should be separated a little bit imo

---

This is an independent effort from #10597, but as it's still a Book Chapter Update, I thought it would be cool to include it here. I'm going to keep the reviewing process for this PR to rustbot's desires.

[Rendered](https://github.com/blyxyas/rust-clippy/blob/book-lint_config/book/src/lint_configuration.md)
[Current](https://github.com/rust-lang/rust-clippy/blob/master/book/src/lint_configuration.md)

changelog: Refresh styling from the "Lint Configuration Options" book chapter.
2023-06-02 12:51:26 +00:00
bors 50ab3ce6c9 Auto merge of #10607 - beetrees:toml-spans, r=giraffate
Add spans to `clippy.toml` error messages

Adds spans to errors and warnings encountered when parsing `clippy.toml`.

changelog: Errors and warnings generated when parsing `clippy.toml` now point to the location in the TOML file the error/warning occurred.
2023-06-02 08:01:31 +00:00
beetrees 6f13a37499 Add spans to clippy.toml error messages 2023-06-02 00:56:27 +01:00
MarcusGrass 5f5e2e2ac1 Explain which paths clippy searches for configuration in docs 2023-06-01 12:14:55 +02:00
Philipp Krones 96b32b1cb8 Merge remote-tracking branch 'upstream/master' into rustup 2023-05-20 15:32:20 +02:00
blyxyas b7a6054712 Refresh Lint Configuration's looks 2023-05-09 21:39:24 +02:00
blyxyas 2a4571d959 Minimizing changes 2023-05-06 08:38:47 +02:00
bors 5889ecd14f Auto merge of #111255 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2023-05-05 21:50:14 +00:00
Philipp Krones 7e9abb311d Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup 2023-05-05 17:45:49 +02:00
Deadbeef 37127b8d70 initial step towards implementing C string literals 2023-05-02 10:30:09 +00:00
y21 1d08325293 move lint to loops, emit proper suggestion, more tests 2023-04-29 18:59:07 +02:00
bors 990bbdc2be Auto merge of #10656 - Centri3:master, r=xFrednet
Add configuration for `semicolon_block` lints

Does exactly what it says on the tin, suggests moving a block's final semicolon inside if it's multiline and outside if it's singleline.

I don't really like how this is implemented so I'm not too sure if this is ready yet. Alas, it might be ok.

---

fixes #10654

changelog: Enhancement: [`semicolon_inside_block`]: Added `semicolon-inside-block-ignore-singleline` as a new config value.
[#10656](https://github.com/rust-lang/rust-clippy/pull/10656)
changelog: Enhancement: [`semicolon_outside_block`]: Added `semicolon-outside-block-ignore-multiline` as a new config value.
[#10656](https://github.com/rust-lang/rust-clippy/pull/10656)
<!-- changelog_checked -->
2023-04-25 20:12:00 +00:00
Centri3 aa6c27a74e change names to not be implicitly negative 2023-04-25 11:14:52 -05:00
Philipp Krones a1b75c5108 Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup 2023-04-23 13:28:56 +02:00
Philipp Krones 583c97e9bb Merge remote-tracking branch 'upstream/master' into rustup 2023-04-23 03:39:03 -07:00
DrMeepster 68c4776b46 offset_of 2023-04-21 02:14:02 -07:00
Centri3 41f6d88be5 make cargo test pass 2023-04-19 21:51:58 -05:00
Centri3 a3aeec4f75 config instead of new lint and don't panic 2023-04-19 21:46:13 -05:00
Lukas Lueg 4bc68f9c60 Add size-parameter to unecessary_box_returns
Fixes #10641
2023-04-19 14:32:05 +02:00
Nilstrieb 8f53926232 Alloc hir::Lit in an arena to remove the destructor from Expr
This allows allocating `Expr`s into a dropless arena, which is useful
for using length prefixed thing slices in HIR, since these can only be
allocated in the dropless arena and not in a typed arena. This is
something I'm working on.
2023-04-16 15:35:51 +00:00
bluthej 6409556926 Standardize lint formulation 2023-04-12 13:48:03 +02:00
Philipp Krones 6b95029f17 Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup 2023-04-11 15:31:08 +02:00
bhould287 3b22352d0d Fix bug with getting parent directories in lookup_conf_file 2023-04-03 16:16:48 +01:00
bhould287 afdfbf8fde Show multiple clippy.toml warnings with sess.warn instead of eprintln! 2023-04-03 15:03:05 +01:00
Yuri Astrakhan 41b367fa5f Gramar, and spelin kleanup
A few minor cleanups in various markdown files, mostly focusing on spelling and ignoring non-compilable codeblocks.
2023-03-30 15:31:14 -04:00
bors 799732cbd8 Auto merge of #10414 - csmoe:large-future, r=xFrednet
add large future lint

Closes #5263

---

changelog: new lint: [`large_futures`]
[#10414](https://github.com/rust-lang/rust-clippy/pull/10414)
<!-- changelog_checked -->
2023-03-30 08:51:29 +00:00
bors ef3867f394 Auto merge of #9102 - botahamec:unused-box, r=xFrednet
Added the `[unnecessary_box_returns]` lint

fixes #5

I'm not confident in the name of this lint. Let me know if you can think of something better

---

changelog: New lint: ``[`unnecessary_box_returns`]``
[#9102](https://github.com/rust-lang/rust-clippy/pull/9102)
<!-- changelog_checked -->
2023-03-30 08:22:16 +00:00
Alex Macleod 3259b48568 Migrate format_args.rs to rustc_ast::FormatArgs
No longer lints empty precisions `{:.}` as the spans aren't available
2023-03-28 12:22:22 +00:00
Micha White a143fb7a11 Avoid breaking exported API 2023-03-26 17:49:57 -04:00
Philipp Krones 8df896c076 Merge commit 'd5e2a7aca55ed49fc943b7a07a8eba05ab5a0079' into clippyup 2023-03-24 14:26:19 +01:00
Philipp Krones 62cba5d971 Merge remote-tracking branch 'upstream/master' into rustup 2023-03-24 13:36:09 +01:00
csmoe 4fdae81c70 add large future lint 2023-03-20 22:51:01 +08:00
clubby789 f2eddc5924 Remove box expressions from HIR 2023-03-14 17:18:26 +00:00
J-ZhengLi f0ae2b71ca make [ifs_same_cond] use ignore_interior_mutablility configuration 2023-03-13 20:13:56 +08:00
Philipp Krones cf8a67d9ad Merge commit '3c06e0b1ce003912f8fe0536d3a7fe22558e38cf' into clippyup 2023-03-10 10:53:50 +01:00
bors 3c06e0b1ce Auto merge of #10275 - Alexendoo:format-args-ast, r=flip1995
Migrate `write.rs` to `rustc_ast::FormatArgs`

changelog: none

Part 1 of #10233

The additions to `clippy_utils` are the main novelty of this PR, there's no removals yet since other parts still rely on `FormatArgsExpn`

The changes to `write.rs` itself are relatively straightforward this time around, as there's no lints in it that rely on type checking format params

r? `@flip1995`
2023-03-10 09:38:18 +00:00
Philipp Krones baa997caf6 Merge remote-tracking branch 'upstream/master' into rustup 2023-03-10 10:22:18 +01:00
Alex Macleod dc23e42fb6 Add format_args_collector internal lint 2023-03-06 21:38:32 +00:00
bors ea2073a2f0 Auto merge of #108351 - petrochenkov:rmdit, r=cjgillot
rustc_middle: Remove trait `DefIdTree`

This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-05 10:37:02 +00:00
David Tolnay cc6180c2f4 Include former name of renamed lints in lints.json 2023-03-03 19:03:54 -08:00
Alex Macleod 64b54ef950 Fix array-size-threshold config deserialization error 2023-03-02 21:42:11 +01:00
Vadim Petrochenkov 79359cbbcf rustc_middle: Remove trait DefIdTree
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02 23:46:44 +04:00
Alex Macleod 2cadea5dc5 Fix array-size-threshold config deserialization error 2023-02-28 14:37:41 +00:00
bors 0966f59c78 Auto merge of #108474 - Jarcho:clippyup, r=Manishearth
Update Clippy

Seems like `@flip1995` so this is a couple days late.

r? `@Manishearth`
2023-02-26 18:45:47 +00:00
Jason Newcomb 0413fb35ba Merge commit '149392b0baa4730c68f3c3eadf5c6ed7b16b85a4' into clippyup 2023-02-25 19:28:50 -05:00
Jason Newcomb 69c4ff6df8 Emit unnecessary_def_path in source order. 2023-02-25 18:09:24 -05:00
Jason Newcomb bc184e9c7d Merge branch 'master' into rustup 2023-02-25 17:43:19 -05:00
Michael Goulet 9fd0a415bb Make clippy happy 2023-02-25 19:46:36 +00:00
Liu Dingming b9c617a1b7 correct comments 2023-02-22 21:36:16 +08:00