Commit Graph

218 Commits

Author SHA1 Message Date
modelflat
3705073a71 Recognize common prefixes when checking for items with module name suffix
Fixes #12544.

- don't report an item name if it consists only of a prefix from `allowed-prefixes` list and a module name (e.g. `AsFoo` in module `foo`).
- configured by `allowed-prefixes` config entry
- prefixes allowed by default: [`to`, `from`, `into`, `as`, `try_into`, `try_from`]
- update docs
2024-04-09 09:47:54 +02:00
bors
cebf879de8 Auto merge of #12312 - pitaj:legacy_numeric_constants, r=xFrednet
new lint `legacy_numeric_constants`

Rework of #10997

- uses diagnostic items
- does not lint imports of the float modules (`use std::f32`)
- does not lint usage of float constants that look like `f32::MIN`

I chose to make the float changes because the following pattern is actually pretty useful
```rust
use std::f32;
let omega = freq * 2 * f32::consts::PI;
```
and the float modules are not TBD-deprecated like the integer modules.

Closes #10995

---

changelog: New lint [`legacy_numeric_constants`]
[#12312](https://github.com/rust-lang/rust-clippy/pull/12312)
2024-03-30 17:50:36 +00:00
bors
13ef8457be Auto merge of #12481 - xFrednet:add-team-docs, r=flip1995
RFC: Document Clippy's teams and team duties

First the big announcement:

**We want to add a new subteam for regular contributors to give them triage rights.**

---

This PR adds a new section to the book which describes the Clippy and Clippy-Contributor teams, with their duties and membership requirements. This is just an initial draft, that outlines what, I think, their responsibilities should be.

I hope everyone in the team is okay with me posting this directly to GitHub. I think a PR makes collaboration a bit easier.

[🖼️ Rendered 🖼️](https://github.com/xFrednet/rust-clippy/blob/add-team-docs/book/src/development/the_team.md)

---

Once we've decided on this document, I'll create a PR to add the new team on GitHub. As part of this, we'll also reach out to some active contributors, to ask if they would like to join the new team.

---

cc: `@rust-lang/clippy`

cc: #6627

changelog: none

r? `@flip1995`
2024-03-26 09:01:41 +00:00
Catherine
0c392d918a new lint legacy_numeric_constants 2024-03-21 17:10:02 -06:00
humannum14916
7c0b2dd352 Add assigning_clones to MSRV config option docs 2024-03-19 17:12:16 -04:00
xFrednet
b34afba5fb
Apply pretty review comments =^.^= 2024-03-18 14:32:02 +01:00
xFrednet
4cbe42e00d
RFC: Document Clippy's teams and team duties
I want to be clear: this is just the initial draft outlining what, I think, should be the responsibilities of the team members. It has not yet been discussed with anyone else.
2024-03-13 22:11:51 +01:00
Christopher B. Speir
d66a0ec714 Fix typo in section '6.10. Macro Expansions' of the Clippy Book
The struct returned by the `Span::ctxt` method was listed as
`SpanContext`. The correct struct is currently named `SyntaxContext`.
2024-03-11 13:31:02 -05:00
Quinn Sinclair
19c2aba3e9 address review comments 2024-03-03 18:12:41 +01:00
Quinn Sinclair
8c5afd496b address review comments 2024-03-03 18:12:41 +01:00
Quinn Sinclair
ca8f03fb93 Update trait_checking.md
Co-authored-by: Philipp Krones <hello@philkrones.com>
2024-03-03 18:12:41 +01:00
Quinn Sinclair
58d9c4707e formatting 2024-03-03 18:12:41 +01:00
Quinn Sinclair
a6fc64bb7b Trait checking and type construction 2024-03-03 18:12:41 +01:00
Christopher B. Speir
d85642e6e8 Alphabetize configuration options and lints in Clippy doc 2024-02-26 14:55:45 -06:00
Philipp Krones
6d0b70e08f
Clean up Allowing/Denying Lints section 2024-02-26 16:43:05 +01:00
lucarlig
80bafa5d45 add cargo.toml lint section way of adding lints 2024-02-26 18:59:05 +04:00
Alex Macleod
740d89ee69 Remove $DIR replacement in docs sampling stderr files 2024-02-17 12:34:54 +00:00
bors
32c006ca94 Auto merge of #12292 - GuillaumeGomez:DEPRECATED_CLIPPY_CFG_ATTR, r=flip1995
Add new lint `DEPRECATED_CLIPPY_CFG_ATTR`

As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Is.20.60--cfg.20feature.3Dcargo-clippy.60.20deprecated.20or.20can.20it.20be.3F).

This lint suggests to replace `feature = "cargo-clippy"` with `clippy`.

r? `@flip1995`

changelog:  Add new lint `DEPRECATED_CLIPPY_CFG_ATTR`
2024-02-16 10:24:15 +00:00
Guillaume Gomez
f4a3db8e4e Update clippy book to mention cfg(clippy) instead of feature cargo-clippy 2024-02-15 11:52:53 +01:00
Lukas Eschbacher
2b89cd4bf6
fix broken URL in Lint Configuration
Signed-off-by: Lukas Eschbacher <eschbacher.lukas@gmail.com>
2024-02-11 13:20:25 +01:00
y21
7f80b449f5 new lint: manual_c_str_literals 2024-02-05 18:51:49 +01:00
J-ZhengLi
46dd8263a0 rename conf option to allowed_wildcard_imports 2024-02-02 09:22:42 +08:00
Marc Dominik Migge
e456c28e11 Don't warn about modulo arithmetic when comparing to zero
Add lint configuration for `modulo_arithmetic`

Collect meta-data
2024-01-25 12:42:53 +01:00
y21
95a084f2eb [multiple_crate_versions]: add a configuration option for allowed duplicate dependencies 2024-01-21 03:23:41 +01:00
bors
fe3e6827c3 Auto merge of #12144 - blyxyas:10283-postfix, r=llogiq
Add . to end of lint lists in configuration + Fix typo in pub_underscore_fields_behavior

Fixes https://github.com/rust-lang/rust-clippy/pull/10283#issuecomment-1890600381

In the "/// Lint: " list on each configuration option, you have to end with a dot. If the lint list doesn't have a dot, the configuration won't have documentation.

This PR adds those missing dots in some of the configuration, thus also adding their documentation.

changelog: Fix bug where a lot of config documentation wasn't showing.
changelog: Fix typo in `pub_underscore_fields_behavior` (`PublicallyExported` -> `PubliclyExported`)
2024-01-20 22:58:23 +00:00
Ed Morley
a16a85030c
Add "OpenTelemetry" to default doc_valid_idents
The OpenTelemetry project's name is all one word (see https://opentelemetry.io),
so currently triggers a false positive in the `doc_markdown` lint.

The project is increasing rapidly in popularity, so it seems like a worthy
contender for inclusion in the default `doc_valid_idents` configuration.

I've also moved the existing "OpenDNS" entry earlier in the list, to restore
the alphabetical ordering of that "Open*" row.

The docs changes were generated using `cargo collect-metadata`.

changelog: [`doc_markdown`]: Add `OpenTelemetry` to the default configuration as an allowed identifier
2024-01-15 14:26:41 +00:00
blyxyas
44f5d969d5
Change PublicallyExported -> PubliclyExported 2024-01-14 01:14:05 +01:00
blyxyas
2469784cb6
Add . to end of lint lists in configuration 2024-01-14 01:06:35 +01:00
Georgiy Komarov
2dba787c90
Update URLs in Type Checking 2024-01-05 12:54:53 -03:00
bors
ee8bfb7f7a Auto merge of #12051 - y21:option_as_ref_cloned, r=dswij
new lint: `option_as_ref_cloned`

Closes #12009

Adds a new lint that looks for `.as_ref().cloned()` on `Option`s. That's the same as just `.clone()`-ing the option directly.

changelog: new lint: [`option_as_ref_cloned`]
2024-01-05 06:39:46 +00:00
bors
0bf0b88035 Auto merge of #12025 - jetlime:master, r=flip1995
Include GitLab in the CI section of the clippy doc book

Fixes #12012
changelog: Docs: [`Continuous Integration`] now includes how to use clippy in GitLab CI.
2024-01-04 10:48:53 +00:00
Paul Houssel
89e4b7162c
Include GitLab in the CI section of the clippy doc book 2024-01-04 11:43:38 +01:00
bors
691d4e275a Auto merge of #12023 - waywardmonkeys:ci-update-checkout-action, r=flip1995
ci: Update to `actions/checkout@v4` from `v3`.

This also updates the book's section on CI for the same thing.

changelog: none
2024-01-04 10:28:38 +00:00
y21
5960107415 new lint: option_as_ref_cloned 2024-01-03 19:40:47 +01:00
Yuxiang Qiu
88541d6637
fix some typos 2024-01-02 19:21:51 -05:00
Parker Timmerman
fa7dd1c4e0
add new lint, pub_underscore_fields
- add a new late pass lint, with config options
- add ui tests for both variations of config option
- update CHANGELOG.md

github feedback

bump version to 1.77 and run cargo collect-metadata

Change `,` to `;` in `conf.rs`
2023-12-29 11:44:34 +01:00
Bruce Mitchener
4c64d7cea2 ci: Update to actions/checkout@v4 from v3.
This also updates the book's section on CI for the same thing.

changelog: none
2023-12-26 18:43:16 -05:00
Bruce Mitchener
f48b850c65 [doc_markdown]: Add "WebGL2", "WebGPU" to default doc_valid_idents 2023-12-26 16:58:43 -05:00
Samuel Tardieu
a7c59aba20 TypeckResults::node_type() can be used inside of bodies 2023-11-26 22:30:16 +01:00
Alex Macleod
7093444bfa Use absolute path for declare_tool_lint in declare_clippy_lint 2023-11-25 17:45:27 +00:00
Matthias Richter
c18e6abdca Add documentation update hint
This adds a hint to update the documentation in the book after changing the lint configuration
2023-11-23 01:38:56 +01:00
bors
c24784ed81 Auto merge of #11757 - matthri:iter-kv-map-msrv-fix, r=Alexendoo
Fix iter_kv_map false positive into_keys and into_values suggestion

fixes: #11752

changelog: [`iter_kv_map`]: fix false positive: Don't suggest `into_keys()` and `into_values()` if the MSRV is to low
2023-11-22 20:39:44 +00:00
Matthias Richter
a20f61b194 add iter_kv_map to msrv config 2023-11-22 15:19:18 +01:00
Guillaume Gomez
abd9deb9f4 [missing_safety_doc], [unnecessary_safety_doc], [missing_panics_doc], [missing_errors_doc]: Added the [check-private-items] configuration to enable lints on private items.
[#11842](https://github.com/rust-lang/rust-clippy/pull/11842)
2023-11-21 11:42:42 +01:00
Alex Macleod
f1979d48d7 Destructure Conf in register_lints 2023-11-10 23:47:52 +00:00
y21
b9efa3ee2c update references of clippy_utils::msrvs and clippy_lints::util::conf 2023-11-04 01:15:32 +01:00
Alex Macleod
7df1c8aa78 Hide config implementation details from public docs 2023-10-24 11:52:17 +00:00
Alex Macleod
4622203c9b Move configuration to new clippy_config crate 2023-10-23 20:05:10 +00:00
Alex Macleod
7347c1803f Set existing doc-tests to no_run 2023-10-23 15:28:26 +00:00
bors
9574d28cb6 Auto merge of #11683 - Alexendoo:msrv-config, r=Manishearth,flip1995
Deserialize `Msrv` directly in `Conf`

Gives the error a span pointing to the invalid config value

Also puts `Conf` itself in the `OnceLock` rather than just the `Msrv` for [the `register_late_mod_pass` work](https://github.com/rust-lang/rust/pull/116731) since it will be used from two different callbacks

changelog: none
2023-10-19 11:51:08 +00:00