9942: fix: Don't trigger related highlighting on unrelated tokens r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-08-18 13:04:53 +00:00 committed by GitHub
commit ee4505f396
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,13 +51,15 @@ pub(crate) fn highlight_related(
})?;
match token.kind() {
T![fn] | T![return] | T![?] | T![->] if config.exit_points => {
T![?] if config.exit_points && token.parent().and_then(ast::TryExpr::cast).is_some() => {
highlight_exit_points(sema, token)
}
T![fn] | T![return] | T![->] if config.exit_points => highlight_exit_points(sema, token),
T![await] | T![async] if config.yield_points => highlight_yield_points(token),
T![break] | T![loop] | T![for] | T![while] if config.break_points => {
T![for] if config.break_points && token.parent().and_then(ast::ForExpr::cast).is_some() => {
highlight_break_points(token)
}
T![break] | T![loop] | T![while] if config.break_points => highlight_break_points(token),
_ if config.references => highlight_references(sema, &syntax, position),
_ => None,
}