Skip to content
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

Update Clippy #110003

Merged
merged 136 commits into from
Apr 11, 2023
Merged

Update Clippy #110003

merged 136 commits into from
Apr 11, 2023

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Apr 6, 2023

danielparks and others added 30 commits February 11, 2023 07:50
It is possible to use conditional compilation to prevent Clippy from
evaluating certain code. This adds a brief explanation of how to use the
feature with conditional compilation, and mentions that generally it’s
preferable to use something like `#[allow(clippy::all)]`.

Fixes rust-lang#10220 — Ability to skip files or blocks entirely
Rename method to `is_range_full` because the type is actually
`RangeFull`.

Method moved to `clippy_utils` for reuse in `clear_with_drain`.
Use `split-debuginfo = "unpacked"` for debug builds

On Windows this has no effect as it's unsupported. On macOS the default set by cargo is already unpacked so no effect there either

For Linux it shaves a bit off the rebuild time, for me in the case of a simple `touch` + `cargo build` it goes from 12s to 10s

It saves a good amount of disk space too, on `aarch64-unknown-linux-gnu` it saves 1.2GB for a plain `cargo build`, 3GB when also running `cargo dev` and `cargo test --no-run -F internal`

r? `@flip1995`

changelog: none
changelog: fix: Replace the nonexistent `allowed-locales` in the `DISALLOWED_SCRIPT_IDENTS` docs with `allowed-scripts`.
docs fix: unknown field `allowed-locales`

changelog: [`DISALLOWED_SCRIPT_IDENTS`]: Replace the nonexistent `allowed-locales` in the docs with `allowed-scripts`.
…ng from float

suggest `try_into` when casting to wildcard type;
fix [`cast_possible_truncation`] suggesting useless parenthesis;

remove suggesting for float to float conversion in [`cast_possible_truncation`]

style nit
…tr-casts-parens, r=Jarcho

Wrap `transmutes_expressible_as_ptr_casts` suggestions in parentheses

changelog: [`transmutes_expressible_as_ptr_casts`]: Fix suggestion missing wrapping parentheses

Fixes rust-lang#10449

r? `@Jarcho`

Is this the best way to go about this? `unused_parens` will catch the unnecessary ones but emitting them in the first place isn't ideal
Add explanation on how to run `cargo-clippy` and `clippy-driver`

I don't know how this would be done on Windows or MacOS, feedback appreciated.

I did find this snippet for MacOS but it seems a little sketchy.

https://github.com/rust-lang/rust-clippy/blob/1d1e72308e5bcdf5abe95c1d29dfe82524940061/.github/workflows/clippy_bors.yml#L98-L102

changelog: none
fix [`cast_possible_truncation`] offering wrong suggestion for casting float to integer

fixes: rust-lang#10366

---

changelog: [`cast_possible_truncation`] Fix incorrect suggestions when casting from float types or to `_`
Make this function work with signed integer types by extracting the
underlying type and finding the min and max values.

Change the signature to make it more consistent:
- The range is now given as an `Expr` in order to extract the type
- The container's path is now passed, and only as an `Option` so that
  the function can be called in the general case without a container
KisaragiEffective and others added 11 commits April 10, 2023 01:31
Co-authored-by: llogiq <bogusandre@gmail.com>
Add `max_line_length` to `.editorconfig`, matching `rustfmt.toml`

Add `max_line_length` to `.editorconfig` to match the `max_width` in `rustfmt.toml`.

changelog: none
[missing_const_for_fn] fix rust-lang#7121

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`missing_const_for_fn`] note about removing const may break compatibility

fix rust-lang#7121
…r=xFrednet

remove unusued `#![feature(drain_filter)]`

The unstable feature does not appear to be used and its presence blocks work in rust-lang#104455

changelog: none
…dnet

fix(needless_return): do not trigger on ambiguous match arms return

If we see a case where match returns something other than `()`, we just skip `needless_return` lint in that case

Should fix rust-lang#10546

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.2310546

---

changelog: FP: [`needless_return`]: No longer lints match statements with incompatible branches
[rust-lang#10593](rust-lang/rust-clippy#10593)
<!-- changelog_checked -->
Clear with drain

Fixes rust-lang#10572: both the original intent of the issue (extending `clear_with_drain`) and the false negative for `collection_is_never_read` I found in the process are fixed by this PR.

changelog: [`clear_with_drain`]: extend to 5 other types of containers. [`collection_is_never_read`]: fix false negative for `String`s.
…t_type, r=Manishearth

`collection_is_never_read`: Handle unit type

changelog: [`collection_is_never_read`]: Fix false negative
fixes: rust-lang#10488
flip1995 and others added 4 commits April 11, 2023 14:43
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.
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.

---

Blocks rust-lang#110003 (comment)

changelog: none
@flip1995
Copy link
Member Author

@Manishearth CI is passing now 🚀

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2023

📌 Commit c355e6b has been approved by Manishearth

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2023
@matthiaskrgr
Copy link
Member

@bors p=10

@bors
Copy link
Contributor

bors commented Apr 11, 2023

⌛ Testing commit c355e6b with merge 87a2408...

@bors
Copy link
Contributor

bors commented Apr 11, 2023

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 87a2408 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 11, 2023
@bors bors merged commit 87a2408 into rust-lang:master Apr 11, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 11, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (87a2408): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.9%, 0.9%] 1

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.7% [1.7%, 1.7%] 1
Improvements ✅
(primary)
-2.0% [-2.5%, -1.5%] 2
Improvements ✅
(secondary)
-6.9% [-6.9%, -6.9%] 1
All ❌✅ (primary) -2.0% [-2.5%, -1.5%] 2

Cycles

Results

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.

mean range count
Regressions ❌
(primary)
0.5% [0.4%, 0.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.5%, 0.5%] 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.