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

Check for Default trait implementation in initial condition when linting [manual_unwrap_or_default] #12566

Conversation

ARandomDev99
Copy link
Contributor

Fixes #12564

changelog: Fix [manual_unwrap_or_default] false positive when initial match/if let condition doesn't implement Default but the return type does.

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2024

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 26, 2024
@ARandomDev99 ARandomDev99 changed the title Check for Default trait implementation in initial condition Check for Default trait implementation in initial condition when linting [manual_unwrap_or_default] Mar 26, 2024
@ARandomDev99
Copy link
Contributor Author

r? @Jarcho

@rustbot rustbot assigned Jarcho and unassigned Alexendoo Mar 28, 2024
@ARandomDev99 ARandomDev99 marked this pull request as draft March 28, 2024 04:29
@ARandomDev99 ARandomDev99 marked this pull request as ready for review March 28, 2024 14:21
@bors
Copy link
Collaborator

bors commented Mar 30, 2024

☔ The latest upstream changes (presumably #12579) made this pull request unmergeable. Please resolve the merge conflicts.

xFrednet and others added 18 commits April 1, 2024 19:48
I want to be clear: this is just the initial draft outlining what, I think, should be the responsibilities of the team members. It has not yet been discussed with anyone else.
Instead of just saying “this function's stack frame is big”, report:

* the (presumed) size of the frame
* the size and type of the largest local contributing to that size
* the configurable limit that was exceeded (once)
Signed-off-by: shandongbinzhou <shandongbinzhou@outlook.com>
m-rph and others added 3 commits April 1, 2024 19:49
This extends the `filter_map_identity` lint to support typed closures.

For untyped closures, we know that the program compiles, and therefore
we can safely suggest using flatten.

For typed closures, they may participate in type resolution. In this case
we use `Applicability::MaybeIncorrect`.

Details:
https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Should.20.60filter_map_identity.60.20lint.20when.20closures.20are.20typed.3F
`Box::default()` had its `#[rustc_box]` attribute removed in 1.69 so is
no longer a perf related lint

The lint is moved to style but no longer produces suggestions containing
turbofishes, as they're often longer/more annoying to type
@ARandomDev99 ARandomDev99 deleted the manual_unwrap_or_default-12564 branch April 1, 2024 14:22
@bors
Copy link
Collaborator

bors commented Apr 1, 2024

☔ The latest upstream changes (presumably #12453) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nightly clippy: manual_unwrap_or_default false positive