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

Extra trailing new-line at the end of Cargo.lock #7537

Closed
petervaro opened this issue Oct 23, 2019 · 4 comments
Closed

Extra trailing new-line at the end of Cargo.lock #7537

petervaro opened this issue Oct 23, 2019 · 4 comments
Labels
C-bug Category: bug

Comments

@petervaro
Copy link

petervaro commented Oct 23, 2019

Problem

I updated my toolchain (and unfortunately I don't know what the previous version was) and with the latest cargo every time it touches the Cargo.lock it adds 2 new-lines at the end of the file. (Just to be clear: it does not append 2 new-lines every time but the end result of the generation is 2 new-lines at the end of the file.)

The expectation is to have a single new-line at the end of the file.

Steps

  1. Delete Cargo.lock and possibly the target folder
  2. Run cargo build|run|test commands
  3. Inspect Cargo.lock

Notes

Output of cargo version: cargo 1.38.0 (23ef9a4ef 2019-08-20) but the same happens with cargo 1.40.0-nightly (3a9abe3f0 2019-10-15) as well

@petervaro petervaro added the C-bug Category: bug label Oct 23, 2019
@ehuss
Copy link
Contributor

ehuss commented Oct 23, 2019

I think this is somewhat intentional. Cargo has historically had a blank line at the end. There was an accidental regression on beta/nightly back in August (#7262) where it removed the blank line, but it was reverted for the stable release. Perhaps your lock file came from during that time?

There will be a new lock file format on the horizon, which removes the pesky blank line.

@ehuss ehuss closed this as completed Oct 23, 2019
@petervaro
Copy link
Author

@ehuss It did, indeed! The new format is wonderful news. Just out of curiosity, what possible advantage could the extra line at the end of the file has?

@ehuss
Copy link
Contributor

ehuss commented Oct 23, 2019

what possible advantage could the extra line at the end of the file has?

There is none that I know of, I think it was just an artifact of how it was initially implemented. The PR mentioned above keeps the old style just so it doesn't cause needless churn for people who check the lock file into source control.

@petervaro
Copy link
Author

[...] it doesn't cause needless churn for people who check the lock file into source control.

Oh, the irony, 'cause that's exactly what have happened the other way around 😝 Anyway, cheers for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants