-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 9 pull requests #120824
Rollup of 9 pull requests #120824
Commits on Nov 15, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b587871 - Browse repository at this point
Copy the full SHA b587871View commit details -
Configuration menu - View commit details
-
Copy full SHA for cdc4c69 - Browse repository at this point
Copy the full SHA cdc4c69View commit details
Commits on Dec 26, 2023
-
FP:
needless_return_with_question_mark
with implicit Error ConversionReturn with a question mark was triggered in situations where the `?` desuraging was performing error conversion via `Into`/`From`. The desugared `?` produces a match over an expression with type `std::ops::ControlFlow<B,C>` with `B:Result<Infallible, E:Error>` and `C:Result<_, E':Error>`, and the arms perform the conversion. The patch adds another check in the lint that checks that `E == E'`. If `E == E'`, then the `?` is indeed unnecessary. changelog: False Positive: `needless_return_with_question_mark` when implicit Error Conversion occurs.
Configuration menu - View commit details
-
Copy full SHA for 57dd25e - Browse repository at this point
Copy the full SHA 57dd25eView commit details
Commits on Jan 3, 2024
-
Fix/Issue11932: assert* in multi-condition after unrolling will cause…
… lint emit warning
Configuration menu - View commit details
-
Copy full SHA for 090c228 - Browse repository at this point
Copy the full SHA 090c228View commit details -
Configuration menu - View commit details
-
Copy full SHA for b5a2192 - Browse repository at this point
Copy the full SHA b5a2192View commit details
Commits on Jan 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 03b3a16 - Browse repository at this point
Copy the full SHA 03b3a16View commit details
Commits on Jan 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bd6e920 - Browse repository at this point
Copy the full SHA bd6e920View commit details
Commits on Jan 13, 2024
-
Fixes FP in
redundant_closure_call
when closures are passed to macrosThere are cases where the closure call is needed in some macros, this in particular occurs when the closure has parameters. To handle this case, we allow the lint when there are no parameters in the closure, or the closure is outside a macro invocation. fixes: rust-lang#11274, rust-lang#1553 changelog: FP: [`redundant_closure_call`] when closures with parameters are passed in macros.
Configuration menu - View commit details
-
Copy full SHA for e0228ee - Browse repository at this point
Copy the full SHA e0228eeView commit details
Commits on Jan 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3b8f62f - Browse repository at this point
Copy the full SHA 3b8f62fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 32bbeba - Browse repository at this point
Copy the full SHA 32bbebaView commit details -
Configuration menu - View commit details
-
Copy full SHA for e86da9e - Browse repository at this point
Copy the full SHA e86da9eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b6cf3b - Browse repository at this point
Copy the full SHA 0b6cf3bView commit details
Commits on Jan 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 99d8d33 - Browse repository at this point
Copy the full SHA 99d8d33View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a850cd - Browse repository at this point
Copy the full SHA 8a850cdView commit details
Commits on Jan 25, 2024
-
Rename the unescaping functions.
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string` becomes `unescape_mixed`. Because rfc3349 will mean that C string literals will no longer be the only mixed utf8 literals.
Configuration menu - View commit details
-
Copy full SHA for 9cbc582 - Browse repository at this point
Copy the full SHA 9cbc582View commit details -
Don't warn about modulo arithmetic when comparing to zero
Add lint configuration for `modulo_arithmetic` Collect meta-data
Configuration menu - View commit details
-
Copy full SHA for e456c28 - Browse repository at this point
Copy the full SHA e456c28View commit details -
Configuration menu - View commit details
-
Copy full SHA for 58de630 - Browse repository at this point
Copy the full SHA 58de630View commit details -
Configuration menu - View commit details
-
Copy full SHA for 798865c - Browse repository at this point
Copy the full SHA 798865cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 42d13f8 - Browse repository at this point
Copy the full SHA 42d13f8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 87a6300 - Browse repository at this point
Copy the full SHA 87a6300View commit details -
Configuration menu - View commit details
-
Copy full SHA for fd3e966 - Browse repository at this point
Copy the full SHA fd3e966View commit details
Commits on Jan 26, 2024
-
Auto merge of rust-lang#116167 - RalfJung:structural-eq, r=lcnr
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust rust-lang#115893 to check for `Eq`, and rule out float matching for good. Fixes rust-lang#115881
Configuration menu - View commit details
-
Copy full SHA for a65fe78 - Browse repository at this point
Copy the full SHA a65fe78View commit details -
Auto merge of rust-lang#12202 - y21:issue12199, r=Jarcho
Avoid linting redundant closure when callee is marked `#[track_caller]` Fixes rust-lang#12199 Not sure if there's a nicer way to detect functions marked `#[track_caller]` other than by just looking at its attributes 🤔 changelog: [`redundant_closure`]: [`redundant_closure_for_method_calls`]: avoid linting closures where the function being called is marked `#[track_caller]`
Configuration menu - View commit details
-
Copy full SHA for ed74c22 - Browse repository at this point
Copy the full SHA ed74c22View commit details -
Clippy: Fix empty suggestion in from_over_into
Co-authored-by: y21 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9ce0b83 - Browse repository at this point
Copy the full SHA 9ce0b83View commit details -
Configuration menu - View commit details
-
Copy full SHA for 14e1520 - Browse repository at this point
Copy the full SHA 14e1520View commit details -
Auto merge of rust-lang#12160 - GuillaumeGomez:incompatible-msrv, r=b…
…lyxyas Warn if an item coming from more recent version than MSRV is used Part of rust-lang/rust-clippy#6324. ~~Currently, the lint is not working for the simple reason that the `stable` attribute is not kept in dependencies. I'll send a PR to rustc to see if they'd be okay with keeping it.~~ EDIT: There was actually a `lookup_stability` function providing this information, so all good now! cc `@epage` changelog: create new [`incompatible_msrv`] lint
Configuration menu - View commit details
-
Copy full SHA for 8de9d8c - Browse repository at this point
Copy the full SHA 8de9d8cView commit details -
Rollup merge of rust-lang#120329 - nnethercote:3349-precursors, r=fee…
…1-dead RFC 3349 precursors Some cleanups I found while working on RFC 3349 that are worth landing separately. r? `@fee1-dead`
Configuration menu - View commit details
-
Copy full SHA for f096e91 - Browse repository at this point
Copy the full SHA f096e91View commit details -
Rollup merge of rust-lang#120345 - flip1995:clippy-subtree-update, r=…
…Manishearth Clippy subtree update r? `@Manishearth` Closes rust-lang/rust-clippy#12148
Configuration menu - View commit details
-
Copy full SHA for 57f63a3 - Browse repository at this point
Copy the full SHA 57f63a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d94cc3 - Browse repository at this point
Copy the full SHA 1d94cc3View commit details -
Configuration menu - View commit details
-
Copy full SHA for f58950d - Browse repository at this point
Copy the full SHA f58950dView commit details
Commits on Jan 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 6d76d14 - Browse repository at this point
Copy the full SHA 6d76d14View commit details -
Auto merge of rust-lang#12082 - PartiallyTyped:1553, r=dswij
Fixed FP in `redundant_closure_call` when closures are passed to macros There are cases where the closure call is needed in some macros, this in particular occurs when the closure has parameters. To handle this case, we allow the lint when there are no parameters in the closure, or the closure is outside a macro invocation. fixes: rust-lang#11274 rust-lang#1553 changelog: FP: [`redundant_closure_call`] when closures with parameters are passed in macros.
Configuration menu - View commit details
-
Copy full SHA for 8905f78 - Browse repository at this point
Copy the full SHA 8905f78View commit details -
Auto merge of rust-lang#12178 - mdm:modulo-arithmetic-comparison-to-z…
…ero, r=llogiq Don't warn about modulo arithmetic when comparing to zero closes rust-lang#12006 By default, don't warn about modulo arithmetic when comparing to zero. This behavior is configurable via `clippy.toml`. See discussion [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.E2.9C.94.20Is.20issue.20.2312006.20worth.20implementing.3F) changelog: [`modulo_arithmetic`]: By default don't lint when comparing the result of a modulo operation to zero.
Configuration menu - View commit details
-
Copy full SHA for 855aa08 - Browse repository at this point
Copy the full SHA 855aa08View commit details -
Auto merge of rust-lang#12122 - andrewbanchich:tostring-impl, r=llogiq
add to_string_trait_impl lint closes rust-lang#12076 changelog: [`to_string_trait_impl`]: add lint for direct `ToString` implementations
Configuration menu - View commit details
-
Copy full SHA for 79f10cf - Browse repository at this point
Copy the full SHA 79f10cfView commit details -
Auto merge of rust-lang#12169 - GuillaumeGomez:unnecessary_result_map…
…_or_else, r=llogiq Add new `unnecessary_result_map_or_else` lint Fixes rust-lang/rust-clippy#7328. r? `@llogiq` changelog: Add new `unnecessary_result_map_or_else` lint
Configuration menu - View commit details
-
Copy full SHA for 85e08cd - Browse repository at this point
Copy the full SHA 85e08cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for a51fc2a - Browse repository at this point
Copy the full SHA a51fc2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ff5afac - Browse repository at this point
Copy the full SHA ff5afacView commit details -
Auto merge of rust-lang#12206 - y21:issue12205, r=Alexendoo
[`never_loop`]: recognize desugared `try` blocks Fixes rust-lang#12205 The old code assumed that only blocks with an explicit label can be jumped to (using `break`). This is mostly correct except for `try` desugaring, where the `?` operator is rewritten to a `break` to that block, even without a label on the block. `Block::targeted_by_break` is a little more accurate than just checking if a block has a label in that regard, so we should just use that instead changelog: [`never_loop`]: avoid linting when `?` is used inside of a try block
Configuration menu - View commit details
-
Copy full SHA for 18e1f25 - Browse repository at this point
Copy the full SHA 18e1f25View commit details -
Auto merge of rust-lang#12083 - cocodery:fix/issue11932, r=Alexendoo
Fix/Issue11932: assert* in multi-condition after unrolling will cause lint `nonminimal_bool` emit warning fixes [Issue#11932](rust-lang/rust-clippy#11932) After `assert`, `assert_eq`, `assert_ne`, etc, assert family marcos unrolling in multi-condition expressions, lint `nonminimal_bool` will recognize whole expression as a entirety, analyze each simple condition expr of them, and check whether can simplify them. But `assert` itself is a entirety to programmers, we don't need to lint on `assert`. This commit add check whether lint snippet contains `assert` when try to warning to an expression. changelog: [`nonminimal_bool`] add check for condition expression
Configuration menu - View commit details
-
Copy full SHA for 276ce39 - Browse repository at this point
Copy the full SHA 276ce39View commit details -
Auto merge of rust-lang#12084 - yuxqiu:manual_retain, r=Alexendoo
fix: incorrect suggestions generated by `manual_retain` lint fixes rust-lang#10393, fixes rust-lang#11457, fixes rust-lang#12081 rust-lang#10393: In the current implementation of `manual_retain`, if the argument to the closure is matched using tuple, they are all treated as the result of a call to `map.into_iter().filter(<f>)`. However, such tuple pattern matching can also occur in many different containers that stores tuples internally. The correct approach is to apply different lint policies depending on whether the receiver of `into_iter` is a map or not. rust-lang#11457 and rust-lang#12081: In the current implementation of `manual_retain`, if the argument to the closure is `Binding`, the closure will be used directly in the `retain` method, which will result in incorrect suggestion because the first argument to the `retain` closure may be of a different type. In addition, if the argument to the closure is `Ref + Binding`, the lint will simply remove the `Ref` part and use the `Binding` part as the argument to the new closure, which will lead to bad suggestion for the same reason. The correct approach is to detect each of these cases and apply lint suggestions conservatively. changelog: [`manual_retain`] refactor and add check for various patterns
Configuration menu - View commit details
-
Copy full SHA for 8ccf6a6 - Browse repository at this point
Copy the full SHA 8ccf6a6View commit details
Commits on Jan 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3aa2c27 - Browse repository at this point
Copy the full SHA 3aa2c27View commit details
Commits on Jan 29, 2024
-
Auto merge of rust-lang#12021 - PartiallyTyped:11982, r=flip1995
FP: `needless_return_with_question_mark` with implicit Error Conversion Return with a question mark was triggered in situations where the `?` desuraging was performing error conversion via `Into`/`From`. The desugared `?` produces a match over an expression with type `std::ops::ControlFlow<B,C>` with `B:Result<Infallible, E:Error>` and `C:Result<_, E':Error>`, and the arms perform the conversion. The patch adds another check in the lint that checks that `E == E'`. If `E == E'`, then the `?` is indeed unnecessary. changelog: False Positive: [`needless_return_with_question_mark`] when implicit Error Conversion occurs. fixes: rust-lang#11982
Configuration menu - View commit details
-
Copy full SHA for e7a3cb7 - Browse repository at this point
Copy the full SHA e7a3cb7View commit details -
Make
redundant_closure_for_method_calls
suggest relative pathsFixes rust-lang#10854. Co-authored-by: Alejandra González <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b3d5377 - Browse repository at this point
Copy the full SHA b3d5377View commit details -
Configuration menu - View commit details
-
Copy full SHA for b2f2080 - Browse repository at this point
Copy the full SHA b2f2080View commit details -
Configuration menu - View commit details
-
Copy full SHA for ce8b4b6 - Browse repository at this point
Copy the full SHA ce8b4b6View commit details -
Auto merge of rust-lang#11370 - modelflat:suggest-relpath-in-redundan…
…t-closure-for-method-calls, r=blyxyas [fix] [`redundant_closure_for_method_calls`] Suggest relative paths for local modules Fixes rust-lang#10854. Currently, `redundant_closure_for_method_calls` suggest incorrect paths when a method defined on a struct within inline mod is referenced (see the description in the aforementioned issue for an example; also see [this playground link](https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=f7d3c5b2663c9bd3ab7abdb0bd38ee43) for the current-version output for the test cases added in this PR). It will now try to construct a relative path path to the module and suggest it instead. changelog: [`redundant_closure_for_method_calls`] Fix incorrect path suggestions for types within local modules
Configuration menu - View commit details
-
Copy full SHA for 3cd713a - Browse repository at this point
Copy the full SHA 3cd713aView commit details -
Makes clippy-driver check for --sysroot in arg files
Vinh Tran committedJan 29, 2024 Configuration menu - View commit details
-
Copy full SHA for 73706e8 - Browse repository at this point
Copy the full SHA 73706e8View commit details -
Auto merge of rust-lang#12203 - daivinhtran:fix-clippy-driver-to-acce…
…pt-param-file, r=flip1995 Makes clippy-driver check for --sysroot in arg files Fixes rust-lang/rust-clippy#12201 --- changelog: none cc: `@UebelAndre` `@illicitonion`
Configuration menu - View commit details
-
Copy full SHA for 1156375 - Browse repository at this point
Copy the full SHA 1156375View commit details -
Auto merge of rust-lang#12210 - GuillaumeGomez:add-regression-test-23…
…71, r=blyxyas Add regression ui test for rust-lang#2371 Fixes rust-lang#2371. rust-lang#2371 seems to already be handled correctly in the lint. This PR adds a ui regression test so we can close it. r? `@blyxyas` changelog: Add regression ui test for rust-lang#2371
Configuration menu - View commit details
-
Copy full SHA for 455c07b - Browse repository at this point
Copy the full SHA 455c07bView commit details
Commits on Jan 30, 2024
-
Configuration menu - View commit details
-
Copy full SHA for d02df12 - Browse repository at this point
Copy the full SHA d02df12View commit details -
Configuration menu - View commit details
-
Copy full SHA for 314bdde - Browse repository at this point
Copy the full SHA 314bddeView commit details -
hir: Simplify
hir_owner_nodes
queryThe query accept arbitrary DefIds, not just owner DefIds. The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom. Also rename the query to `opt_hir_owner_nodes`.
Configuration menu - View commit details
-
Copy full SHA for c0f49a9 - Browse repository at this point
Copy the full SHA c0f49a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7539054 - Browse repository at this point
Copy the full SHA 7539054View commit details -
Configuration menu - View commit details
-
Copy full SHA for 233c8c9 - Browse repository at this point
Copy the full SHA 233c8c9View commit details -
Rollup merge of rust-lang#120342 - oli-obk:track_errors6, r=nnethercote
Remove various `has_errors` or `err_count` uses follow up to rust-lang#119895 r? `@nnethercote` since you recently did something similar. There are so many more of these, but I wanted to get a PR out instead of growing the commit list indefinitely. The commits all work on their own and can be reviewed commit by commit.
Configuration menu - View commit details
-
Copy full SHA for f0dbf68 - Browse repository at this point
Copy the full SHA f0dbf68View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3106219 - Browse repository at this point
Copy the full SHA 3106219View commit details -
Don't hash lints differently to non-lints.
`Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in rust-lang#88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ^^^^^^^^^^^^^^^^ ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar.
Configuration menu - View commit details
-
Copy full SHA for ae0f0fd - Browse repository at this point
Copy the full SHA ae0f0fdView commit details
Commits on Jan 31, 2024
-
Auto merge of rust-lang#120346 - petrochenkov:ownodes, r=oli-obk
hir: Refactor getters for owner nodes
Configuration menu - View commit details
-
Copy full SHA for 9e3bb89 - Browse repository at this point
Copy the full SHA 9e3bb89View commit details -
Rollup merge of rust-lang#120490 - nnethercote:Diagnostic-hashing, r=…
…estebank Don't hash lints differently to non-lints. `Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in rust-lang#88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar. r? `@estebank`
Configuration menu - View commit details
-
Copy full SHA for 7836678 - Browse repository at this point
Copy the full SHA 7836678View commit details -
Warns when a lint group in Cargo.toml's `[lints]` section shares the same priority as a lint
Configuration menu - View commit details
-
Copy full SHA for 6619e8c - Browse repository at this point
Copy the full SHA 6619e8cView commit details -
Auto merge of rust-lang#11832 - Alexendoo:lint-groups-priority, r=fli…
…p1995 Add `lint_groups_priority` lint Warns when a lint group in Cargo.toml's `[lints]` section shares the same priority as a lint. This is in the cargo section but is categorised as `correctness` so it's on by default, it doesn't call `cargo metadata` though and parses the `Cargo.toml` directly The lint should be temporary until rust-lang/cargo#12918 is resolved, but in the meanwhile this is an common issue to run into - rust-lang#11237 - rust-lang#11751 - rust-lang#11830 changelog: Add [`lint_groups_priority`] lint r? `@flip1995`
Configuration menu - View commit details
-
Copy full SHA for b58b88c - Browse repository at this point
Copy the full SHA b58b88cView commit details
Commits on Feb 1, 2024
-
Fixed FP in
unused_io_amount
forOk(lit)
,unrachable!
We introduce the following rules for match exprs. - `panic!` and `unreachable!` are treated as consumption. - guard expressions in any arm imply consumption. For match exprs: - Lint only if exacrtly 2 non-consuming arms exist - Lint only if one arm is an `Ok(_)` and the other is `Err(_)` Added additional requirement that for a block return expression that is a match, the source must be `Normal`. changelog: FP [`unused_io_amount`] when matching Ok(literal)
Configuration menu - View commit details
-
Copy full SHA for fe8c2e2 - Browse repository at this point
Copy the full SHA fe8c2e2View commit details
Commits on Feb 2, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 46dd826 - Browse repository at this point
Copy the full SHA 46dd826View commit details -
Auto merge of rust-lang#12217 - PartiallyTyped:12208, r=blyxyas
Fixed FP in `unused_io_amount` for Ok(lit), unrachable! and unwrap de… …sugar Fixes fp caused by linting on Ok(_) for all cases outside binding. We introduce the following rules for match exprs. - `panic!` and `unreachable!` are treated as consumed. - `Ok( )` patterns outside `DotDot` and `Wild` are treated as consuming. changelog: FP [`unused_io_amount`] when matching Ok(literal) or unreachable fixes rust-lang#12208 r? `@blyxyas`
Configuration menu - View commit details
-
Copy full SHA for 9b6f866 - Browse repository at this point
Copy the full SHA 9b6f866View commit details -
Auto merge of rust-lang#11979 - J-ZhengLi:issue11428, r=Alexendoo
add configuration for [`wildcard_imports`] to ignore certain imports fixes: rust-lang#11428 changelog: add configuration `ignored-wildcard-imports` for lint [`wildcard_imports`]
Configuration menu - View commit details
-
Copy full SHA for c82162e - Browse repository at this point
Copy the full SHA c82162eView commit details
Commits on Feb 3, 2024
-
std::thread::available_parallelism merging linux/android/freebsd version
FreeBSD 13.1 had introduced a sched cpu affinity compatibility layer with Linux. 13.0 and even 13.1 being EOL, we can simplify here.
Configuration menu - View commit details
-
Copy full SHA for 0bfcafd - Browse repository at this point
Copy the full SHA 0bfcafdView commit details -
Configuration menu - View commit details
-
Copy full SHA for abced20 - Browse repository at this point
Copy the full SHA abced20View commit details -
Auto merge of rust-lang#12219 - sanxiyn:labeled-block, r=blyxyas
Avoid deleting labeled blocks Fix rust-lang#11575. changelog: [`unnecessary_operation`]: skip labeled blocks
Configuration menu - View commit details
-
Copy full SHA for 9fb4107 - Browse repository at this point
Copy the full SHA 9fb4107View commit details
Commits on Feb 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for be47e32 - Browse repository at this point
Copy the full SHA be47e32View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa1de4d - Browse repository at this point
Copy the full SHA aa1de4dView commit details -
Author: Marcin Serwin <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a3baebc - Browse repository at this point
Copy the full SHA a3baebcView commit details -
Auto merge of rust-lang#12087 - marcin-serwin:ref_as_ptr_cast, r=blyxyas
Add new lint: `ref_as_ptr` Fixes rust-lang#10130 Added new lint `ref_as_ptr` that checks for conversions from references to pointers and suggests using `std::ptr::from_{ref, mut}` instead. The name is different than suggested in the issue (`as_ptr_cast`) since there were some other lints with similar names (`ptr_as_ptr`, `borrow_as_ptr`) and I wanted to follow the convention. Note that this lint conflicts with the `borrow_as_ptr` lint in the sense that it recommends changing `&foo as *const _` to `std::ptr::from_ref(&foo)` instead of `std::ptr::addr_of!(foo)`. Personally, I think the former is more readable and, in contrast to `addr_of` macro, can be also applied to temporaries (cf. rust-lang#9884). --- changelog: New lint: [`ref_as_ptr`] [rust-lang#12087](rust-lang/rust-clippy#12087)
Configuration menu - View commit details
-
Copy full SHA for 34e4c9f - Browse repository at this point
Copy the full SHA 34e4c9fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c3908f - Browse repository at this point
Copy the full SHA 7c3908fView commit details
Commits on Feb 5, 2024
-
Auto merge of rust-lang#12224 - xFrednet:chaneglog-1-76, r=Manishearth
Changelog for Clippy 1.76 🐈 Roses are red, Violets are blue, So many cute cats, How to choose? --- ### The cat of this release is: *Cabrel* submitted by `@daniel-g-gagnon:` <img height=500 src="https://github.com/rust-lang/rust-clippy/assets/17087237/41aea3dc-7935-4dfe-80ff-a6efd92f76ab" alt="The cats of this Clippy release" /> The cat for the next release can be voted on: [here](https://docs.google.com/forms/d/e/1FAIpQLSfERam31AEi3_5uVsugi1-JHGF9Po1oC7OIiLs8jglprZNy_g/viewform) The cat for the next next release can be nominated in the comments and will be voted in the next changelog PR (Submission deadline is 2024-02-06 23:59CET) --- changelog: none
Configuration menu - View commit details
-
Copy full SHA for 8baeb26 - Browse repository at this point
Copy the full SHA 8baeb26View commit details -
Rollup merge of rust-lang#116284 - RalfJung:no-nan-match, r=cjgillot
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error. This is part of implementing rust-lang/rfcs#3535. Closes rust-lang#41620 by removing the lint. rust-lang/reference#1456 updates the reference to match.
Configuration menu - View commit details
-
Copy full SHA for d13ce19 - Browse repository at this point
Copy the full SHA d13ce19View commit details -
std::thread update freensd stack guard handling.
up to now, it had been assumed the stack guard setting default is not touched in the field but some user might just want to disable it or increase it. checking it once at runtime should be enough.
Configuration menu - View commit details
-
Copy full SHA for ff3fd6a - Browse repository at this point
Copy the full SHA ff3fd6aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6807977 - Browse repository at this point
Copy the full SHA 6807977View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f80b44 - Browse repository at this point
Copy the full SHA 7f80b44View commit details -
Auto merge of rust-lang#11919 - y21:manual_c_str_literals, r=xFrednet
new lint: `manual_c_str_literals` With rust-lang#117472 merged and `c""` syntax stabilized, I think it'd be nice to have a lint for using `CStr::from_ptr` (and similar constructors) with a string literal as an argument. We can probably also lint `"foo\0".as_ptr()` and suggest `c"foo".as_ptr()`. I might add that to this PR tomorrow if I find the time. The byte string literal to c string literal rewriting is ugly but oh well. changelog: new lint: `manual_c_str_literals` [rust-lang#11919](rust-lang/rust-clippy#11919)
Configuration menu - View commit details
-
Copy full SHA for 005b6c2 - Browse repository at this point
Copy the full SHA 005b6c2View commit details -
Auto merge of rust-lang#12227 - y21:issue12225, r=Manishearth
[`redundant_locals`]: take by-value closure captures into account Fixes rust-lang#12225 The same problem in the linked issue can happen to regular closures too, and conveniently async blocks are closures in the HIR so fixing closures will fix async blocks as well. changelog: [`redundant_locals`]: avoid linting when redefined variable is captured by-value
Configuration menu - View commit details
-
Copy full SHA for fdf819d - Browse repository at this point
Copy the full SHA fdf819dView commit details
Commits on Feb 6, 2024
-
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
Configuration menu - View commit details
-
Copy full SHA for 0ac1195 - Browse repository at this point
Copy the full SHA 0ac1195View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7895b98 - Browse repository at this point
Copy the full SHA 7895b98View commit details -
Configuration menu - View commit details
-
Copy full SHA for 36f7248 - Browse repository at this point
Copy the full SHA 36f7248View commit details -
Auto merge of rust-lang#12235 - nyurik:patch-1, r=flip1995
Fix release year in CHANGELOG.md Fixes a typo in rust-lang#12224 CC: `@xFrednet` `@Manishearth` --- changelog: none
Configuration menu - View commit details
-
Copy full SHA for d910f77 - Browse repository at this point
Copy the full SHA d910f77View commit details -
A drive-by rewrite of give_region_a_name()
This rewrite makes the cache-updating nature of the function slightly clearer, using the Entry API into the hash table for region names to capture the update-insert nature of the method. May be marginally more efficient since it only runtime-borrows the map once, but in this context the performance impact is almost certainly completely negligible.
Configuration menu - View commit details
-
Copy full SHA for ad3d04c - Browse repository at this point
Copy the full SHA ad3d04cView commit details -
Auto merge of rust-lang#11812 - Jarcho:issue_11786, r=Alexendoo
Return `Some` from `walk_to_expr_usage` more fixes rust-lang#11786 supersedes rust-lang#11097 The code removed in the first commit would have needed changes due to the second commit. Since it's useless it just gets removed instead. changelog: `needless_borrow`: Fix linting in tuple and array expressions.
Configuration menu - View commit details
-
Copy full SHA for b1e5a58 - Browse repository at this point
Copy the full SHA b1e5a58View commit details
Commits on Feb 7, 2024
-
Auto merge of rust-lang#12216 - bpandreotti:redundant-type-annotation…
…s-fix, r=Jarcho Fix false positive in `redundant_type_annotations` lint This PR changes the `redundant_type_annotations` lint to allow slice type annotations (i.e., `&[u8]`) for byte string literals. It will still consider _array_ type annotations (i.e., `&[u8; 4]`) as redundant. The reasoning behind this is that the type of byte string literals is by default a reference to an array, but, by using a type annotation, you can force it to be a slice. For example: ```rust let a: &[u8; 4] = b"test"; let b: &[u8] = b"test"; ``` Now, the type annotation for `a` will still be linted (as it is still redundant), but the type annotation for `b` will not. Fixes rust-lang#12212. changelog: [`redundant_type_annotations`]: Fix false positive with byte string literals
Configuration menu - View commit details
-
Copy full SHA for 08c8cd5 - Browse repository at this point
Copy the full SHA 08c8cd5View commit details -
Auto merge of rust-lang#12177 - y21:issue12154, r=Jarcho
[`unconditional_recursion`]: compare by `Ty`s instead of `DefId`s Fixes rust-lang#12154 Fixes rust-lang#12181 (this was later edited in, so the rest of the description refers to the first linked issue) Before this change, the lint would work with `DefId`s and use those to compare types. This PR changes it to compare types directly. It fixes the linked issue, but also other false positives I found in a lintcheck run. For example, one of the issues is that some types don't have `DefId`s (primitives, references, etc., leading to possible FNs), and the helper function used to extract a `DefId` didn't handle type parameters. Another issue was that the lint would use `.peel_refs()` in a few places where that could lead to false positives (one such FP was in the `http` crate). See the doc comment on one of the added functions and also the test case for what I mean. The code in the linked issue was linted because the receiver type is `T` (a `ty::Param`), which was not handled in `get_ty_def_id` and returned `None`, so this wouldn't actually *get* to comparing `self_arg != ty_id` here, and skip the early-return: https://github.com/rust-lang/rust-clippy/blob/70573af31eb9b8431c2e7923325c82ba0304cbb2/clippy_lints/src/unconditional_recursion.rs#L171-L178 This alone could be fixed by doing something like `&& get_ty_def_id(ty).map_or(true, |ty_id)| self_arg != ty_id)`, but we don't really need to work with `DefId`s in the first place, I don't think. changelog: [`unconditional_recursion`]: avoid linting when the other comparison type is a type parameter
Configuration menu - View commit details
-
Copy full SHA for 62dcbd6 - Browse repository at this point
Copy the full SHA 62dcbd6View commit details
Commits on Feb 8, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 795be51 - Browse repository at this point
Copy the full SHA 795be51View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9224387 - Browse repository at this point
Copy the full SHA 9224387View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41f9b57 - Browse repository at this point
Copy the full SHA 41f9b57View commit details -
Configuration menu - View commit details
-
Copy full SHA for 11bd2ea - Browse repository at this point
Copy the full SHA 11bd2eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for d2f76f7 - Browse repository at this point
Copy the full SHA d2f76f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 031c46d - Browse repository at this point
Copy the full SHA 031c46dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2ca6c84 - Browse repository at this point
Copy the full SHA 2ca6c84View commit details -
Auto merge of rust-lang#12246 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
Configuration menu - View commit details
-
Copy full SHA for 60cb29c - Browse repository at this point
Copy the full SHA 60cb29cView commit details -
Configuration menu - View commit details
-
Copy full SHA for beb4f7d - Browse repository at this point
Copy the full SHA beb4f7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ec9eec - Browse repository at this point
Copy the full SHA 4ec9eecView commit details -
Configuration menu - View commit details
-
Copy full SHA for d70d320 - Browse repository at this point
Copy the full SHA d70d320View commit details
Commits on Feb 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 698a3c7 - Browse repository at this point
Copy the full SHA 698a3c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for e32c1dd - Browse repository at this point
Copy the full SHA e32c1ddView commit details -
Rollup merge of rust-lang#120308 - utkarshgupta137:duration-opt, r=m-…
…ou-se core/time: avoid divisions in Duration::new In our (decently large) code base, we use `SystemTime::UNIX_EPOCH.elapsed()` in a lot of places & often in a loop or in the hot path. On [Unix](https://github.com/rust-lang/rust/blob/1.75.0/library/std/src/sys/unix/time.rs#L153-L162) at least, it seems we do calculations before hand to ensure that nanos is within the valid range, yet `Duration::new()` still checks it again, using 2 divisions. It seems like adding a branch can make this function 33% faster on ARM64 in the cases where nanos is already in the valid range & seems to have no effect in the other case. Benchmarks: M1 Pro (14-inch base model): ``` duration/current/checked time: [1.5945 ns 1.6167 ns 1.6407 ns] Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) high mild 3 (3.00%) high severe duration/current/unchecked time: [1.5941 ns 1.6051 ns 1.6179 ns] Found 2 outliers among 100 measurements (2.00%) 1 (1.00%) high mild 1 (1.00%) high severe duration/branched/checked time: [1.1997 ns 1.2048 ns 1.2104 ns] Found 8 outliers among 100 measurements (8.00%) 4 (4.00%) high mild 4 (4.00%) high severe duration/branched/unchecked time: [1.5881 ns 1.5957 ns 1.6039 ns] Found 6 outliers among 100 measurements (6.00%) 3 (3.00%) high mild 3 (3.00%) high severe ``` EC2 c7gd.16xlarge (Graviton 3): ``` duration/current/checked time: [2.7996 ns 2.8000 ns 2.8003 ns] Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) low severe 3 (3.00%) low mild duration/current/unchecked time: [2.9922 ns 2.9925 ns 2.9928 ns] Found 7 outliers among 100 measurements (7.00%) 4 (4.00%) low severe 1 (1.00%) low mild 2 (2.00%) high mild duration/branched/checked time: [2.0830 ns 2.0843 ns 2.0857 ns] Found 3 outliers among 100 measurements (3.00%) 1 (1.00%) low severe 1 (1.00%) low mild 1 (1.00%) high mild duration/branched/unchecked time: [2.9879 ns 2.9886 ns 2.9893 ns] Found 5 outliers among 100 measurements (5.00%) 3 (3.00%) low severe 2 (2.00%) low mild ``` EC2 r7iz.16xlarge (Intel Xeon Scalable-based (Sapphire Rapids)): ``` duration/current/checked time: [980.60 ps 980.79 ps 980.99 ps] Found 10 outliers among 100 measurements (10.00%) 4 (4.00%) low severe 2 (2.00%) low mild 3 (3.00%) high mild 1 (1.00%) high severe duration/current/unchecked time: [979.53 ps 979.74 ps 979.96 ps] Found 6 outliers among 100 measurements (6.00%) 2 (2.00%) low severe 1 (1.00%) low mild 2 (2.00%) high mild 1 (1.00%) high severe duration/branched/checked time: [938.72 ps 938.96 ps 939.22 ps] Found 4 outliers among 100 measurements (4.00%) 1 (1.00%) low mild 1 (1.00%) high mild 2 (2.00%) high severe duration/branched/unchecked time: [1.0103 ns 1.0110 ns 1.0118 ns] Found 10 outliers among 100 measurements (10.00%) 2 (2.00%) low mild 7 (7.00%) high mild 1 (1.00%) high severe ``` Bench code (ran using stable 1.75.0 & criterion latest 0.5.1): I couldn't find any benches for `Duration` in this repo, so I just copied the relevant types & recreated it. ```rust use criterion::{black_box, criterion_group, criterion_main, Criterion}; pub fn duration_bench(c: &mut Criterion) { const NANOS_PER_SEC: u32 = 1_000_000_000; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] struct Nanoseconds(u32); impl Default for Nanoseconds { #[inline] fn default() -> Self { // SAFETY: 0 is within the valid range unsafe { Nanoseconds(0) } } } #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct Duration { secs: u64, nanos: Nanoseconds, // Always 0 <= nanos < NANOS_PER_SEC } impl Duration { #[inline] pub const fn new_current(secs: u64, nanos: u32) -> Duration { let secs = match secs.checked_add((nanos / NANOS_PER_SEC) as u64) { Some(secs) => secs, None => panic!("overflow in Duration::new"), }; let nanos = nanos % NANOS_PER_SEC; // SAFETY: nanos % NANOS_PER_SEC < NANOS_PER_SEC, therefore nanos is within the valid range Duration { secs, nanos: unsafe { Nanoseconds(nanos) } } } #[inline] pub const fn new_branched(secs: u64, nanos: u32) -> Duration { if nanos < NANOS_PER_SEC { // SAFETY: nanos < NANOS_PER_SEC, therefore nanos is within the valid range Duration { secs, nanos: unsafe { Nanoseconds(nanos) } } } else { let secs = match secs.checked_add((nanos / NANOS_PER_SEC) as u64) { Some(secs) => secs, None => panic!("overflow in Duration::new"), }; let nanos = nanos % NANOS_PER_SEC; // SAFETY: nanos % NANOS_PER_SEC < NANOS_PER_SEC, therefore nanos is within the valid range Duration { secs, nanos: unsafe { Nanoseconds(nanos) } } } } } let mut group = c.benchmark_group("duration/current"); group.bench_function("checked", |b| { b.iter(|| black_box(Duration::new_current(black_box(1_000_000_000), black_box(1_000_000)))); }); group.bench_function("unchecked", |b| { b.iter(|| { black_box(Duration::new_current(black_box(1_000_000_000), black_box(2_000_000_000))) }); }); drop(group); let mut group = c.benchmark_group("duration/branched"); group.bench_function("checked", |b| { b.iter(|| { black_box(Duration::new_branched(black_box(1_000_000_000), black_box(1_000_000))) }); }); group.bench_function("unchecked", |b| { b.iter(|| { black_box(Duration::new_branched(black_box(1_000_000_000), black_box(2_000_000_000))) }); }); } criterion_group!(duration_benches, duration_bench); criterion_main!(duration_benches); ```
Configuration menu - View commit details
-
Copy full SHA for ec73183 - Browse repository at this point
Copy the full SHA ec73183View commit details -
Rollup merge of rust-lang#120589 - devnexen:cpuaff_fbsd_upd, r=m-ou-se
std::thread::available_parallelism merging linux/android/freebsd version FreeBSD 13.1 had introduced a sched cpu affinity compatibility layer with Linux. 13.0 and even 13.1 being EOL, we can simplify here.
Configuration menu - View commit details
-
Copy full SHA for 2bb518e - Browse repository at this point
Copy the full SHA 2bb518eView commit details -
Rollup merge of rust-lang#120596 - GuillaumeGomez:jump-to-def-non-loc…
…al-link, r=notriddle [rustdoc] Correctly generate path for non-local items in source code pages While browsing some crates using the "jump to def" feature, I realized that a lot of items didn't have a link generated. The reason is because we only cache foreign items if they appear in the documented API. This means that for the others, we need to infer them. r? `@notriddle`
Configuration menu - View commit details
-
Copy full SHA for 330b494 - Browse repository at this point
Copy the full SHA 330b494View commit details -
Rollup merge of rust-lang#120672 - devnexen:update_thread_stack_guard…
…pages_fbsd, r=m-ou-se std::thread update freebsd stack guard handling. up to now, it had been assumed the stack guard setting default is not touched in the field but some user might just want to disable it or increase it. checking it once at runtime should be enough.
Configuration menu - View commit details
-
Copy full SHA for b65f8ec - Browse repository at this point
Copy the full SHA b65f8ecView commit details -
Rollup merge of rust-lang#120693 - nnethercote:invert-diagnostic-lint…
…s, r=davidtwco Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? `@davidtwco`
Configuration menu - View commit details
-
Copy full SHA for 69c0b8c - Browse repository at this point
Copy the full SHA 69c0b8cView commit details -
Rollup merge of rust-lang#120704 - amandasystems:silly-region-name-re…
…write, r=compiler-errors A drive-by rewrite of `give_region_a_name()` This drive-by rewrite makes the cache-updating nature of the method clearer, using the Entry API into the hash table for region names to capture the update-insert nature of the method. May be marginally more efficient since it only runtime-borrows and indexes the map once, but in this context the performance impact is almost certainly completely negligible. Note that this commit should preserve all externally visible behaviour. Notably, it preserves the debug logging: 1. printing even in the case of a `None` for the new computed name, and 2. only printing on new values, begin silent on reused values
Configuration menu - View commit details
-
Copy full SHA for d9edc71 - Browse repository at this point
Copy the full SHA d9edc71View commit details -
Rollup merge of rust-lang#120806 - flip1995:clippy-subtree-update, r=…
…Manishearth Clippy subtree update r? `@Manishearth`
Configuration menu - View commit details
-
Copy full SHA for 5eefb2e - Browse repository at this point
Copy the full SHA 5eefb2eView commit details -
Rollup merge of rust-lang#120809 - reitermarkus:generic-nonzero-const…
…ructors, r=Nilstrieb Use `transmute_unchecked` in `NonZero::new`. Tracking issue: rust-lang#120257 See rust-lang#120521 (comment).
Configuration menu - View commit details
-
Copy full SHA for 222daa8 - Browse repository at this point
Copy the full SHA 222daa8View commit details -
Rollup merge of rust-lang#120817 - compiler-errors:more-mir-errors, r…
…=oli-obk Fix more `ty::Error` ICEs in MIR passes Fixes rust-lang#120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass Fixes rust-lang#120816 - Add a check for `ty::Error` in the MIR validator Also a drive-by fix for a FIXME I had asked oli to add r? oli-obk
Configuration menu - View commit details
-
Copy full SHA for 0c36d65 - Browse repository at this point
Copy the full SHA 0c36d65View commit details