Commit Graph

114 Commits

Author SHA1 Message Date
Centri3
8cb6c86996 change category and refactor
Update raw_strings.rs

Revert "new lints for visibility"

This reverts commit 0e5a537d209727169769dc19cf86aef27122c092.

new lints for visibility
2023-06-27 05:16:40 -05:00
Centri3
cb52d19ce1 don't lint needless_raw_string_hashes when it's unnecessary 2023-06-27 05:12:00 -05:00
bors
15ed281699 Auto merge of #10426 - oli-obk:ui_test, r=Manishearth
Port clippy away from compiletest to ui_test

Reasons to do this:

* runs completely on stable Rust
* is easier to extend with new features
* has its own dogfood test suite, so changes can be tested in [the `ui_test` repo](https://github.com/oli-obk/ui_test)
* supports dependencies from crates.io without having to manually fiddle with command line flags
* supports `ui-cargo`, `ui`, `ui-toml` out of the box, no need to find and run the tests ourselves

One thing that is a big difference to `compiletest` is that if a test emits *any* error, you need to mark all of them with `//~ ERROR:` annotations. Since many clippy tests did not have annotations, I changed many lints to be `warn` in their test so that only the `stderr` output is tested.

TODO:

* [ ] check that this still works as a subtree in the rustc repo

changelog: none
<!-- changelog_checked -->

Note: at present the latest changes needed for clippy are only available as a git dependency, but I expect to publish a new crates.io version soon
2023-06-26 17:32:51 +00:00
Oli Scherer
514b6d04bb Port clippy away from compiletest to ui_test 2023-06-26 14:13:07 +00:00
blyxyas
aea731ebdb
update changelog's data ranges 2023-06-26 13:48:49 +02:00
bors
ce0a48a9b6 Auto merge of #10994 - y21:issue8772, r=giraffate
[`type_repetition_in_bounds`]: respect MSRV for combining bounds

Fixes #8772.

changelog: [`type_repetition_in_bounds`]: respect msrv for combining `?Sized` bound
2023-06-23 00:31:04 +00:00
y21
75f9fbc93d update lint configuration 2023-06-23 02:07:05 +02:00
Catherine
e3b601a1aa Add WebAssembly to allowed idents 2023-06-20 18:12:20 -05:00
bors
8fd021f504 Auto merge of #10986 - Centri3:undocumented_unsafe_blocks, r=Manishearth
Allow safety comment above attributes

Closes #8679

changelog: Enhancement: [`undocumented_safety_block`]: Added `accept-comment-above-attributes` configuration.
2023-06-20 05:04:46 +00:00
Centri3
cc2e49f695 allow safety comment above attributes 2023-06-19 23:46:57 -05:00
Centri3
2cd4a9182a Ignore functions annotated with #[test] 2023-06-18 19:32:38 -05:00
Renato Lochetti
e2e6a02445
Addressing reviewer comments 2023-06-17 09:36:38 -03:00
Renato Lochetti
520228b377
Adding configuration to allow safety comment above stmt containing unsafe block 2023-06-17 09:36:36 -03:00
y21
6ad7c6f4e6 update lint_configuration.md 2023-06-12 12:21:38 +02:00
y21
c8c7a3c79c fix rebase weirdness 2023-06-12 12:21:38 +02:00
y21
7312a93a06 new lint: large_stack_frames 2023-06-12 12:21:38 +02:00
Centri3
203e875189 cargo collect-metadata 2023-06-12 03:22:01 -05:00
Centri3
243943ff56 make it work for locals as well
oopos
2023-06-12 03:22:01 -05:00
bors
e986b6444e Auto merge of #10917 - Centri3:module_inception, r=xFrednet
allow disabling module inception on private modules

Fixes #10842

changelog: Enhancement [`module_inception`]: Added `allow-private-module-inception` configuration.
[#10917](https://github.com/rust-lang/rust-clippy/pull/10917)
<!-- changelog_checked -->
2023-06-10 13:21:48 +00:00
Centri3
b303e2053c allow disabling module inception on private modules
allow disabling module inception on private modules
2023-06-10 08:09:07 -05:00
Centri3
725399a178 move to complexity but don't lint by default 2023-06-07 18:34:34 -05:00
Centri3
88143ac295 decided against reinventing the wheel 2023-06-07 18:34:34 -05:00
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
MarcusGrass
194343fcea
Explain path-search using a list 2023-06-01 12:54:20 +02:00
MarcusGrass
5f5e2e2ac1
Explain which paths clippy searches for configuration in docs 2023-06-01 12:14:55 +02:00
adrianEffe
591f5f7ea9
Update urls in Type Checking 2023-05-17 22:55:14 +03:00
blyxyas
b7a6054712
Refresh Lint Configuration's looks 2023-05-09 21:39:24 +02:00
Sergen Karaoglan
d1f55e6b53 run linkcheck in Remark CI
fix new lints link

install nightly rust-docs

run linkcheck without nightly toolchain

remove nightly toolchain, add rust-docs component

Test Remark

Update basics.md

Update basics.md

Update basics.md

update workflow

add rust docs toolchain

Update remark.yml

workflow test

manual test

update book path

add linkcheck book to CI

Update lint_passes.md
2023-04-28 15:11:48 +01: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
8c8cf40707 Update lint_configuration.md 2023-04-25 14:44:56 -05:00
bors
a7335cbf90 Auto merge of #10712 - blyxyas:fix-fixflag_implies_all_targets, r=llogiq
Document that `cargo clippy --fix` implies `--all-targets`

In [`cargo fix`'s documentation](https://doc.rust-lang.org/cargo/commands/cargo-fix.html) they indicate that `fix` implies `--all-targets` if no target is supplied. As Clippy uses Cargo under the hood, this also applies to Clippy, but we didn't document that behaviour.

This PR changes that

Fixes #10690
changelog: Add to documentation that `--fix` implies `--all-targets`
2023-04-25 17:11:52 +00:00
blyxyas
4a76b6f04f
Add the warning to all documentation. 2023-04-25 02:05:32 +02:00
bors
96f8471d81 Auto merge of #10649 - jsoref:spelling, r=Jarcho
Spelling

This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling).

The misspellings have been reported at https://github.com/jsoref/rust-clippy/actions/runs/4710771873#summary-12776860721

The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-clippy/actions/runs/4710771874#summary-12776860722

changelog: none
2023-04-23 22:30:06 +00:00
Josh Soref
d2061faf9e Spelling
* applying
* binding
* complex
* constituent
* demonstrate
* desugaring
* exact
* expression
* for
* functionalities
* github
* implementation
* infers
* multiple conflicting traits
* mutable
* necessarily
* nightly
* nonexistent
* optional
* parameter
* reassignments
* resources
* substitution
* suggestion
* that
* that array is
* using the

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-23 10:52:27 -04:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
bors
0c44586ff7 Auto merge of #10651 - lukaslueg:issue10641, r=xFrednet
Add size-parameter to unecessary_box_returns

Fixes #10641

This adds a configuration-knob to the `unecessary_box_returns`-lint which allows _not_ linting a `fn() -> Box<T>` if `T` is "large". The default byte size above which we no longer lint is 128 bytes (due to https://github.com/rust-lang/rust-clippy/issues/4652#issue-505670554, also used in #9373). The overall rational is given in #10641.

---

changelog: Enhancement: [`unnecessary_box_returns`]: Added new lint configuration `unnecessary-box-size` to set the maximum size of `T` in `Box<T>` to be linted
[#10651](https://github.com/rust-lang/rust-clippy/pull/10651)
<!-- changelog_checked -->
2023-04-19 12:42:33 +00:00
Lukas Lueg
4bc68f9c60 Add size-parameter to unecessary_box_returns
Fixes #10641
2023-04-19 14:32:05 +02:00
bors
90cb0fa2f3 Auto merge of #10652 - blyxyas:book-macro_expansions, r=flip1995
Clippy Book Chapter Updates Reborn: Macro Expansions

This PR adds a new chapter to the book: "Macro Expansions". There weren't big changes apart from grammar, re-phrasing and stylistic choices.

## Notes

- **Does not require any other chapter** to be merged before this
- To talk 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 "Macro Expansions" chapter to the book

r? `@flip1995`
2023-04-16 21:17:46 +00:00
blyxyas
e3a352d0bb
Add new chapter: "Macro Expansions"
Co-authored-by: Nahua <kangnahua@gmail.com>
2023-04-16 23:16:27 +02:00
Philipp Krones
b842e99ddf
Make warning about hir_ty_to_ty more visible 2023-04-16 21:08:59 +02:00
Philipp Krones
fbb69dea91
Improve type checking and lint passes chapters
Adds the lint passes chapter to the index.

Moves additional reading material for beginners to the front page of the
development section.

Clarify some details in hir::Ty vs ty::Ty.
2023-04-16 20:59:25 +02:00
bors
004981647f Auto merge of #10622 - blyxyas:book-lint_passes, r=llogiq
Clippy Book Chapter Updates Reborn: Lint Passes

This PR adds a new chapter to the book: "Lint passes". No major changes apart from some re-phrasing, fixing typos... etc.

## Notes

- Requires #10595 to be merged before this one (Or else, a link will be broken).
- To talk 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 "Lint passes" chapter to the book
r? `@flip1995`
2023-04-14 17:04:54 +00:00
blyxyas
b4732679fc
Talk about symbol information in "Early Lint Pass" 2023-04-12 23:59:56 +02:00
Philipp Krones
0266a9e9a3
Fix links in Clippy book
Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.

Also use the latest mdbook version in CI.
2023-04-11 14:43:47 +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
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
blyxyas
90e6ddc8e7
New chapter: "Type Checking" 2023-04-07 13:11:18 +02:00
blyxyas
cf260bc90f
Fix broken links for Rust merge 2023-04-06 22:02:23 +02:00