-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add lint to suggest into()
to construct reference-counted slice
#2807
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
Add lint to suggest into()
to construct reference-counted slice
#2807
Conversation
fd28667
to
ebfda29
Compare
Hi @oli-obk, here's what I started on for #2623. A few questions—how can I print debug information from running the lint? I tried something like this: cx.sess().span_note(expr.span, &format!("{:?}", ty)) (from that article linked in
What else do I need to change to get the lint running? |
The dogfood test complains about
|
Sorry, I had committed it after removing some things for debugging. After 5958ddf the tests are passing but I don't think it runs the lint (I don't see anything happen even if I put a |
You need to add the lint to lib.rs. Also try running the utils/update_lints.py script first |
Yeah I just ran |
Ah, sorry, didn't see that running the script didn't add a |
5958ddf
to
ff3228c
Compare
…o use_shared_from_slice
@oli-obk would you mind checking up on the progress here? I fixed up I noticed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling we're overlooking some cases here. Can you run your lint on a bunch of crates like cargo
, rls
or other big crates to see what kind of situations trigger your lints there?
if let Some(arg) = args.get(0); | ||
|
||
then { | ||
if arg_is_vec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is a little dangerous, because the message might appear even if the user has no way to change the type. For Rc<Vec<[T]>>
this is is kinda fine, because the suggestion will still work, but for Rc<String>
I'm not sure if .as_str().into()
is equivalent.
ping @rudyardrichter, do you still want to finish this up? |
Ping @rudyardrichter. I'm going over old PRs, that were abandoned by us reviewers (sorry for that!) or by the authors. Are you still interested in completing this? |
Hey @flip1995, probably best to let someone else take this. Apologies. |
No worries. Sorry for not giving you an earlier review. Thanks for your contribution! |
To resolve #2623.