-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Clippy subtree update #136209
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
Clippy subtree update #136209
Conversation
Closes rust-lang#11230 changelog: nonew.
This removes the last call to `LateContext::match_def_path()` in Clippy's code. The `LateContext::match_def_path()` in the compiler sources was only kept for Clippy's usage.
Some lifetimes in function return types are not bound to concrete content and can be set arbitrarily. Clippy should not propose to replace them by the default `'_` lifetime if such a lifetime cannot be determined unambigously.
We are checking that we are calling the `as_bytes()` method of `String` or `str`. Checking that it returns a `slice()` does not add anything.
This builds upon the lint for `str::as_bytes()`, and also covers needless uses of the iterator version `str::bytes()`.
It claims to be in 1.83 but in fact will not be until 1.85. Evidence: <rust-lang#134788> is where it was merged into rust-lang/rust, and has a milestone of 1.85.
…13972) I ran Clippy on some projects after upgrading to 1.84, which found a [needless use of `as_bytes()`](rust-lang/rust-clippy#13437). It made me notice that the code was also using `bytes()` needlessly in other places. This PR improves on the `as_bytes()` lint to also lint `bytes()`. ---- changelog: none
The code should not attempt to obtain a snippet by capping the function signature span with its identifier span without checking that they are in the same context.
…ang#13929) Some lifetimes in function return types are not bound to concrete content and can be set arbitrarily. Clippy should not propose to replace them by the default `'_` lifetime if such a lifetime cannot be determined unambigously. I added a field to the `LifetimeChecker` and `Usage` to flag lifetimes that cannot be replaced by default ones, but it feels a bit hacky. Fix rust-lang#13923 changelog: [`needless_lifetimes`]: remove false positives by checking that lifetimes can indeed be elided
The code should not attempt to obtain a snippet by capping the function signature span with its identifier span without checking that they are in the same context. This is the only instance I could identify where placeholders were used instead of the real snippet when running the CI lintcheck. Moreover, the placeholders were not even used, as they snippet was obtained prematurely. Found in the context of rust-lang#13941 changelog: none
At CONTRIBUTING.md there are mentioned [`l-crash`](https://github.com/rust-lang/rust-clippy/issues?q=is%3Aopen+label%3Al-crash) and [`l-bug`](https://github.com/rust-lang/rust-clippy/issues?q=is%3Aopen%20label%3Al-bug) labels which are never used, so correct them to [`I-ICE`](https://github.com/rust-lang/rust-clippy/issues?q=is%3Aopen%20label%3AI-ICE) and [`C-bug`](https://github.com/rust-lang/rust-clippy/issues?q=is%3Aopen%20label%3AC-bug) changelog: none
Checking it only in the merge queue leads to deferred failures once the decision to merge has been taken already.
…ust-lang#13976) Checking it only in the merge queue leads to deferred failures once the decision to merge has been taken already. - [X] Testing first without changelog line - [x] Now that that has failed, adding the changelog line and force-pushing changelog: none
…#13949) This removes the last call to `LateContext::match_def_path()` in Clippy's code. The `LateContext::match_def_path()` in the compiler sources was only kept for Clippy's usage. Once this PR is merged and after the rustup, I will submit one to remove `LateContext::match_def_path()` from the compiler. changelog: none r? @flip1995
Rerunning the PR checks when a PR is synchronized (new commits added, or force-pushed) seems to remove the changelog checks from the UI while keeping the PR mergeable from the maintainer's interface. This PR reruns the cheap changelog check when a PR is synchronized.
…o_std` environment
I opened rust-lang/rust-clippy#13896 before. However, I found that there're more cases where Clippy suggests to use modules that belong to the `std` crate even in a `no_std` environment. Therefore, this PR include the changes I've made in rust-lang#13896 and new changes to fix cases I found this time to prevent wrong suggestions in `no_std` environments as well. changelog: [`redundant_closure`]: correct suggestion in `no_std` changelog: [`repeat_vec_with_capacity`]: correct suggestion in `no_std` changelog: [`single_range_in_vec_init`]: don't emit suggestion to use `Vec` in `no_std` changelog: [`drain_collect`]: correct suggestion in `no_std` changelog: [`map_with_unused_argument_over_ranges`]: correct suggestion in `no_std` also close rust-lang#13895
fix rust-lang#14034 The currect implementation of `obfuscated_if_else` sometimes makes incorrect suggestions when the original code have side effects (see the example in the above issue). I think this can be fixed by changing the applicability depending on whether it can have side effects or not. changelog: [`obfuscated_if_else`]: change applicability when the original code can have side effects
Add a new lint `doc_overindented_list_items` to detect and fix list items in docs that are overindented. For example, ```rs /// - first line /// second line fn foo() {} ``` this would be fixed to: ```rs /// - first line /// second line fn foo() {} ``` This lint improves readabiliy and consistency in doc.
Add a new lint `doc_overindented_list_items` to detect and fix list items in docs that are overindented. For example, ```rs /// - first line /// second line fn foo() {} ``` this would be fixed to: ```rs /// - first line /// second line fn foo() {} ``` This lint improves readabiliy and consistency in doc. --- - \[x] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[x] Executed `cargo dev update_lints` - \[x] Added lint documentation - \[x] Run `cargo dev fmt` [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints changelog: [`doc_overindented_list_items`]: Added a new lint that detects overindented list items in docs fixes: rust-lang#13601
Currently, the CI pipeline triggers `Lintcheck` for all PRs. However, this check takes significant amount of time and seems unnecessary for some certain directories that are frequently updated. r? flip1995 changelog: none
r? @ghost changelog: none
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
3bf2035
to
4288227
Compare
@bors r+ p=1 rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (aeba3c6): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.7%, secondary -3.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 2.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 770.985s -> 768.982s (-0.26%) |
Fix the version of `doc_overindented_list_items`. It actually will be in 1.86.0, not 1.80.0. (rust-lang/rust#136209 has a milestone of 1.86.0) changelog: none
r? @Manishearth
Quite a bit late, as I was on vacation and then we had an issue in MacOS CI after the sync.