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

Remove which dependency #2809

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Remove which dependency #2809

merged 1 commit into from
Apr 23, 2024

Conversation

rukai
Copy link
Contributor

@rukai rukai commented Apr 17, 2024

The which dependency was introduced alongside the ability for bindgen to call rustfmt: #905

Theres been some dancing around the need for this dependency, with a feature added to disable it back in 2019 #1615

But I dont believe its actually required at all and in this PR I propose that we can just remove it entirely.

My understanding is that which will check the PATH for any binaries matching the passed name.
However if we were to just attempt to execute that name directly the OS would perform the exact same operation, checking the PATH for any binaries matching the name.
So we should just directly execute rustfmt, unless its overridden by the RUSTFMT env var.

If my understanding is incorrect, lets instead document why which is needed.

@pvdrz
Copy link
Contributor

pvdrz commented Apr 18, 2024

I agree with you, I don't see why we need which considering that Command already does the whole $PATH resolution itself. It could be just there for legacy reasons but there could be some reason why people still need it so I'm pinging @emilio in case he knows why.

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

I guess that the nice thing which allowed us to do was to provide a somewhat nicer error message. But we're not doing that anymore, so yeah let's try this.

@emilio emilio added this pull request to the merge queue Apr 23, 2024
Merged via the queue into rust-lang:main with commit c03964c Apr 23, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants