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

Don't assume lang items will exist. #6868

Merged
merged 1 commit into from
Mar 9, 2021
Merged

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Mar 8, 2021

Should fix lintcheck warnings caused by #6823
See below

changelog: None

@rust-highfive
Copy link

r? @flip1995

(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 Mar 8, 2021
@flip1995
Copy link
Member

flip1995 commented Mar 8, 2021

@matthiaskrgr can you test, if this fixes the issue, please?

@matthiaskrgr
Copy link
Member

For the record; the command I use to test is cargo dev-lintcheck (it will build clippy, download and lint some test-sources and dump everything into a log file). You can check the difference against the last update with git diff after running.

It does not look like the patch made a different though, hm. :/

@Jarcho
Copy link
Contributor Author

Jarcho commented Mar 8, 2021

On closer investigation, those are all legitimate lints. Now to figure out why they didn't trigger before.

@Jarcho
Copy link
Contributor Author

Jarcho commented Mar 9, 2021

Turns out match_path isn't really suitable for most uses . match_path reverses both paths, then truncates the longer one before comparing. This works in the common case where only the trait name is used. In libc, the Clone trait is exported from the root module, and all uses of it are through ::Clone, which will never match the path core::clone::Clone.

Should probably remove all uses of match_path, they probably have the same issue.

@Jarcho
Copy link
Contributor Author

Jarcho commented Mar 9, 2021

This still makes a technically correct change, even if it doesn't actually fix anything.

@flip1995
Copy link
Member

flip1995 commented Mar 9, 2021

I don't think this PR makes things better, since it only moves the Option == Option comparison into a map_or closure. This rather hurts the readability.

@flip1995 flip1995 closed this Mar 9, 2021
@Jarcho
Copy link
Contributor Author

Jarcho commented Mar 9, 2021

It does change the behaviour when the clone trait dosen't exist. I'm not sure if that will ever happen.

@flip1995
Copy link
Member

flip1995 commented Mar 9, 2021

Oh right. In that case, this makes sense.

@flip1995 flip1995 reopened this Mar 9, 2021
@flip1995
Copy link
Member

flip1995 commented Mar 9, 2021

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Mar 9, 2021

📌 Commit f2d917e has been approved by flip1995

@bors
Copy link
Contributor

bors commented Mar 9, 2021

⌛ Testing commit f2d917e with merge 627e910...

@bors
Copy link
Contributor

bors commented Mar 9, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 627e910 to master...

@bors bors merged commit 627e910 into rust-lang:master Mar 9, 2021
@Jarcho Jarcho deleted the lang_item branch April 6, 2021 16:06
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.

5 participants