What version of bat are you using?
bat 0.13.0
Describe the bug you encountered:
I bat one of my Rust file and noticed inconsistencies of coloration between 4 very similar functions. See the screenshot and especially the function named find_only_child (the second function of the trait OnlyChildElementExt). It is especially weird since functions before and functions after are colored correctly.

You can access the original source code on crate minidom_ext:src/only_child.rs (for the screenshots, I only removed the comments to make it all appear on one screen but I can also reproduce the bug when comments are present).
Describe what you expected to happen?
Well, I'd expect the functions to be colored similarly.
How did you install bat?
cargo install bat
info.sh output
system [3/17]
------
**$ uname -srm**
Linux 5.3.0-46-generic x86_64
**$ lsb_release -a**
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan
bat
---
**$ bat --version**
bat 0.13.0
**$ env**
PAGER=less
bat_config
----------
bat_wrapper
-----------
No wrapper script.
bat_wrapper_function
--------------------
No wrapper function.
tool
----
**$ less --version**
less 487 (GNU regular expressions)
It looks like the problem is that the syntax definition doesn't handle body-less methods at the moment: https://github.com/sublimehq/Packages/blob/8434c7d8a9211698e73944846ab9c03ca21d1a55/Rust/Rust.sublime-syntax#L898-L909
the fix should be simple, I'll make a PR.
Thank you for this very fast answer :stuck_out_tongue: Note however that the third function is also body-less but then the fourth function is colored correctly (but maybe the third being a one-liner makes the difference?).
The fix is:
--- Shipped Packages/Rust/Rust.sublime-syntax 2019-10-30 16:23:02
+++ Packages/Rust/Rust.sublime-syntax 2020-04-17 11:01:17
@@ -905,6 +905,8 @@
- include: type-any-identifier
- match: ':'
scope: punctuation.separator.rust
+ - match: (?=;)
+ pop: true
fn-body:
- meta_scope: meta.function.rust
but I notice that there is a PR that will conflict, I'll review that one instead to make sure it gets fixed there: https://github.com/sublimehq/Packages/pull/2305
Wouldn't it be better to just replace the syntax file taken from Sublime with the one from ExtendedRust? It solved a similar issue for me.
@mouse07410 that is basically what the referenced PR does in upstream.
@FichteFoll Not quite - as far as I understand, the upstream PR brings the Sublime syntax file to the level of the current ExtendedRust syntax file. My suggestion was switching from using Sublime to using ExtendedRust as upstream (for Rust).
@FichteFoll Not quite - as far as I understand, the upstream PR brings the Sublime syntax file to the level of the _current_ ExtendedRust syntax file. My suggestion was switching from using Sublime to using ExtendedRust as upstream (for Rust).
I prefer using the version in Packages instead of having to maintain an additional syntax. Until the PR has been merged upstream, I patched the Rust syntax according to the suggestion by @keith-hall - see #930
Thank you @sharkdp @keith-hall @mouse07410 @FichteFoll. I was able to test the new version and it works perfectly.
This has been fixed in bat v0.14.
Most helpful comment
It looks like the problem is that the syntax definition doesn't handle body-less methods at the moment: https://github.com/sublimehq/Packages/blob/8434c7d8a9211698e73944846ab9c03ca21d1a55/Rust/Rust.sublime-syntax#L898-L909
the fix should be simple, I'll make a PR.