Commit Graph

20826 Commits

Author SHA1 Message Date
xFrednet
9d82fb460a
Lintcheck: More info on Diags without spans 2024-07-18 16:41:06 +02:00
xFrednet
31fdc2ec09
Lintcheck: Remove rust-toolchain from downloaded crates 2024-07-18 16:41:05 +02:00
bors
b31bce4f5f Auto merge of #13104 - xFrednet:00000-lintcheck-better-md-links, r=Alexendoo
Lintcheck: Add URL to lint emission place in diff

This PR adds links to the emission code in our lintcheck CI. When reviewing changes, I would like to be able to see the bigger context, which isn't always included in the lint message. This PR adds a nice link to the lintcheck diff that allows for simple investigation of the code in question.

At first, I wanted to simply use the doc.rs links and call it a day, but then I figured out that some crates might have their source files remapped. Cargo was the crate that made me notice this. As a response, I made the link configurable. (See https://github.com/rust-lang/docs.rs/issues/2551 for a detailed explanation and possible solution to remove this workaround in the future.)

It's probably easiest to review the individual commits. The last one is just a dummy to showcase the change.

[🖼️ rendered 🖼️](https://github.com/rust-lang/rust-clippy/actions/runs/9960834924?pr=13104)

---

r? `@Alexendoo`

changelog: none

---

That's it, I hope that everyone who's reading this has a beautiful day :D
2024-07-18 13:31:12 +00:00
xFrednet
0e3d19799c
Lintcheck: Construct links for sources 2024-07-18 15:28:14 +02:00
bors
bc2feea519 Auto merge of #13117 - GuillaumeGomez:fix-single_element_loop-suggestion, r=Alexendoo
Fix wrong suggestion for `single_element_loop` where parens were missing

Fixes https://github.com/rust-lang/rust-clippy/issues/12782.

changelog: Fix missing parens in `single_element_loop` suggestion
2024-07-18 12:53:59 +00:00
Guillaume Gomez
8dd310ddd7 Fix wrong suggestion for single_element_loop where parens were missing 2024-07-18 14:50:45 +02:00
bors
073f9d9080 Auto merge of #13116 - tesuji:fix_zero_repeat_side_effects, r=y21
Lint `zero_repeat_side_effects`  only if array length is a literal zero

changelog: [`zero_repeat_side_effects` ] Lint only if array length is a literal zero
Fixes #13110 .
r? y21
2024-07-18 11:56:13 +00:00
Ralf Jung
b0209dc028 valtree construction: keep track of which type was valtree-incompatible 2024-07-18 11:58:16 +02:00
Lzu Tao
3c50e7af5a Lint only if array length is a literal zero. 2024-07-18 12:22:08 +07:00
bors
acc41f4239 Auto merge of #13100 - Alexendoo:dogfood-progress, r=xFrednet
Show progress while running dogfood test

Outputs the regular cargo progress in colour when running the dogfood test, helpful to see because it can take a long time to run

changelog: none
2024-07-17 18:41:48 +00:00
bors
f74037e47a Auto merge of #13088 - Jarcho:conf_refactor2, r=flip1995
Create lint passes using `Conf`

This slightly reduces the amount of code changes needed to add a config to a lint and makes things makes things more consistent between passes. A dependence on the config being a static reference is also added. This would only ever be a problem if multiple crates end up compiled in a single process.

Other changes include:
* Removing useless `#[derive(..)]`s
* Removing `#[must_use]` on lint pass constructors.
* Unified the parsing of the `DisallowedPath` struct in lint passes.
* Update `disallowed_types` and `await_holding_invalid` messages to be consistent with other disallowed lints.
* Remove the `(from clippy.toml)` message. I plan on having all the configured lints point to point to a span in `clippy.toml` which will be more useful.

changelog: none
2024-07-17 18:13:07 +00:00
Jason Newcomb
e34c6dbae5 Refactor for using config values:
* Construct lint passes by taking `Conf` by reference.
* Use `HashSet` configs in less places
* Move some `check_crate` code into the pass constructor when possible.
2024-07-17 14:05:49 -04:00
Alex Macleod
0b0c39ca4d Show progress while running dogfood test 2024-07-17 12:29:18 +00:00
Lzu Tao
5540060d5d Skip linting if array length is from a macro. 2024-07-17 18:33:36 +07:00
Lzu Tao
c65ddb8728 Add regression test for issue 13110 2024-07-17 18:32:18 +07:00
Lzu Tao
a5fd2c98bd Remove duplicated peel_middle_ty_refs
TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too?
2024-07-17 12:51:08 +07:00
Noah Lev
f2c1265483 Add ConstArgKind::Path and make ConstArg its own HIR node
This is a very large commit since a lot needs to be changed in order to
make the tests pass. The salient changes are:

- `ConstArgKind` gets a new `Path` variant, and all const params are now
  represented using it. Non-param paths still use `ConstArgKind::Anon`
  to prevent this change from getting too large, but they will soon use
  the `Path` variant too.

- `ConstArg` gets a distinct `hir_id` field and its own variant in
  `hir::Node`. This affected many parts of the compiler that expected
  the parent of an `AnonConst` to be the containing context (e.g., an
  array repeat expression). They have been changed to check the
  "grandparent" where necessary.

- Some `ast::AnonConst`s now have their `DefId`s created in
  rustc_ast_lowering rather than `DefCollector`. This is because in some
  cases they will end up becoming a `ConstArgKind::Path` instead, which
  has no `DefId`. We have to solve this in a hacky way where we guess
  whether the `AnonConst` could end up as a path const since we can't
  know for sure until after name resolution (`N` could refer to a free
  const or a nullary struct). If it has no chance as being a const
  param, then we create a `DefId` in `DefCollector` -- otherwise we
  decide during ast_lowering. This will have to be updated once all path
  consts use `ConstArgKind::Path`.

- We explicitly use `ConstArgHasType` for array lengths, rather than
  implicitly relying on anon const type feeding -- this is due to the
  addition of `ConstArgKind::Path`.

- Some tests have their outputs changed, but the changes are for the
  most part minor (including removing duplicate or almost-duplicate
  errors). One test now ICEs, but it is for an incomplete, unstable
  feature and is now tracked at #127009.
2024-07-16 19:27:28 -07:00
Noah Lev
6e99e2d748 Use ConstArg for array lengths 2024-07-16 19:27:28 -07:00
Noah Lev
620a056a33 hir: Create hir::ConstArgKind enum
This will allow lowering const params to a dedicated enum variant, rather
than to an `AnonConst` that is later examined during `ty` lowering.
2024-07-16 19:27:28 -07:00
Yuri Astrakhan
197b444407 Ignore underscore-prefixed args for needless_pass_by_value lint
When a user explicitly tags a param as unused (yet?), there is no need to raise another lint on it.
2024-07-16 18:00:11 -04:00
bors
0ee9f44568 Auto merge of #13096 - apoisternex:issue12954, r=y21
fix [`excessive_precision`] suggestions on floats written in scientific notation

fixes #12954

changelog: fix [`excessive_precision`] suggestions on float literal written in scientific notation
2024-07-16 12:56:10 +00:00
yaxum62
1821defc39 add expected output for try_err test 2024-07-15 21:54:15 -07:00
yaxum62
fceeb13399 Add test for try_err lint within try blocks. 2024-07-15 21:21:52 -07:00
Michael Goulet
c1c945a350 Move rustc_infer::infer::error_reporting to rustc_infer::error_reporting::infer 2024-07-15 20:16:12 -04:00
apoisternex
489a77831c fix [excessive_precision] suggestions on float literal written in scientific notation
fixes: #12954

changelog: fix [`excessive_precision`] suggestions on float literal written in scientific notation
2024-07-15 18:52:18 -03:00
bors
eb4d88e690 Auto merge of #13102 - tesuji:fix-needless_option_as_deref, r=Alexendoo
Fix `needless_option_as_deref` false-positive on struct literals

changelog: [`needless_option_as_deref`] Fix false-positive on struct literals.

Fixes #13077 .

r?  Alexendoo
2024-07-15 16:23:41 +00:00
Lzu Tao
dcee2e8a0f Dont stop find loop node at struct field node 2024-07-15 15:56:17 +00:00
Lzu Tao
4264548283 Add regression test for issue 13077 2024-07-15 15:55:22 +00:00
bors
22eeb1109b Auto merge of #13098 - oli-obk:bump_ui_test, r=Alexendoo
Bump ui_test version

r? `@alexendoo`

the rustfix diff is caused by https://github.com/oli-obk/ui_test/pull/244

This should solve the issues around missing summaries at the end

changelog: none
2024-07-15 12:29:11 +00:00
Oli Scherer
3b390d416d Bump clippy version 2024-07-15 08:51:04 +00:00
Michael Goulet
185f4b06a7 Fix trivial gen ident usage in tools 2024-07-14 14:52:36 -04:00
bors
10ba798736 Auto merge of #13093 - waywardmonkeys:more-doc-valid-idents, r=Alexendoo
Add more doc-valid-idents

* "AccessKit" is a commonly used accessibility toolkit used in Rust GUIs.
* "CoreFoundation", "CoreGraphics", "CoreText" are frameworks on Apple OSes.
* "Direct2D", "Direct3D", "DirectWrite" are frameworks on Windows
* "PostScript" is a programming language and is mentioned when talking about text and vector graphics.
* "OpenAL" is an audio framework / API.
* "OpenType" is a font format (TrueType is already mentioned).
* "WebRTC", "WebSocket", "WebTransport" are web networking technologies.
* "NetBSD" and "OpenBSD" are like the already included FreeBSD.

changelog: [`doc_markdown`]: Add AccessKit, CoreFoundation, CoreGraphics, CoreText, Direct2D, Direct3D, DirectWrite, PostScript, OpenAL, OpenType, WebRTC, WebSocket, WebTransport, NetBSD, and OpenBSD to `doc-valid-idents`.
2024-07-14 14:09:20 +00:00
bors
206e4adb52 Auto merge of #13046 - Jarcho:check_conv, r=dswij
Refactor `checked_conversions`

Removes redundant checks across functions and check the HIR tree before anything else.

changelog: none
2024-07-13 16:07:29 +00:00
bors
e7d17e6cb2 Auto merge of #13061 - tesuji:fix-map-unwrap-or-13018, r=dswij
Fix `manual_unwrap_or` false positive

changelog: [`manual_unwrap_or`]: fix false positive of `if let Option<T>`

Closes #13018
2024-07-13 15:59:11 +00:00
bors
1aac7783ef Auto merge of #13085 - J-ZhengLi:issue12973, r=llogiq
make [`or_fun_call`] recursive.

fixes: #12973

---

changelog: make [`or_fun_call`] recursive.
2024-07-13 15:38:23 +00:00
J-ZhengLi
cc1bb8f57a make [or_fun_call] and [unwrap_or_default] recursive. 2024-07-13 23:15:40 +08:00
Bruce Mitchener
39378cf4f4 Add more doc-valid-idents
* "AccessKit" is a commonly used accessibility toolkit used in Rust GUIs.
* "CoreFoundation", "CoreGraphics", "CoreText" are frameworks on Apple OSes.
* "Direct2D", "Direct3D", "DirectWrite" are frameworks on Windows
* "PostScript" is a programming language and is mentioned when talking about
  text and vector graphics.
* "OpenAL" is an audio framework / API.
* "OpenType" is a font format (TrueType is already mentioned).
* "WebRTC", "WebSocket", "WebTransport" are web networking technologies.
* "NetBSD" and "OpenBSD" are like the already included FreeBSD.
2024-07-13 15:50:29 +07:00
bors
0cbbee1e6e Auto merge of #13090 - J-ZhengLi:issue9790, r=blyxyas
[`unwrap_or_default`]: skip warning when calling inside of suggested method's implementation

fixes: #10228

---

changelog: [`unwrap_or_default`]: skip warning when calling inside of suggested method's implementation
2024-07-12 14:37:10 +00:00
bors
51a1cf0787 Auto merge of #13089 - flba-eb:fix_example, r=y21
Fix syntax errors in example code (clippy::cast_nan_to_int)

Fix two small syntax errors to make the examples compile.

changelog: none
2024-07-12 09:30:24 +00:00
J-ZhengLi
983b4c3720 [unwrap_or_default]: skip warning when calling inside of suggested method's implementation 2024-07-12 17:23:08 +08:00
Florian Bartels
edeb0fcddc Fix syntax errors in example code 2024-07-12 11:12:01 +02:00
bors
86d348df90 Auto merge of #12656 - SpencerAWill:Add-expand-all-to-the-web-site, r=xFrednet
Add 'Expand All' & 'Collapse All' to the website

changelog: Add 'Expand All' and 'Collapse All' buttons to the website.
Fixes #12542

Desktop view:
![image](https://github.com/rust-lang/rust-clippy/assets/43732866/554d7782-352c-4705-83f0-1cbc809a3290)

Mobile view:
![image](https://github.com/rust-lang/rust-clippy/assets/43732866/2845fc9a-a9e8-4057-b7dd-a8a1dbf47290)

I did have some slight performance issues with lots of tabs being open. In the future it may be worth it to consider virtual scrolling. I'm not sure if this would allow ctrl+f finding on all the lints since the DOM won't contain the text of all the lints, just those that need to be immediately shown.
2024-07-11 20:04:46 +00:00
Spencer Will
6ae5fd958f
Remove event propagation calls. Adjust column spacing for filter panel to give more space for buttons on smaller screens. 2024-07-11 21:59:33 +02:00
Spencer Will
8bfd992953
Fix button styling on desktop and mobile views. 2024-07-11 21:58:51 +02:00
Spencer Will
d5e1acae82
Add Expand All and Collapse All 2024-07-11 21:58:47 +02:00
Philipp Krones
c1fd25d0aa Merge commit 'b794b8e08c16517a941dc598bb1483e8e12a8592' into clippy-subtree-update 2024-07-11 15:44:03 +02:00
bors
b794b8e08c Auto merge of #13086 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-07-11 13:32:36 +00:00
Philipp Krones
3b1266cd31
Bump nightly version -> 2024-07-11 2024-07-11 15:29:22 +02:00
Philipp Krones
1ced73e66a
Merge remote-tracking branch 'upstream/master' into rustup 2024-07-11 15:29:08 +02:00
Urgau
5f3a6e1805 Remove unary neg from clippy::precedence lint 2024-07-11 00:46:47 +02:00