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

fix(rustic-babel): disable toolchain when invalid/unneeded #499

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuuyins
Copy link

@yuuyins yuuyins commented Mar 26, 2023

When the user installs Rust tools using a method other than rustup, e.g. using an operating system's package manager, cargo generally has no support for toolchain specification. In such case, the user can then nil, or "", so that the rescpective functions in `rustic-babel' will remove the toolchain from params, that is only toolchain has a valid value it uses toolchain.

See also: #279 (comment), #498

@yuuyins
Copy link
Author

yuuyins commented Mar 26, 2023

i did this fix a while ago and works for me, unsure if it's fit. can't remember why i didn't PR

Copy link
Collaborator

@psibi psibi left a comment

Choose a reason for hiding this comment

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

Apart from some minor changes/questions, I think having an additional test would be good too.

rustic-babel.el Outdated Show resolved Hide resolved
rustic-babel.el Outdated
(params (remove nil (list "cargo"
(unless (or (null toolchain)
(= 0 (string-blank-p toolchain))
(equal "+" toolchain))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why we are doing this check ?

Copy link
Author

@yuuyins yuuyins Apr 22, 2023

Choose a reason for hiding this comment

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

the (equal "+" toolchain) is in for just in case whatever it might be that no string was given to toolchain

rustic-babel.el Outdated Show resolved Hide resolved
@yuuyins yuuyins marked this pull request as draft April 2, 2023 02:45
@yuuyins yuuyins marked this pull request as ready for review April 22, 2023 23:41
@yuuyins yuuyins requested a review from psibi April 22, 2023 23:41
@yuuyins
Copy link
Author

yuuyins commented Apr 22, 2023

working for me with (setq rustic-babel-default-toolchain nil)

@yuuyins yuuyins marked this pull request as draft April 22, 2023 23:44
@yuuyins
Copy link
Author

yuuyins commented Apr 22, 2023

forgot about the test i'll have to look into it

Copy link
Collaborator

@psibi psibi left a comment

Choose a reason for hiding this comment

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

Thanks, this LGTM. I'm willing to merge this without a test since the updated code is much easier to read, if you are okay with it. :-)

@yuuyins yuuyins marked this pull request as ready for review April 24, 2023 11:34
@yuuyins
Copy link
Author

yuuyins commented Apr 24, 2023

@psibi yes, please you can merge it. ah, it seems the existing tests are failing

@psibi
Copy link
Collaborator

psibi commented Apr 24, 2023

@yuuyins Sorry, it seems there is some test failures. Can you look into it ?

rustic-babel.el Outdated
Comment on lines 88 to 93
((or (null rustic-babel-default-toolchain)
(null (string-blank-p rustic-babel-default-toolchain)))
nil)

Choose a reason for hiding this comment

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

this bit doesn't look quite right to me... string-blank-p will return 0 if its an empty string, so null will be false.

I'm not sure if this is related to the failing tests, but if rustic-babel-default-toolchain were set to "" in the test environment, we wouldn't hit nil here and would fall through.

Copy link
Author

Choose a reason for hiding this comment

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

eq 0 now, thank you so much! if you have resources/time to see what's going on with the tests, that would be wonderful as I'm having to max focus on other stuff rn.

Choose a reason for hiding this comment

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

i will give it a shot, i need to set up all the dependencies locally to run tests, so it may be a bit before i can get to it.

When the user installs Rust tools using a method other than rustup, e.g. using
an operating system's package manager, cargo generally has no support for
toolchain specification. In such case, the user can then `nil', or `""', so that
the respective functions in `rustic-babel' will remove the toolchain from
params, i.e. only toolchain has a valid value if Cargo has toolchain support.

See also: brotzeit#279 (comment)

Fixes brotzeit#498 introduced in 80d05c4

Co-authored-by: Sibi Prabakaran <[email protected]>
@StrictlyMonad
Copy link

@psibi mind approving the workflow for us to determine if the PR still fails or not?

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.

4 participants