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

Use 'Display::fmt' instead of 'Error::description', fix warnings #286

Merged

Conversation

sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Mar 30, 2020

Error::description has been deprecated in Rust 1.42: https://doc.rust-lang.org/stable/std/error/trait.Error.html#method.description

When compiling syntect with the latest compiler, error messages look like this:

[bat error]: /home/shark/Informatik/rust/bat/assets/syntaxes/01_Packages/PHP/PHP Source.sublime-syntax:
description() is deprecated; use Display

With this fix, we can see the reason for error messages again:

[bat error]: /home/shark/Informatik/rust/bat/assets/syntaxes/01_Packages/PHP/PHP Source.sublime-syntax:
Error while compiling regex '(?x)/\*\*(?:
  (?:\#@\+)?\s*(?m:$) (?# multi-line doc )
  |
  (?=\s+@.*\s\*/\s*(?m:$)) (?# inline doc )
)': Unknown group flag

I also fixed the other two remaining warnings concerning superfluous parentheses.

@sharkdp
Copy link
Contributor Author

sharkdp commented Mar 30, 2020

Note that using Display::fmt allows for a much greater flexibility in creating error messages (with Error::description, they had to be a &'static str, i.e. a fixed string literal).

Copy link
Owner

@trishume trishume left a comment

Choose a reason for hiding this comment

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

Cool thanks for cleaning this up

@trishume trishume merged commit 10ac757 into trishume:master Mar 31, 2020
@trishume
Copy link
Owner

I just released this and your other PR as v4.1.0

@sharkdp sharkdp deleted the use-display-fmt-instead-of-description branch March 31, 2020 07:04
@sharkdp
Copy link
Contributor Author

sharkdp commented Mar 31, 2020

Thank you!

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.

2 participants