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

migrate paths to newly-added diagnostic items #6807

Merged
merged 2 commits into from
Mar 8, 2021

Conversation

anall
Copy link
Contributor

@anall anall commented Feb 27, 2021

This gets rid of the following paths:

  • OS_STRING
  • TO_OWNED
  • TO_STRING

Removes some usages of:

  • PATH_BUF

Per #5393

also removes unneeded is_ty_param_path from clippy_lints::types and relocates is_ty_param_lang_item and is_ty_param_diagnostic_item to clippy_utils.

changelog: none

@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 27, 2021
@anall
Copy link
Contributor Author

anall commented Feb 27, 2021

Thought I should do this given I added these for #6730

@@ -307,14 +307,33 @@ fn match_type_parameter(cx: &LateContext<'_>, qpath: &QPath<'_>, path: &[&str])
None
}

/// Checks if `qpath` has last segment with type parameter matching `diagnostic`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Checks if `qpath` has last segment with type parameter matching `diagnostic`
/// Checks if `qpath` has last segment with type parameter matching diagnostic item `diagnostic`

Copy link
Member

Choose a reason for hiding this comment

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

or call the variable diagnostic_item

Copy link
Member

Choose a reason for hiding this comment

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

Also should this be in utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to utils, I had left it here because match_type_parameter is also in this file and I wanted to keep them together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which I can remove entirely if I can figure out a way to switch this use match_type_parameter(cx, qpath, &paths::BOX).is_some()

But Box is a lang item and I haven't noticed an obvious way to use a lang item there.

Copy link
Member

Choose a reason for hiding this comment

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

match_type_parameter should also be in utils :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be happy to move it as part of this but it is now used in a single place -- and a single place that can go away if Box gets a diagnostic item, or we can make a version of this function to check the lang item.

Copy link
Member

Choose a reason for hiding this comment

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

I would still move it, and we can try to remove it as needed. It should still be in one place, otherwise it's harder to find such things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like #6823 added these same functions in a different way, and took care of a lot of the paths I was unable. Re-basing this to just include the new diagnostic items I had added.

Will still move those 2 methods.

@anall anall force-pushed the feature/use_new_diagnostics branch from cfd9e6e to a982142 Compare March 5, 2021 23:14
@bors
Copy link
Contributor

bors commented Mar 7, 2021

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

anall added 2 commits March 7, 2021 17:53
This gets rid of the following paths:
  * OS_STRING
  * TO_OWNED
  * TO_STRING

Also removes some usages of:
  * PATH_BUF

And the now completely unused `clippy_lints::types::is_ty_param_path`
relocate `is_ty_param_lang_item` and `is_ty_param_diagnostic_item` to `clippy_utils`
@anall anall force-pushed the feature/use_new_diagnostics branch from a982142 to 9bdc273 Compare March 8, 2021 00:00
@anall
Copy link
Contributor Author

anall commented Mar 8, 2021

#6823 had collided with a few things I was migrating, pared this down to the ones that missed (namely: the ones I had added)

@Manishearth
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Mar 8, 2021

📌 Commit 9bdc273 has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Mar 8, 2021

⌛ Testing commit 9bdc273 with merge d02ca3b...

@bors
Copy link
Contributor

bors commented Mar 8, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing d02ca3b to master...

@bors bors merged commit d02ca3b into rust-lang:master Mar 8, 2021
@anall anall deleted the feature/use_new_diagnostics branch March 8, 2021 00:20
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.

4 participants