diff options
author | Aleksey Kladov <[email protected]> | 2020-08-19 16:53:41 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-19 16:53:41 +0100 |
commit | b56e02007798db24600ccae51c0e892919635cad (patch) | |
tree | 100c26d33895d03ecf2ea03659657d4904e8f130 /crates/hir_def/src/diagnostics.rs | |
parent | 11a1bb1c3ec02456813ccb5cb0bdb76f9d39b2ec (diff) |
Apply couple of rule of thumbs to simplify highlighting code
Main one: instead of adding a parameter to function to handle special
case, make the caller handle it.
Second main one: make sure that function does a reasonable thing.
`highlight_def` picks a color for def, *regardless* of the context
the def is use. Feeding an info from the call-site muddies the
responsibilities here.
Minor smells, flagging the function as having space for improvement in
the first place:
* many parameters, some of which are set as constants on most
call-sites (introduce severalfunction instad)
* boolean param (add two functions instead)
Diffstat (limited to 'crates/hir_def/src/diagnostics.rs')
0 files changed, 0 insertions, 0 deletions