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 off-by-one line numbers in xmlparser::ErrorEmitter #877

Merged
merged 1 commit into from Nov 29, 2019

Conversation

@timbodeit
Copy link
Contributor

timbodeit commented Nov 29, 2019

TextPosition starts counting line numbers at 0. There is a ready made implementation of fmt::Display that accounts for this when showing a TextPosition to a human.

Using this implementation instead of manually showing the zero-indexed line number fixes an off by one error, that the line numbers displayed by the ErrorEmitter are currently having.

TextPosition starts counting line numbers at 0. There is a ready made
implementation of `fmt::Display` that accounts for this when showing a
TextPosition to a human.
Use this implementation instead of manually showing the zero-indexed
line number.
@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Nov 29, 2019

@timbodeit big thanks.
Can you run cargo fmt to make CI happy ?

@timbodeit timbodeit force-pushed the timbodeit:xml-error-wrong-linenumber branch from 9ca45e8 to a5fbd7d Nov 29, 2019
@EPashkin EPashkin merged commit 18a4613 into gtk-rs:master Nov 29, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@timbodeit

This comment has been minimized.

Copy link
Contributor Author

timbodeit commented Nov 29, 2019

@EPashkin Sorry, the PR went out unformatted at first. I normally use automatic rustfmt on save in my IDE, but forgot to enable it after switching to a different machine today.

@timbodeit timbodeit deleted the timbodeit:xml-error-wrong-linenumber branch Nov 29, 2019
@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Nov 29, 2019

@timbodeit No problem, thanks again for fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.