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

Allow Box<[JsValue]> parameter type #4371

Closed
wants to merge 2 commits into from
Closed

Conversation

rivertam
Copy link

changelog: Don't warn boxed_local for unsized
fixes #4351

return false;
}

!ty.boxed_ty()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this function is clearer if you just write ty.is_box() && !ty.boxed_ty().is_sized(..)

Everything else LGTM.

@phansch phansch added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Aug 12, 2019
@ghost
Copy link

ghost commented Aug 25, 2019

I don't think this fixes the issue. The code changed relates to the unstable box keyword. Boxes in parameters should still be linted with this which was mentioned in the issue. (I haven't actually tested this but there isn't a test for it either.)

@flip1995
Copy link
Member

Good catch. I also think, that #4351 (comment) is the right solution.

@rivertam rivertam changed the title Don't warn boxed_local for unsized Allow Box<[JsValue]> parameter type Aug 29, 2019
@rivertam
Copy link
Author

rivertam commented Aug 29, 2019

I'm trying to implement this as we discussed in the issue, but I'm struggling on how to check if the boxed type is a [wasm_bindgen::JsValue]. I imagine we could use ty.boxed_ty().same_type(js_array_value_ty), but I don't know how to construct js_array_value_ty. Open to other approaches, but this is the only particularly helpful method I'm seeing on Ty.

@flip1995
Copy link
Member

JsValue has probably ty::TyKind::Path(qpath).

You can add the whole path of the JsValue (the whole path not the path of the reexport if it is a reexport) to utils::paths and then use the function utils::match_qpath to check if it's the type.

@bors
Copy link
Collaborator

bors commented Sep 27, 2019

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

@flip1995
Copy link
Member

Thanks for contributing to Clippy! Sadly this PR was not updated in quite some time. If you waited on input from a reviewer, we're sorry that this fell under the radar. If you want to continue to work on this, just reopen the PR and/or ping a reviewer.

@flip1995 flip1995 closed this May 25, 2020
@flip1995 flip1995 added S-inactive-closed Status: Closed due to inactivity and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive-closed Status: Closed due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive for boxed local with wasm_bindgen
4 participants