Skip to content

Conversation

@tom-anders
Copy link
Contributor

@tom-anders tom-anders commented Sep 4, 2023

This is inspired by this excellent video: https://www.youtube.com/watch?v=6c7pZYP_iIE

Some things I'd appreciate feedback on:

  • I've added this to the borrowed_box.rs check, since these two lints would share a lot of common code. We should probably rename that file, but to what? borrowed_box_or_option.rs? (same goes for the tests) (Edit: looks like the corresponding issue has been closed for now, so let's keep it like it is for now?
  • There's a special case for ignoring &Box<Any> (see borrowed_box lint and Any #1884), I'm not sure if this is needed for &Option<Any> as well.
  • The wording of What it does and Why is this bad could probably use some improvements, suggestions are welcome!

changelog: new lint: [borrowed_option]

@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @blyxyas (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 4, 2023
@blyxyas blyxyas marked this pull request as draft September 4, 2023 15:36
@Centri3
Copy link
Member

Centri3 commented Sep 4, 2023

Regarding &Option<dyn Any>, we don't need the same check since T must be Sized. It's impossible to use &Option<dyn Any>, only &Option<Box<dyn Any>> (or anything else that introduces indirection). This will then suggest Option<&Box<dyn Any>> which is already checked for in the borrowed_box lint.

The lint documentation should provide examples of why it does this (this i.e. exposes implementation details). The example given is fine, but some who aren't too familiar with the borrow checker may question why this exposes implementation details.

@blyxyas
Copy link
Member

blyxyas commented Sep 7, 2023

I've added this to the borrowed_box.rs check, since these two lints would share a lot of common code. We should probably rename that file, but to what? borrowed_box_or_option.rs? (same goes for the tests)

We should probably make a new lint type for borrows and references. cc #11464
I currently have a mildly long review queue, so it will take some days. Until that lint type is created, I'll review this independently ^w^

@bors
Copy link
Contributor

bors commented Oct 23, 2023

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

kawadakk added a commit to kawadakk/arrow-datafusion that referenced this pull request Dec 21, 2023
alamb added a commit to apache/datafusion that referenced this pull request Dec 22, 2023
* Take `&str` instead of `&String` in `ParamValue::get_placeholders_with_values`

<https://rust-lang.github.io/rust-clippy/master/index.html#/ptr_arg>

* Take `Option<&DataType>` instead of `&Option<DataType>` in `ParamValue::get_placeholders_with_values`

<rust-lang/rust-clippy#11463>

* Take `&[_]` instead of `&Vec<_>` in `ParamValues::verify`

<https://rust-lang.github.io/rust-clippy/master/index.html#/ptr_arg>

---------

Co-authored-by: Andrew Lamb <[email protected]>
@xFrednet
Copy link
Contributor

Hey @tom-anders, this is a ping from triage, since there hasn't been any activity in some time. Could you rebase the branch on master?

If you have any questions, you're always welcome to ask them in this PR or on Zulip.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Mar 29, 2024
@tom-anders
Copy link
Contributor Author

@xFrednet Thanks for the reminder! I rebased and also incorporated @blyxyas's suggestions

@tom-anders
Copy link
Contributor Author

(fixed formatting)

@xFrednet
Copy link
Contributor

Perfect, thank you for the swift update :D

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Mar 29, 2024
@xFrednet
Copy link
Contributor

Hey, this is a ping from triage. @blyxyas can you give this PR a review? It's totally fine if you don't have the time right now, you can reassign the PR to a random team member using r? clippy.

@rustbot ready

@xFrednet
Copy link
Contributor

Hey, this is triage: It looks like @blyxyas is currently busy, let's pick a new reviewer.

r? clippy

@rustbot rustbot assigned Alexendoo and unassigned blyxyas Jul 23, 2024
@bors
Copy link
Contributor

bors commented Sep 25, 2024

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

@Alexendoo Alexendoo added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Sep 25, 2024
@rustbot

This comment has been minimized.

@Jarcho
Copy link
Contributor

Jarcho commented Sep 16, 2025

Ping @tom-anders from triage. Do you plan to come back to working on this?

@tom-anders
Copy link
Contributor Author

tom-anders commented Sep 18, 2025

Thanks for the reminder, I rebased to solve the merge conflicts and also adressed all of @Alexendoo's comments (thanks for the review!)

@tom-anders tom-anders force-pushed the borrowed_option branch 3 times, most recently from a70ffcf to bec2f86 Compare September 18, 2025 06:46
@github-actions
Copy link

github-actions bot commented Sep 18, 2025

Lintcheck changes for 97c77d4

Lint Added Removed Changed
clippy::borrowed_option 48 0 0

This comment will be updated if you push new changes

@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2025

☔ The latest upstream changes (possibly 14d36c7) 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-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants