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

Handle modifying rc files that don't have a trailing newline #2667

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

mythmon
Copy link
Contributor

@mythmon mythmon commented Feb 16, 2021

This changes the flow so that instead of checking if &rc.is_file, it just tries to read the file and handles the error. I think this an ok way to handle it, though it might produce a little more IO. It simplifies the logic a lot.

I couldn't find any tests that cover this function, and I'm not comfortable adding tests right now, but I could try and tackle that with some guidance, or if there is a similar test I could use an example.

Fixes #2636.

@mythmon
Copy link
Contributor Author

mythmon commented Feb 16, 2021

I found the tests in the CI build, and added one for this. I ran cargo test before pushing this PR. Any idea why it didn't run that test?

@kinnison
Copy link
Contributor

I'm not sure why the test didn't run for you locally, you can clearly see it running in CI here - https://github.com/rust-lang/rustup/pull/2667/checks?check_run_id=1914524215#step:17:1345

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

One potential tweak to be done to coments in the tests, and a break which I think should be a continue

Otherwise this looks good, thank you for making the effort to contribute.

src/cli/self_update/unix.rs Outdated Show resolved Hide resolved
tests/cli-paths.rs Outdated Show resolved Hide resolved
@kinnison kinnison added this to the 1.24.0 milestone Feb 20, 2021
Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

This content is looking excellent, thank you for the extra test too, that is very useful.

Could you rebase the commits so that it's a clean change, and then we can look to merge this.

Thank you for your work.

@mythmon
Copy link
Contributor Author

mythmon commented Feb 22, 2021

Alright, rebased and squashed down to one commit. Thanks for the review and guidance!

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

👍

I'll merge on green-CI

@kinnison kinnison merged commit fc2f6b1 into rust-lang:master Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants